Panda3D
Public Member Functions | List of all members
DCFile Class Reference

Represents the complete list of Distributed Class descriptions as read from a .dc file. More...

Public Member Functions

 __init__ ()
 
 __init__ (const DCFile)
 
bool allObjectsValid ()
 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...
 
 clear ()
 Removes all of the classes defined within the DCFile and prepares it for reading a new file. More...
 
DCClass getClass (int n)
 Returns the nth class read from the .dc file(s). More...
 
DCClass getClassByName (str name)
 Returns the class that has the indicated name, or NULL if there is no such class. More...
 
DCField getFieldByIndex (int index_number)
 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 int getHash ()
 Returns a 32-bit hash index associated with this file. More...
 
str getImportModule (int n)
 Returns the module named by the nth import line read from the .dc file(s). More...
 
str getImportSymbol (int n, int i)
 Returns the ith symbol named by the nth import line read from the .dc file(s). More...
 
const DCKeyword getKeyword (int n)
 Returns the nth keyword read from the .dc file(s). More...
 
const DCKeyword getKeywordByName (str name)
 Returns the keyword that has the indicated name, or NULL if there is no such keyword name. More...
 
int getNumClasses ()
 Returns the number of classes read from the .dc file(s). More...
 
int getNumImportModules ()
 Returns the number of import lines read from the .dc file(s). More...
 
int getNumImportSymbols (int n)
 Returns the number of symbols explicitly imported by the nth import line. More...
 
int getNumKeywords ()
 Returns the number of keywords read from the .dc file(s). More...
 
int getNumTypedefs ()
 Returns the number of typedefs read from the .dc file(s). More...
 
DCSwitch getSwitchByName (str name)
 Returns the switch that has the indicated name, or NULL if there is no such switch. More...
 
DCTypedef getTypedef (int n)
 Returns the nth typedef read from the .dc file(s). More...
 
DCTypedef getTypedefByName (str name)
 Returns the typedef that has the indicated name, or NULL if there is no such typedef name. More...
 
bool read (Filename filename)
 Opens and reads the indicated .dc file by name. More...
 
bool read (Istream in, str filename)
 Parses the already-opened input stream for distributed class descriptions. More...
 
bool readAll ()
 This special method reads all of the .dc files named by the "dc-file" config.prc variable, and loads them into the DCFile namespace. More...
 
bool write (Filename filename, bool brief)
 Opens the indicated filename for output and writes a parseable description of all the known distributed classes to the file. More...
 
bool write (Ostream out, bool brief)
 Writes a parseable description of all the known distributed classes to the stream. More...
 

Detailed Description

Represents the complete list of Distributed Class descriptions as read from a .dc file.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( const  DCFile)

◆ allObjectsValid()

bool allObjectsValid ( )

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").

If this is true, we might have read a partial file.

◆ clear()

clear ( )

Removes all of the classes defined within the DCFile and prepares it for reading a new file.

◆ getClass()

DCClass getClass ( int  n)

Returns the nth class read from the .dc file(s).

◆ getClassByName()

DCClass getClassByName ( str  name)

Returns the class that has the indicated name, or NULL if there is no such class.

◆ getFieldByIndex()

DCField getFieldByIndex ( int  index_number)

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.

◆ getHash()

unsigned long int getHash ( )

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.

◆ getImportModule()

str getImportModule ( int  n)

Returns the module named by the nth import line read from the .dc file(s).

◆ getImportSymbol()

str getImportSymbol ( int  n,
int  i 
)

Returns the ith symbol named by the nth import line read from the .dc file(s).

◆ getKeyword()

const DCKeyword getKeyword ( int  n)

Returns the nth keyword read from the .dc file(s).

◆ getKeywordByName()

const DCKeyword getKeywordByName ( str  name)

Returns the keyword that has the indicated name, or NULL if there is no such keyword name.

◆ getNumClasses()

int getNumClasses ( )

Returns the number of classes read from the .dc file(s).

◆ getNumImportModules()

int getNumImportModules ( )

Returns the number of import lines read from the .dc file(s).

◆ getNumImportSymbols()

int getNumImportSymbols ( int  n)

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 ... ".

◆ getNumKeywords()

int getNumKeywords ( )

Returns the number of keywords read from the .dc file(s).

◆ getNumTypedefs()

int getNumTypedefs ( )

Returns the number of typedefs read from the .dc file(s).

◆ getSwitchByName()

DCSwitch getSwitchByName ( str  name)

Returns the switch that has the indicated name, or NULL if there is no such switch.

◆ getTypedef()

DCTypedef getTypedef ( int  n)

Returns the nth typedef read from the .dc file(s).

◆ getTypedefByName()

DCTypedef getTypedefByName ( str  name)

Returns the typedef that has the indicated name, or NULL if there is no such typedef name.

◆ read() [1/2]

bool 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).

◆ read() [2/2]

bool read ( Istream  in,
str  filename 
)

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).

◆ readAll()

bool readAll ( )

This special method reads all of the .dc files named by the "dc-file" config.prc variable, and loads them into the DCFile namespace.

◆ write() [1/2]

bool write ( Filename  filename,
bool  brief 
)

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.

◆ write() [2/2]

bool write ( Ostream  out,
bool  brief 
)

Writes a parseable description of all the known distributed classes to the stream.

Returns true if the description is successfully written, false otherwise.