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

This represents a single typedef declaration in the dc file. More...

#include "dcTypedef.h"

Inheritance diagram for DCTypedef:
DCDeclaration

Public Member Functions

 DCTypedef (DCParameter *parameter, bool implicit=false)
 The DCTypedef object becomes the owner of the supplied parameter pointer and will delete it upon destruction. More...
 
 DCTypedef (const string &name)
 Creates a bogus typedef reference. More...
 
string get_description () const
 Returns a brief decription of the typedef, useful for human consumption. More...
 
const string & get_name () const
 Returns the name of this typedef. More...
 
int get_number () const
 Returns a unique index number associated with this typedef definition. More...
 
bool is_bogus_typedef () const
 Returns true if the typedef has been flagged as a bogus typedef. More...
 
bool is_implicit_typedef () const
 Returns true if the typedef has been flagged as an implicit typedef, meaning it was created for a DCClass that was referenced inline as a type. More...
 
DCParametermake_new_parameter () const
 Returns a newly-allocated DCParameter object that uses the same type as that named by the typedef. More...
 
virtual void output (ostream &out, bool brief) const
 Write a string representation of this instance to <out>. More...
 
void set_number (int number)
 Assigns the unique number to this typedef. More...
 
virtual void write (ostream &out, bool brief, int indent_level) const
 
- Public Member Functions inherited from DCDeclaration
virtual DCClassas_class ()
 
virtual const DCClassas_class () const
 
virtual DCSwitchas_switch ()
 
virtual const DCSwitchas_switch () const
 
virtual void output (ostream &out) const
 Write a string representation of this instance to <out>. More...
 
void write (ostream &out, int indent_level) const
 Write a string representation of this instance to <out>. More...
 

Detailed Description

This represents a single typedef declaration in the dc file.

It assigns a particular type to a new name, just like a C typedef.

Definition at line 29 of file dcTypedef.h.

Constructor & Destructor Documentation

◆ DCTypedef() [1/2]

DCTypedef::DCTypedef ( DCParameter parameter,
bool  implicit = false 
)

The DCTypedef object becomes the owner of the supplied parameter pointer and will delete it upon destruction.

Definition at line 28 of file dcTypedef.cxx.

◆ DCTypedef() [2/2]

DCTypedef::DCTypedef ( const string &  name)

Creates a bogus typedef reference.

Definition at line 42 of file dcTypedef.cxx.

References get_number(), and DCField::set_name().

Member Function Documentation

◆ get_description()

string DCTypedef::get_description ( ) const

Returns a brief decription of the typedef, useful for human consumption.

Definition at line 90 of file dcTypedef.cxx.

References is_bogus_typedef().

Referenced by get_name().

◆ get_name()

const string & DCTypedef::get_name ( ) const

Returns the name of this typedef.

Definition at line 79 of file dcTypedef.cxx.

References get_description(), and DCPackerInterface::get_name().

Referenced by DCFile::add_typedef(), and get_number().

◆ get_number()

int DCTypedef::get_number ( ) const

Returns a unique index number associated with this typedef definition.

This is defined implicitly when the .dc file(s) are read.

Definition at line 69 of file dcTypedef.cxx.

References get_name().

Referenced by DCTypedef().

◆ is_bogus_typedef()

bool DCTypedef::is_bogus_typedef ( ) const

Returns true if the typedef has been flagged as a bogus typedef.

This is set for typedefs that are generated by the parser as placeholder for missing typedefs, as when reading a partial file; it should not occur in a normal valid dc file.

Definition at line 106 of file dcTypedef.cxx.

References is_implicit_typedef().

Referenced by DCFile::add_typedef(), and get_description().

◆ is_implicit_typedef()

bool DCTypedef::is_implicit_typedef ( ) const

Returns true if the typedef has been flagged as an implicit typedef, meaning it was created for a DCClass that was referenced inline as a type.

Definition at line 118 of file dcTypedef.cxx.

References make_new_parameter().

Referenced by DCFile::add_typedef(), and is_bogus_typedef().

◆ make_new_parameter()

DCParameter * DCTypedef::make_new_parameter ( ) const

Returns a newly-allocated DCParameter object that uses the same type as that named by the typedef.

Definition at line 129 of file dcTypedef.cxx.

References DCField::set_name(), set_number(), and DCParameter::set_typedef().

Referenced by is_implicit_typedef().

◆ output()

void DCTypedef::output ( ostream &  out,
bool  brief 
) const
virtual

Write a string representation of this instance to <out>.

Implements DCDeclaration.

Definition at line 155 of file dcTypedef.cxx.

Referenced by set_number().

◆ set_number()

void DCTypedef::set_number ( int  number)

Assigns the unique number to this typedef.

This is normally called only by the DCFile interface as the typedef is added.

Definition at line 144 of file dcTypedef.cxx.

References output().

Referenced by DCFile::add_typedef(), and make_new_parameter().


The documentation for this class was generated from the following files: