Gyoji Compiler
|
Set of types extracted from a translation unit. More...
#include <types.hpp>
Public Member Functions | |
Types () | |
Creates a new types table with only the primitive types defined. | |
~Types () | |
Move along, nothing to see here. | |
Type * | get_type (std::string type) const |
const Type * | get_pointer_to (const Type *_type, const Gyoji::context::SourceReference &src_ref) |
const Type * | get_reference_to (const Type *_type, const Gyoji::context::SourceReference &src_ref) |
const Type * | get_array_of (const Type *_type, size_t _length, const Gyoji::context::SourceReference &src_ref) |
void | define_type (Gyoji::owned< Type > type) |
void | dump (FILE *out) const |
const std::map< std::string, Gyoji::owned< Type > > & | get_types () const |
Set of types extracted from a translation unit.
This class represents a type extracted from the source translation unit. Types may be primitive or composite structures containing other types.
Types::Types | ( | ) |
Creates a new types table with only the primitive types defined.
This constructs a new table of types and defined the primitive types of the type system inside it. Composite and user-defined types may also be added after construction.
Types::~Types | ( | ) |
Move along, nothing to see here.
Move along, nothing to see here.
void Types::define_type | ( | Gyoji::owned< Type > | type | ) |
This is used to define a fully-qualified type from the definition. Note that some types may be incompletely specified when they are initially declared and a final resolution step may be required in order to ensure that the type is fully specified.
void Types::dump | ( | FILE * | out | ) | const |
This is used for debugging purposes to dump the content of the type database.
const Type * Types::get_array_of | ( | const Type * | _type, |
size_t | _length, | ||
const Gyoji::context::SourceReference & | src_ref | ||
) |
This returns a type that is an array of _length instances of the given type. The type returned may be a new type and if so, it is inserted into the table of types. If the pointer type already exists, then a pointer to the already existing immutable type will be returned.
const Type * Types::get_pointer_to | ( | const Type * | _type, |
const Gyoji::context::SourceReference & | src_ref | ||
) |
This returns a type that is a pointer to the given type. The type returned may be a new type and if so, it is inserted into the table of types. If the pointer type already exists, then a pointer to the already existing immutable type will be returned.
const Type * Types::get_reference_to | ( | const Type * | _type, |
const Gyoji::context::SourceReference & | src_ref | ||
) |
This returns a type that is a reference to the given type. The type returned may be a new type and if so, it is inserted into the table of types. If the pointer type already exists, then a pointer to the already existing immutable type will be returned.
Type * Types::get_type | ( | std::string | type | ) | const |
This returns the fully resolved type from the fully-qualified name of the type. By fully-qualified, we mean a namespace path beginning with the root namespace and identifying a specific type.
const std::map< std::string, Gyoji::owned< Type > > & Types::get_types | ( | ) | const |
This is used to provide direct (immutable) access to the types table.