#include <SGMLUtil.h>
A utility class provides some functions for SGML (Standard Generalized Markup Language)
In the current version of SGMLUtil, only few basic functions are provided to do SGML entity conversion.
Static Public Member Functions | |
static wchar_t | decodeSGMLEntity (wchar_t *sgmlEntity, int length=-1) |
static wchar_t * | decodeString (wchar_t *srcBuffer, int length=-1, bool withTolerance=false) |
static int | getEncodedStringLength (const wchar_t *srcBuffer) |
static wchar_t * | encodeString (wchar_t *destBuffer, const wchar_t *srcBuffer) |
Static Public Attributes | |
static const int | MIN_ENTITY_LENGTH = 2 |
static const int | MAX_ENTITY_LENGTH = 31 |
|
static |
Decode a SGL entity and return the decoded character.
Note if the given string does not contain SGML entity, the original string will be returned; if the given string contains a SGML entity in invalid format, '\x0' (ASCII code 0) will be returned.
sgmlEntity | A wide-char C string contains a SGML entity |
length | The length that marks the portion of the give C string to be decoded. The default value means decoding will be performed for the whole C string. |
|
static |
Decode SGML entities in a given C string, generate a new C string and return it by pointer.
Caution Caller needs to destroy the returned C string.
srcBuffer | A wide-char C string may contains characters need to be encoded in SGML entity |
length | The length that marks the portion of the give C string need to be decoded. The default value means decoding will be performed for the whole C string. |
withTolerance | True means to do the decoding with a bit tolerance on the entity syntax. For example, the ending token ';' at the end of entity can be missing for NCR (Numeric character reference) entities. False means the entity syntax must be completely correct. |
|
static |
Gets the length of a given C string after certain characters it contains have been encoded into SGML entities .
srcBuffer | A wide-char C string may contains characters need to be encoded in SGML entity. |
|
static |
Encode a C string so that certain characters it contains are encoded into SGML entities .
destBuffer | A wide-char C string used to receive the encoded string. This C string must have enough capacity to receive the encoded string. To get the encoded string length, use function getEncodedStringLength(). |
srcBuffer | A wide-char C string may contains characters need to be encoded in SGML entity. |
destBuffer
.
|
static |
The minimum length of SGML entity, measured by characters.
|
static |
The maximum length of SGML entity, measured by characters.