Represents the complete list of Distributed Class descriptions as read from a .dc file. More...
#include "dcFile.h"
Public Member Functions | |
bool | add_class (DCClass *dclass) |
Adds the newly-allocated distributed class definition to the file. More... | |
void | add_import_module (const std::string &import_module) |
Adds a new name to the list of names of Python modules that are to be imported by the client or AI to define the code that is associated with the class interfaces named within the .dc file. More... | |
void | add_import_symbol (const std::string &import_symbol) |
Adds a new name to the list of symbols that are to be explicitly imported from the most-recently added module, e.g. More... | |
bool | add_keyword (const std::string &name) |
Adds the indicated keyword string to the list of keywords known to the DCFile. More... | |
bool | add_switch (DCSwitch *dswitch) |
Adds the newly-allocated switch definition to the file. More... | |
void | add_thing_to_delete (DCDeclaration *decl) |
Adds the indicated declaration to the list of declarations that are not reported with the file, but will be deleted when the DCFile object destructs. More... | |
bool | add_typedef (DCTypedef *dtypedef) |
Adds the newly-allocated distributed typedef definition to the file. More... | |
bool | all_objects_valid () const |
Returns true if all of the classes read from the DC file were defined and valid, or false if any of them were undefined ("bogus classes"). More... | |
void | check_inherited_fields () |
Rebuilds all of the inherited fields tables, if necessary. More... | |
void | clear () |
Removes all of the classes defined within the DCFile and prepares it for reading a new file. More... | |
void | generate_hash (HashGenerator &hashgen) const |
Accumulates the properties of this file into the hash. More... | |
DCClass * | get_class (int n) const |
Returns the nth class read from the .dc file(s). More... | |
DCClass * | get_class_by_name (const std::string &name) const |
Returns the class that has the indicated name, or NULL if there is no such class. More... | |
DCField * | get_field_by_index (int index_number) const |
Returns a pointer to the one DCField that has the indicated index number, of all the DCFields across all classes in the file. More... | |
unsigned long | get_hash () const |
Returns a 32-bit hash index associated with this file. More... | |
std::string | get_import_module (int n) const |
Returns the module named by the nth import line read from the .dc file(s). More... | |
std::string | get_import_symbol (int n, int i) const |
Returns the ith symbol named by the nth import line read from the .dc file(s). More... | |
const DCKeyword * | get_keyword (int n) const |
Returns the nth keyword read from the .dc file(s). More... | |
const DCKeyword * | get_keyword_by_name (const std::string &name) const |
Returns the keyword that has the indicated name, or NULL if there is no such keyword name. More... | |
int | get_num_classes () const |
Returns the number of classes read from the .dc file(s). More... | |
int | get_num_import_modules () const |
Returns the number of import lines read from the .dc file(s). More... | |
int | get_num_import_symbols (int n) const |
Returns the number of symbols explicitly imported by the nth import line. More... | |
int | get_num_keywords () const |
Returns the number of keywords read from the .dc file(s). More... | |
int | get_num_typedefs () const |
Returns the number of typedefs read from the .dc file(s). More... | |
DCSwitch * | get_switch_by_name (const std::string &name) const |
Returns the switch that has the indicated name, or NULL if there is no such switch. More... | |
DCTypedef * | get_typedef (int n) const |
Returns the nth typedef read from the .dc file(s). More... | |
DCTypedef * | get_typedef_by_name (const std::string &name) const |
Returns the typedef that has the indicated name, or NULL if there is no such typedef name. More... | |
void | mark_inherited_fields_stale () |
Indicates that something has changed in one or more of the inheritance chains or the set of fields; the next time check_inherited_fields() is called, the inherited fields tables of all classes will be rebuilt. More... | |
bool | read (Filename filename) |
Opens and reads the indicated .dc file by name. More... | |
bool | read (std::istream &in, const std::string &filename=std::string()) |
Parses the already-opened input stream for distributed class descriptions. More... | |
void | set_new_index_number (DCField *field) |
Sets the next sequential available index number on the indicated field. More... | |
bool | write (Filename filename, bool brief) const |
Opens the indicated filename for output and writes a parseable description of all the known distributed classes to the file. More... | |
bool | write (std::ostream &out, bool brief) const |
Writes a parseable description of all the known distributed classes to the stream. More... | |
Represents the complete list of Distributed Class descriptions as read from a .dc file.
bool DCFile::add_class | ( | DCClass * | dclass | ) |
Adds the newly-allocated distributed class definition to the file.
The DCFile becomes the owner of the pointer and will delete it when it destructs. Returns true if the class is successfully added, or false if there was a name conflict.
Definition at line 453 of file dcFile.cxx.
References DCClass::get_name(), get_num_classes(), DCClass::is_bogus_class(), DCClass::is_struct(), and DCClass::set_number().
void DCFile::add_import_module | ( | const std::string & | import_module | ) |
Adds a new name to the list of names of Python modules that are to be imported by the client or AI to define the code that is associated with the class interfaces named within the .dc file.
Definition at line 509 of file dcFile.cxx.
void DCFile::add_import_symbol | ( | const std::string & | import_symbol | ) |
Adds a new name to the list of symbols that are to be explicitly imported from the most-recently added module, e.g.
"from module_name import symbol". If the list of symbols is empty, the syntax is taken to be "import module_name".
Definition at line 522 of file dcFile.cxx.
bool DCFile::add_keyword | ( | const std::string & | name | ) |
Adds the indicated keyword string to the list of keywords known to the DCFile.
These keywords may then be added to DCFields. It is not an error to add a particular keyword more than once.
Definition at line 564 of file dcFile.cxx.
References DCKeywordList::add_keyword().
bool DCFile::add_switch | ( | DCSwitch * | dswitch | ) |
Adds the newly-allocated switch definition to the file.
The DCFile becomes the owner of the pointer and will delete it when it destructs. Returns true if the switch is successfully added, or false if there was a name conflict.
Definition at line 488 of file dcFile.cxx.
References DCSwitch::get_name().
void DCFile::add_thing_to_delete | ( | DCDeclaration * | decl | ) |
Adds the indicated declaration to the list of declarations that are not reported with the file, but will be deleted when the DCFile object destructs.
That is, transfers ownership of the indicated pointer to the DCFile.
Definition at line 584 of file dcFile.cxx.
bool DCFile::add_typedef | ( | DCTypedef * | dtypedef | ) |
Adds the newly-allocated distributed typedef definition to the file.
The DCFile becomes the owner of the pointer and will delete it when it destructs. Returns true if the typedef is successfully added, or false if there was a name conflict.
Definition at line 534 of file dcFile.cxx.
References DCTypedef::get_name(), get_num_typedefs(), DCTypedef::is_bogus_typedef(), DCTypedef::is_implicit_typedef(), and DCTypedef::set_number().
|
inline |
|
inline |
void DCFile::clear | ( | ) |
Removes all of the classes defined within the DCFile and prepares it for reading a new file.
Definition at line 59 of file dcFile.cxx.
References DCKeywordList::clear_keywords().
void DCFile::generate_hash | ( | HashGenerator & | hashgen | ) | const |
Accumulates the properties of this file into the hash.
Definition at line 429 of file dcFile.cxx.
Referenced by get_hash().
DCClass * DCFile::get_class | ( | int | n | ) | const |
Returns the nth class read from the .dc file(s).
Definition at line 252 of file dcFile.cxx.
DCClass * DCFile::get_class_by_name | ( | const std::string & | name | ) | const |
Returns the class that has the indicated name, or NULL if there is no such class.
Definition at line 262 of file dcFile.cxx.
DCField * DCFile::get_field_by_index | ( | int | index_number | ) | const |
Returns a pointer to the one DCField that has the indicated index number, of all the DCFields across all classes in the file.
This method is only valid if dc-multiple-inheritance is set true in the Config.prc file. Without this setting, different DCFields may share the same index number, so this global lookup is not possible.
Definition at line 296 of file dcFile.cxx.
unsigned long DCFile::get_hash | ( | ) | const |
Returns a 32-bit hash index associated with this file.
This number is guaranteed to be consistent if the contents of the file have not changed, and it is very likely to be different if the contents of the file do change.
Definition at line 419 of file dcFile.cxx.
References generate_hash(), and HashGenerator::get_hash().
string DCFile::get_import_module | ( | int | n | ) | const |
Returns the module named by the nth import line read from the .dc file(s).
Definition at line 318 of file dcFile.cxx.
string DCFile::get_import_symbol | ( | int | n, |
int | i | ||
) | const |
Returns the ith symbol named by the nth import line read from the .dc file(s).
Definition at line 339 of file dcFile.cxx.
const DCKeyword * DCFile::get_keyword | ( | int | n | ) | const |
Returns the nth keyword read from the .dc file(s).
Definition at line 389 of file dcFile.cxx.
References DCKeywordList::get_keyword().
const DCKeyword * DCFile::get_keyword_by_name | ( | const std::string & | name | ) | const |
Returns the keyword that has the indicated name, or NULL if there is no such keyword name.
Definition at line 398 of file dcFile.cxx.
References DCKeywordList::get_keyword_by_name().
int DCFile::get_num_classes | ( | ) | const |
Returns the number of classes read from the .dc file(s).
Definition at line 244 of file dcFile.cxx.
Referenced by add_class().
int DCFile::get_num_import_modules | ( | ) | const |
Returns the number of import lines read from the .dc file(s).
Definition at line 310 of file dcFile.cxx.
int DCFile::get_num_import_symbols | ( | int | n | ) | const |
Returns the number of symbols explicitly imported by the nth import line.
If this is 0, the line is "import modulename"; if it is more than 0, the line is "from modulename import symbol, symbol ... ".
Definition at line 329 of file dcFile.cxx.
int DCFile::get_num_keywords | ( | ) | const |
Returns the number of keywords read from the .dc file(s).
Definition at line 381 of file dcFile.cxx.
References DCKeywordList::get_num_keywords().
int DCFile::get_num_typedefs | ( | ) | const |
Returns the number of typedefs read from the .dc file(s).
Definition at line 349 of file dcFile.cxx.
Referenced by add_typedef().
DCSwitch * DCFile::get_switch_by_name | ( | const std::string & | name | ) | const |
Returns the switch that has the indicated name, or NULL if there is no such switch.
Definition at line 277 of file dcFile.cxx.
DCTypedef * DCFile::get_typedef | ( | int | n | ) | const |
Returns the nth typedef read from the .dc file(s).
Definition at line 357 of file dcFile.cxx.
DCTypedef * DCFile::get_typedef_by_name | ( | const std::string & | name | ) | const |
Returns the typedef that has the indicated name, or NULL if there is no such typedef name.
Definition at line 367 of file dcFile.cxx.
|
inline |
Indicates that something has changed in one or more of the inheritance chains or the set of fields; the next time check_inherited_fields() is called, the inherited fields tables of all classes will be rebuilt.
Definition at line 40 of file dcFile.I.
Referenced by DCClass::add_parent(), and DCField::set_name().
bool DCFile::read | ( | Filename | filename | ) |
Opens and reads the indicated .dc file by name.
The distributed classes defined in the file will be appended to the set of distributed classes already recorded, if any.
Returns true if the file is successfully read, false if there was an error (in which case the file might have been partially read).
Definition at line 124 of file dcFile.cxx.
References Filename::set_text().
bool DCFile::read | ( | std::istream & | in, |
const std::string & | filename = std::string() |
||
) |
Parses the already-opened input stream for distributed class descriptions.
The filename parameter is optional and is only used when reporting errors.
The distributed classes defined in the file will be appended to the set of distributed classes already recorded, if any.
Returns true if the file is successfully read, false if there was an error (in which case the file might have been partially read).
Definition at line 169 of file dcFile.cxx.
void DCFile::set_new_index_number | ( | DCField * | field | ) |
Sets the next sequential available index number on the indicated field.
This is only meant to be called
Definition at line 593 of file dcFile.cxx.
References DCField::set_number().
bool DCFile::write | ( | Filename | filename, |
bool | brief | ||
) | const |
Opens the indicated filename for output and writes a parseable description of all the known distributed classes to the file.
Returns true if the description is successfully written, false otherwise.
Definition at line 185 of file dcFile.cxx.
References Filename::open_write(), and Filename::set_text().
bool DCFile::write | ( | std::ostream & | out, |
bool | brief | ||
) | const |
Writes a parseable description of all the known distributed classes to the stream.
Returns true if the description is successfully written, false otherwise.
Definition at line 209 of file dcFile.cxx.