XML Library
|
A lookup table used to check the attributes of characters in an XML stream. More...
#include <CharTable.hpp>
Public Member Functions | |
CharTable () | |
Default constructor. | |
~CharTable () | |
Destructor. | |
bool | isWhitespace (tchar cChar) const |
Check if a character is whitespace. | |
bool | isIdentifier (tchar cChar) const |
Check if a character is valid in an identifier. | |
Private Types | |
enum | { DEFAULT = 0x0000, WHITESPACE = 0x0001, IDENTIFIER = 0x0002 } |
The character flags. More... | |
typedef std::map< uint, uint > | MapCharFlags |
A map of character to flags. | |
Private Member Functions | |
uint | getFlags (uint nChar) const |
Get the flags for the character. | |
uint & | getFlags (uint nChar) |
Get the flags for the character. | |
void | appendFlags (tchar cChar, uint nFlags) |
Append flags for the character. | |
void | appendFlags (tchar cFirst, tchar cLast, uint nFlags) |
Append flags for the character range. | |
Private Attributes | |
uint | m_anASCII [TABLE_SIZE] |
Lookup table for the ASCII chars. | |
MapCharFlags | m_mapOther |
Lookup map for non-ASCII chars. | |
Static Private Attributes | |
static const size_t | TABLE_SIZE = 127 |
The size of the ASCII table. |
A lookup table used to check the attributes of characters in an XML stream.
The class optimises for the ASCII character range by using a fixed size array, and then falls back to a map for non-ASCII chars.
typedef std::map<uint, uint> XML::CharTable::MapCharFlags [private] |
A map of character to flags.
anonymous enum [private] |
Default constructor.
Destructor.
bool XML::CharTable::isWhitespace | ( | tchar | cChar | ) | const [inline] |
Check if a character is whitespace.
bool XML::CharTable::isIdentifier | ( | tchar | cChar | ) | const [inline] |
Check if a character is valid in an identifier.
uint XML::CharTable::getFlags | ( | uint | nChar | ) | const [private] |
Get the flags for the character.
uint & XML::CharTable::getFlags | ( | uint | nChar | ) | [private] |
Get the flags for the character.
void XML::CharTable::appendFlags | ( | tchar | cChar, |
uint | nFlags | ||
) | [private] |
Append flags for the character.
void XML::CharTable::appendFlags | ( | tchar | cFirst, |
tchar | cLast, | ||
uint | nFlags | ||
) | [private] |
Append flags for the character range.
The range is [First, Last] and hence is inclusive of Last unlike with iterators.
const size_t XML::CharTable::TABLE_SIZE = 127 [static, private] |
The size of the ASCII table.
uint XML::CharTable::m_anASCII[TABLE_SIZE] [private] |
Lookup table for the ASCII chars.
MapCharFlags XML::CharTable::m_mapOther [private] |
Lookup map for non-ASCII chars.