XML Library
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
XML::CharTable Class Reference

A lookup table used to check the attributes of characters in an XML stream. More...

#include <CharTable.hpp>

List of all members.

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.

Detailed Description

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.


Member Typedef Documentation

typedef std::map<uint, uint> XML::CharTable::MapCharFlags [private]

A map of character to flags.


Member Enumeration Documentation

anonymous enum [private]

The character flags.

Enumerator:
DEFAULT 

The default flags.

WHITESPACE 

A whitespace character.

IDENTIFIER 

A character for use in identifiers.


Constructor & Destructor Documentation

Default constructor.

Destructor.


Member Function Documentation

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.


Member Data Documentation

const size_t XML::CharTable::TABLE_SIZE = 127 [static, private]

The size of the ASCII table.

Lookup table for the ASCII chars.

Lookup map for non-ASCII chars.


The documentation for this class was generated from the following files: