Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

STRING Class Reference

The STRING class packages a character string which has been allocated in a hash table. More...

#include <str.h>

List of all members.

Public Member Functions

 STRING (void)
 STRING (const STRING &str)
 ~STRING ()
const char * GetText (void)
void SetText (const char *t)
void pr (FILE *fp=stdout)

Private Attributes

char * text


Detailed Description

The STRING class packages a character string which has been allocated in a hash table.

All strings in this table are unique. As a result, string comparison can be done my comparing the string pointers.

The usage of this class assumes that the string has been entered in the string table. If the text field is initialized with a string, make sure that the string is entered in the string table (find_string can be called with a STRING argument, in which case it will make a copy of the string pointed to by text).

This class is used by the string table hash table in strtable.h

Definition at line 39 of file str.h.


Constructor & Destructor Documentation

STRING::STRING void   )  [inline]
 

Definition at line 44 of file str.h.

References NULL, and text.

00044 { text = NULL; }

STRING::STRING const STRING str  )  [inline]
 

Definition at line 45 of file str.h.

00046     {
00047         (*this) = str;
00048     } // copy constructor

STRING::~STRING  )  [inline]
 

Definition at line 49 of file str.h.

00049 { /* do nothing */ }


Member Function Documentation

const char* STRING::GetText void   )  [inline]
 

Definition at line 51 of file str.h.

References text.

Referenced by symtable::enter_sym(), type_record::find_elem(), strtable::find_string(), symtable::find_sym(), sym_scope::LookupFromScope(), strtable::new_item(), pr(), symtable::chain_elem::search_list(), and strtable::chain_elem::search_list().

00051 { return text; }

void STRING::pr FILE *  fp = stdout  )  [inline]
 

Definition at line 55 of file str.h.

References GetText().

Referenced by symtable::pr(), and strtable::pr().

00056     {
00057         fprintf(fp, "%s", GetText() );
00058     }

void STRING::SetText const char *  t  )  [inline]
 

Definition at line 53 of file str.h.

References text.

Referenced by symtable::enter_sym(), strtable::find_string(), symtable::find_sym(), strtable::get_str(), sym_scope::LookupFromScope(), strtable::new_item(), and sym::sym().

00053 { text = (char *)t; }


Member Data Documentation

char* STRING::text [private]
 

Definition at line 41 of file str.h.

Referenced by GetText(), SetText(), and STRING().


The documentation for this class was generated from the following file:
Generated on Wed Mar 31 21:16:09 2004 for Data Structures for a VHDL Compiler by doxygen 1.3.3