32class EXPCL_DIRECT_DCPARSER DCFile {
44 bool read(std::istream &in,
const std::string &filename = std::string());
47 bool write(std::ostream &out,
bool brief)
const;
88 void setup_default_keywords();
89 void rebuild_inherited_fields();
91 typedef pvector<DCClass *> Classes;
94 typedef pmap<std::string, DCDeclaration *> ThingsByName;
95 ThingsByName _things_by_name;
97 typedef pvector<std::string> ImportSymbols;
101 ImportSymbols _symbols;
104 typedef pvector<Import> Imports;
107 typedef pvector<DCTypedef *> Typedefs;
110 typedef pmap<std::string, DCTypedef *> TypedefsByName;
111 TypedefsByName _typedefs_by_name;
116 typedef pvector<DCDeclaration *> Declarations;
117 Declarations _declarations;
118 Declarations _things_to_delete;
120 typedef pvector<DCField *> FieldsByIndex;
121 FieldsByIndex _fields_by_index;
123 bool _all_objects_valid;
124 bool _inherited_fields_stale;
Defines a particular DistributedClass as read from an input .dc file.
This is a common interface for a declaration in a DC file.
A single field of a Distributed Class, either atomic or molecular.
bool add_class(DCClass *dclass)
Adds the newly-allocated distributed class definition to the file.
bool add_switch(DCSwitch *dswitch)
Adds the newly-allocated switch definition to the file.
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.
unsigned long get_hash() const
Returns a 32-bit hash index associated with this file.
std::string get_import_module(int n) const
Returns the module named by the nth import line read from the .dc file(s).
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 t...
int get_num_typedefs() const
Returns the number of typedefs read from the .dc file(s).
void mark_inherited_fields_stale()
Indicates that something has changed in one or more of the inheritance chains or the set of fields; t...
const DCKeyword * get_keyword(int n) const
Returns the nth keyword read from the .dc file(s).
void add_thing_to_delete(DCDeclaration *decl)
Adds the indicated declaration to the list of declarations that are not reported with the file,...
void set_new_index_number(DCField *field)
Sets the next sequential available index number on the indicated field.
DCTypedef * get_typedef(int n) const
Returns the nth typedef read from the .dc file(s).
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.
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 ...
int get_num_import_symbols(int n) const
Returns the number of symbols explicitly imported by the nth import line.
int get_num_classes() const
Returns the number of classes read from the .dc file(s).
int get_num_import_modules() const
Returns the number of import lines read from the .dc file(s).
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...
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.
void check_inherited_fields()
Rebuilds all of the inherited fields tables, if necessary.
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 adde...
bool add_keyword(const std::string &name)
Adds the indicated keyword string to the list of keywords known to the DCFile.
bool write(Filename filename, bool brief) const
Opens the indicated filename for output and writes a parseable description of all the known distribut...
bool read(Filename filename)
Opens and reads the indicated .dc file by name.
DCClass * get_class(int n) const
Returns the nth class read from the .dc file(s).
int get_num_keywords() const
Returns the number of keywords read from the .dc file(s).
bool add_typedef(DCTypedef *dtypedef)
Adds the newly-allocated distributed typedef definition to the file.
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.
void clear()
Removes all of the classes defined within the DCFile and prepares it for reading a new file.
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).
void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this file into the hash.
This is a list of keywords (see DCKeyword) that may be set on a particular field.
This represents a single keyword declaration in the dc file.
This represents a switch statement, which can appear inside a class body and represents two or more a...
This represents a single typedef declaration in the dc file.
The name of a file, such as a texture file or an Egg file.
This class generates an arbitrary hash number from a sequence of ints.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.