|
forb
|
Represents a module, which basically is a namespace, so it's a collection of other entities, which can be either other modules, custom types or interfaces. More...
#include <module.hpp>
Public Member Functions | |
| module () | |
| Empty module, used to preallocate variables in arrays or to use later assignment operator. More... | |
| module (const std::shared_ptr< entity > &parent, const std::string &name) | |
| Using constructor from superclass. | |
| ~module () override=default | |
| This class is virtual, so it requires a virtual destructor. | |
| module (module &&)=default | |
| This class supports moving. | |
| module & | operator= (module &&)=default |
| This class supports moving. | |
| module (const module &)=default | |
| This class supports copying. | |
| module & | operator= (const module &)=default |
| This class supports copying. | |
| void | print_declaration (code_ostream &out) const override |
| Prints module declaration (should be called within a header file) | |
| void | print_definition (code_ostream &out) const override |
| Prints module definition (should be called within a source file) | |
| std::shared_ptr< module > | get_module (const std::string &name) |
| Returns a pointer to a module identified by name, but only if said module is defined directly within current module, nullptr otherwise. More... | |
| std::shared_ptr< module > | find_module (const std::string &name) |
| Finds a module by its name (which may contain :: qualifiers), following C++ scope resolution and visibility rules. More... | |
| std::shared_ptr< type_struct > | find_struct (const std::string &name) |
| Finds a custom structure type by its name (which may contain :: qualifiers), following C++ scope resolution and visibility rules. More... | |
Public Member Functions inherited from forbcc::entity | |
| entity () | |
| Constructs an empty entity, used to preallocate entity variables (like in arrays) and to later use the assignment operator to overwrite its content. | |
| entity (const std::shared_ptr< entity > &parent, const std::string &name) | |
| Constructs an entity within a given parent. | |
| virtual | ~entity ()=default |
| Does nothing because the destructor of the shared_ptr handles all the stuff It's necessary for the destructor to be virtual because share_ptrs to subclasses shall be able to correctly destruct objects of the subclasses. More... | |
| entity (entity &&)=default | |
| This class supports moving. | |
| entity & | operator= (entity &&)=default |
| This class supports moving. | |
| entity (const entity &)=default | |
| This class supports copying. | |
| entity & | operator= (const entity &)=default |
| This class supports copying. | |
| std::shared_ptr< entity > | parent () const |
| Returns the parent of the given entity. | |
| std::string | name () const |
| Returns the name of the given entity. | |
| virtual std::string | codename () const |
| Returns the codename of the given entity, which is the name of the entity as seen from the global scope. More... | |
Public Member Functions inherited from forbcc::ordered_unique_list< std::shared_ptr< entity > > | |
| virtual bool | insert (std::string key, const std::shared_ptr< entity > &value) |
| Inserts a new value within the list if the corrisponding key is not present. More... | |
| const list_t & | list () const |
| Returns a const reference to the list of the elements. | |
| bool | contains (std::string key) const |
| Returns true if the given key is present within the set of keys. | |
| std::shared_ptr< entity > & | operator[] (std::string key) |
| Returns a reference to an element from its key. More... | |
| const_T & | operator[] (std::string key) const |
| Same as operator[](std::string), but returns a const_T instead, when used on a const reference to the list object. More... | |
Static Public Attributes | |
| static const std::shared_ptr< module > | global_module = forbcc::module::new_ptr() |
| Static member representing the global namespace, used as base for the tree-like structure of entities. More... | |
Additional Inherited Members | |
Public Types inherited from forbcc::shareable< module > | |
| using | const_T = typename std::add_const< module >::type |
| Alias to the same type T, but with const qualifier. | |
| using | ptr_t = std::shared_ptr< module > |
| Alias to std::shared_ptr<T> | |
| using | ptr_const_t = std::shared_ptr< const_T > |
| Alias to std::shared_ptr<const T> | |
Public Types inherited from forbcc::ordered_unique_list< std::shared_ptr< entity > > | |
| using | set_t = std::map< std::string, int > |
| The type of the set of keys, used to access the list. | |
| using | list_t = std::vector< std::shared_ptr< entity > > |
| The type of the list. | |
| using | const_T = typename std::add_const< std::shared_ptr< entity > >::type |
| Alias of the const version of the template type T. | |
Static Public Member Functions inherited from forbcc::shareable< module > | |
| static ptr_t | new_ptr (Args &&... args) |
| Calls the constructor of the class with the given arguments to create a shared_pointer to T. More... | |
| static ptr_const_t | new_ptr_const (Args &&... args) |
| Calls the constructor of the class with the given arguments to create a shared_pointer to a const T. More... | |
Represents a module, which basically is a namespace, so it's a collection of other entities, which can be either other modules, custom types or interfaces.
|
inline |
Empty module, used to preallocate variables in arrays or to use later assignment operator.
It is also the constructor used to allocate the global_module.
| std::shared_ptr< forbcc::module > forbcc::module::find_module | ( | const std::string & | name | ) |
Finds a module by its name (which may contain :: qualifiers), following C++ scope resolution and visibility rules.
The name may be the simple name of a module declared within this module or it may be the name of a module visible from this module (an ancestor of this module). Returns a pointer to the requested module if it exists, nullptr otherwise.
| std::shared_ptr< forbcc::type_struct > forbcc::module::find_struct | ( | const std::string & | name | ) |
Finds a custom structure type by its name (which may contain :: qualifiers), following C++ scope resolution and visibility rules.
The name may be the simple name of a structure declared within this module or it may be the name of a structure visible from this module (defined in an upper module). Returns a pointer to the requested module if it exists, nullptr otherwise.
| std::shared_ptr< forbcc::module > forbcc::module::get_module | ( | const std::string & | name | ) |
Returns a pointer to a module identified by name, but only if said module is defined directly within current module, nullptr otherwise.
|
static |
Static member representing the global namespace, used as base for the tree-like structure of entities.
The global module has no parent module of course.
1.8.12