TagMap Class Reference

Represents mapping of numeric values of tagnames to their string value. More...

#include <tagmap.h>

Collaboration diagram for TagMap:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~TagMap ()
unsigned insertTag (const char *tag)
 Inserts a new string of a tagname and returns the numeric value.
unsigned insertTagWithOffset (const char *tag, unsigned start_offset, unsigned end_offset)
 Inserts a new string of a tagname and returns the numeric value.
void print (OutputStream &dos)
 Prints mapping of (numeric values of) tagnames to their string values.
const char * getTag (unsigned id)
 Returns string value for the entered (numeric value of a) tagname.

Static Public Member Functions

static TagMapgetInstance ()
 Returns instance of TagMap.

Private Member Functions

 TagMap ()
 Constructor.

Private Attributes

vector< const char * > tags
StringHash sh

Static Private Attributes

static TagMapinstance = NULL
 Instance of TagMap.


Detailed Description

Represents mapping of numeric values of tagnames to their string value.

Represents mapping of numeric values of tagnames to their string value, which takes therefore a string, e.g. <tagname></tagname> or <tagname/>, as arguments and returns the string value for a (numeric value of a) tagname.

Note:
Tagnames are internally represented by numbers!

SINGLETON PATTERN!

Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 61 of file tagmap.h.


Constructor & Destructor Documentation

TagMap::~TagMap (  )  [virtual]

Destructor.

Definition at line 57 of file tagmap.cpp.

References tags.

TagMap::TagMap (  )  [private]

Constructor.

Constructor - creating object.

Definition at line 50 of file tagmap.cpp.

References tags.

Referenced by getInstance().


Member Function Documentation

static TagMap * TagMap::getInstance (  )  [static]

Returns instance of TagMap.

Returns instance of TagMap, i.e. of this object.

Return values:
TagMap* Pointer to a TagMap object.

Definition at line 42 of file tagmap.cpp.

References instance, and TagMap().

Referenced by BufferNode::debugPrint(), Executor::finalDebugPrint(), ProjectionDFATransitions::print(), BufferNode::print(), BufferNode::printNoSubnodes(), and Executor::~Executor().

const char * TagMap::getTag ( unsigned  id  )  [inline]

Returns string value for the entered (numeric value of a) tagname.

Returns string value for the entered (numeric value of a) tagname.

Parameters:
[in] id Numeric value of a tagname.
Return values:
char* Pointer to a char object.

Definition at line 110 of file tagmap.h.

References tags.

Referenced by BufferNode::debugPrint(), NodeConstructExpression::eval(), ProjectionDFATransitions::print(), PathStepTagExpression::print(), NodeConstructExpression::print(), BufferNode::print(), and BufferNode::printNoSubnodes().

unsigned TagMap::insertTag ( const char *  tag  ) 

Inserts a new string of a tagname and returns the numeric value.

Inserts a new string of a tagname and returns the numeric value.

Parameters:
[in] tag Pointer to a char object (string of a tagname).
Return values:
unsigned Numeric value for string value of a tagname.

Definition at line 63 of file tagmap.cpp.

References StringHash::hash(), sh, and tags.

unsigned TagMap::insertTagWithOffset ( const char *  tag,
unsigned  start_offset,
unsigned  end_offset 
)

Inserts a new string of a tagname and returns the numeric value.

Inserts a new string of a tagname and returns the numeric value. Thereby the string is copied starting from position start up to position end.

Parameters:
[in] tag Pointer to a char object (string of a tagname).
[in] start_offset The start offset (from the left).
[in] end_offset The end offset (from the right).
Return values:
unsigned Numeric value for string value of a tagname.

Definition at line 76 of file tagmap.cpp.

References StringHash::hash(), sh, and tags.

Referenced by StreamTracker::processBachelorTag(), and StreamTracker::processOpeningTag().

void TagMap::print ( OutputStream dos  ) 

Prints mapping of (numeric values of) tagnames to their string values.

Prints mapping of (numeric values of) tagnames to their string values.

Parameters:
[in] dos Pointer to a OutputStream object.
Return values:
void 

Definition at line 94 of file tagmap.cpp.

References NEWLINE, and tags.

Referenced by Executor::finalDebugPrint().


Member Data Documentation

static TagMap * TagMap::instance = NULL [static, private]

Instance of TagMap.

Instance of TagMap to avoid duplicate existence of this object.

Definition at line 117 of file tagmap.h.

Referenced by getInstance().

StringHash object to hash string values to avoid duplicate insertion.

Definition at line 134 of file tagmap.h.

Referenced by insertTag(), and insertTagWithOffset().

vector< const char * > TagMap::tags [private]

The string values of all used tagnames.

Definition at line 128 of file tagmap.h.

Referenced by getTag(), insertTag(), insertTagWithOffset(), print(), TagMap(), and ~TagMap().


Generated on Sun May 24 20:20:30 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9