Modules | Files | Inheritance Tree | Inheritance Graph | Name Index | Config
package Synopsis::Parser::C++
class Dictionary
Files: Synopsis/Parser/C++/syn/dict.hh
Dictionary-inheritance Scopes/Synopsis/Parser/C++/FakeGC/cleanup.html

Dictionary of named declarations with lookup. This class maintains a dictionary of names, which index types, supposedly declared in the scope that has this dictionary. There may be only one declaration per name, except in the case of function names.


Public Typedefs Summary:
std::vector<Types::Named*>Type_vector
The type of multiple entries. [Source]

Public Structs Summary:
MultipleError
Exception thrown when multiple declarations are found when one is expected. [Source]
KeyError
Exception thrown when a name is not found in lookup*() [Source]

Public Member functions Summary:
 constructorDictionary()
Constructor [Source]
 destructor~Dictionary()
Destructor [Source]
 boolhas_key(const std::string& name)
Returns true if name is in dict [Source]
 Types::Named*lookup(const std::string& name)
Lookup a name in the dictionary. [Source]
 Type_vectorlookupMultiple(const std::string& name)
Lookup a name in the dictionary expecting multiple decls. [Source]
 voidinsert(AST::Declaration* decl)
Add a declaration to the dictionary. [Source]
 voidinsert(Types::Named* named)
Add a named type to the dictionary. [Source]
 voiddump()
Dump the contents for debugging [Source]

Private Data members Summary:
Data*m
The private data. [Source]

Structs Summary:
Data
Define nested class [Source]

Public Data members Inherited from FakeGC::cleanup
cleanup_next

Public Typedef Details:
std::vector<Types::Named*> Type_vector

The type of multiple entries. We don't want to include type.hh just for this, so this is a workaround


Public Member function Details:
 Types::Named* lookup(const std::string& name)

Lookup a name in the dictionary. If more than one declaration has this name then an exception is thrown.


 Type_vector lookupMultiple(const std::string& name)

Lookup a name in the dictionary expecting multiple decls. Use this method if you expect to find more than one declaration, eg importing names via a using statement.


 void insert(AST::Declaration* decl)

Add a declaration to the dictionary. The name() is extracted from the declaration and its last string used as the key. The declaration is stored as a Type::Declared which is created inside this method.


 void insert(Types::Named* named)

Add a named type to the dictionary. The name() is extracted from the type and its last string used as they key.


Private Data member Details:
Data* m

The private data. This is a forward declared * to speed compilation since std::map is a large template.