vrq
Classes | Public Member Functions | Static Public Member Functions | List of all members
CSymbol Class Reference

Holder for character strings. More...

#include <csymbol.h>

Inheritance diagram for CSymbol:
CObject

Public Member Functions

 CSymbol (const char *aName)
 Create a symbol. More...
 
 ~CSymbol (void)
 Destroy symbol. More...
 
const char * GetName (void) const
 Get symbol's text. More...
 
int Escaped (void) const
 Determine if string is an escaped symbol. More...
 
int External () const
 Determine if symbol is external reference return non-zero if symbol is external. More...
 
- Public Member Functions inherited from CObject
void * operator new (size_t size, CObstack *stack)
 Allocate object on CObstack heap. More...
 
void operator delete (void *object)
 Destroy object. More...
 

Static Public Member Functions

static CSymbolLookup (const char *name)
 Find symbol for given string. More...
 
static CSymbolGenSymbol (const char *prefix)
 Generated a new symbol with a unique name using the given prefix. More...
 
static void DumpTable (void)
 Dump symbol table. More...
 
static void SetObstack (CObstack *aObstack)
 Set heap to use for storage. More...
 
static void DumpStats ()
 Dump hash table stats. More...
 

Detailed Description

Holder for character strings.

All tokens are registered as symbols to allow pointers to be compared for string equality instead of the contents of the strings.

Constructor & Destructor Documentation

CSymbol::CSymbol ( const char *  aName)

Create a symbol.

Parameters
aNametext for symbold.
CSymbol::~CSymbol ( void  )

Destroy symbol.

Member Function Documentation

static void CSymbol::DumpStats ( )
static

Dump hash table stats.

static void CSymbol::DumpTable ( void  )
static

Dump symbol table.

int CSymbol::Escaped ( void  ) const

Determine if string is an escaped symbol.

Returns
non-zero if string is escaped
int CSymbol::External ( ) const

Determine if symbol is external reference return non-zero if symbol is external.

static CSymbol* CSymbol::GenSymbol ( const char *  prefix)
static

Generated a new symbol with a unique name using the given prefix.

Parameters
prefixto use when generating symbol.
Returns
new symbol.
const char* CSymbol::GetName ( void  ) const

Get symbol's text.

Returns
text string for symbol.
static CSymbol* CSymbol::Lookup ( const char *  name)
static

Find symbol for given string.

If not found create a symbol for it.

Parameters
nametext string to search for.
Returns
symbol for name
static void CSymbol::SetObstack ( CObstack aObstack)
static

Set heap to use for storage.


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