|
Bash++
Bash++ compiler internal documentation
|
A class in Bash++. More...
#include <bpp.h>


Public Member Functions | |
| bpp_class () | |
| std::weak_ptr< bpp_class > | get_containing_class () override |
| Get the class which contains this entity. | |
| bool | set_containing_class (std::weak_ptr< bpp::bpp_class > containing_class) override |
| std::shared_ptr< bpp_class > | get_class () override |
| void | set_name (const std::string &name) override |
| bool | add_method (std::shared_ptr< bpp_method > method) |
| Add a method to the class. | |
| bool | add_datamember (std::shared_ptr< bpp_datamember > datamember) |
| Add a datamember to the class. | |
| std::vector< std::shared_ptr< bpp_method > > | get_methods () const |
| std::vector< std::shared_ptr< bpp_datamember > > | get_datamembers () const |
| std::shared_ptr< bpp_method > | get_method (const std::string &name, std::shared_ptr< bpp_entity > context) |
| Get a method by name. | |
| std::shared_ptr< bpp_method > | get_method_UNSAFE (const std::string &name) |
| Get a method by name without checking the context. | |
| std::shared_ptr< bpp_datamember > | get_datamember (const std::string &name, std::shared_ptr< bpp_entity > context) |
| Get a datamember by name. | |
| std::shared_ptr< bpp_datamember > | get_datamember_UNSAFE (const std::string &name) |
| void | inherit (std::shared_ptr< bpp_class > parent) override |
| Inherit from a parent class. | |
| std::shared_ptr< bpp::bpp_class > | get_parent () |
| void | inherit (std::shared_ptr< bpp_entity > parent) |
| Inherit from a parent entity. | |
| void | inherit (std::shared_ptr< bpp_program > program) |
| virtual void | inherit (std::shared_ptr< bpp_class > parent) |
Public Member Functions inherited from bpp::bpp_entity | |
| virtual | ~bpp_entity ()=default |
| virtual bool | add_class (std::shared_ptr< bpp_class > class_) |
| Add a class to this entity's list of classes. | |
| virtual bool | add_object (std::shared_ptr< bpp_object > object, bool make_local=false) |
| Add an object to this entity's list of objects. | |
| virtual std::string | get_address () const |
| virtual std::string | get_name () const |
| virtual std::weak_ptr< bpp_program > | get_containing_program () |
| void | inherit (std::shared_ptr< bpp_entity > parent) |
| Inherit from a parent entity. | |
| void | inherit (std::shared_ptr< bpp_program > program) |
| void | set_definition_position (const std::string &file, uint64_t line, uint64_t column) |
| void | add_reference (const std::string &file, uint64_t line, uint64_t column) |
| bpp::SymbolPosition | get_initial_definition () const |
| std::list< bpp::SymbolPosition > | get_references () const |
| std::unordered_map< std::string, std::shared_ptr< bpp_class > > | get_classes () const |
| std::unordered_map< std::string, std::shared_ptr< bpp_object > > | get_objects () const |
| std::shared_ptr< bpp_class > | get_class (const std::string &name) |
| std::shared_ptr< bpp_object > | get_object (const std::string &name) |
| std::shared_ptr< bpp_class > | get_parent () const |
Private Member Functions | |
| void | remove_default_toPrimitive () |
| Remove the default toPrimitive method. | |
| void | add_default_toPrimitive () |
| Add the default toPrimitive method. | |
Private Attributes | |
| std::vector< std::shared_ptr< bpp_method > > | methods |
| std::vector< std::shared_ptr< bpp_datamember > > | datamembers |
| bool | has_custom_toPrimitive = false |
Additional Inherited Members | |
Protected Attributes inherited from bpp::bpp_entity | |
| std::string | name = "" |
| std::unordered_map< std::string, std::weak_ptr< bpp_class > > | classes |
| A map of class names to class objects within this entity. | |
| std::unordered_map< std::string, std::weak_ptr< bpp_object > > | objects |
| A map of object names to bpp_objects within this entity. | |
| std::unordered_map< std::string, std::shared_ptr< bpp_object > > | local_objects |
| Like objects, but only for objects whose scope is local to this entity. | |
| std::shared_ptr< bpp_class > | type = nullptr |
| std::weak_ptr< bpp_class > | containing_class |
| std::weak_ptr< bpp_program > | containing_program |
| std::vector< std::weak_ptr< bpp_class > > | parents |
| std::weak_ptr< bpp_method > | overridden_method |
| bpp::SymbolPosition | initial_definition |
| std::list< bpp::SymbolPosition > | references |
A class in Bash++.
| bpp::bpp_class::bpp_class | ( | ) |
| bool bpp::bpp_class::add_datamember | ( | std::shared_ptr< bpp_datamember > | datamember | ) |
Add a datamember to the class.
|
private |
Add the default toPrimitive method.
Each class has a default toPrimitive method which simply echoes the class name. This method is only added if the class does not have a custom toPrimitive method.
| bool bpp::bpp_class::add_method | ( | std::shared_ptr< bpp_method > | method | ) |
Add a method to the class.
|
overridevirtual |
Reimplemented from bpp::bpp_entity.
|
overridevirtual |
Get the class which contains this entity.
Useful in many cases, for example in the event that this entity is a method of a particular class
Reimplemented from bpp::bpp_entity.
| std::shared_ptr< bpp::bpp_datamember > bpp::bpp_class::get_datamember | ( | const std::string & | name, |
| std::shared_ptr< bpp_entity > | context | ||
| ) |
Get a datamember by name.
This function returns a datamember by name, taking into account the scope of the datamember.
If the datamember is public, it is returned.
If the datamember is private or protected, it is returned only if the context permits. Otherwise, we return bpp::inaccessible_datamember.
| name | The name of the datamember to get |
| context | The context in which the datamember is being accessed |
| std::shared_ptr< bpp::bpp_datamember > bpp::bpp_class::get_datamember_UNSAFE | ( | const std::string & | name | ) |
| std::vector< std::shared_ptr< bpp_datamember > > bpp::bpp_class::get_datamembers | ( | ) | const |
| std::shared_ptr< bpp::bpp_method > bpp::bpp_class::get_method | ( | const std::string & | name, |
| std::shared_ptr< bpp_entity > | context | ||
| ) |
Get a method by name.
This function returns a method by name, taking into account the scope of the method.
If the method is public, it is returned.
If the method is private or protected, it is returned only if the context permits. Otherwise, we return bpp::inaccessible_method.
| name | The name of the method to get |
| context | The context in which the method is being accessed |
| std::shared_ptr< bpp::bpp_method > bpp::bpp_class::get_method_UNSAFE | ( | const std::string & | name | ) |
Get a method by name without checking the context.
This function returns a method by name without checking the context.
This function is UNSAFE and should only be used when the context is known to be correct or the consequences of an incorrect context are acceptable.
| name | The name of the method to get |
| std::vector< std::shared_ptr< bpp_method > > bpp::bpp_class::get_methods | ( | ) | const |
| std::shared_ptr< bpp::bpp_class > bpp::bpp_class::get_parent | ( | ) |
|
virtual |
Reimplemented from bpp::bpp_entity.
|
overridevirtual |
Inherit from a parent class.
This function copies all methods and datamembers from the parent class into this class.
| parent | The parent class to inherit from |
Reimplemented from bpp::bpp_entity.
| void bpp::bpp_entity::inherit | ( | std::shared_ptr< bpp_entity > | parent | ) |
Inherit from a parent entity.
This function copies all classes and objects from the parent entity into this entity.
| parent | The parent entity to inherit from |
| void bpp::bpp_entity::inherit | ( | std::shared_ptr< bpp_program > | program | ) |
|
private |
Remove the default toPrimitive method.
Each class has a default toPrimitive method which simply echoes the class name. This method is only added if the class does not have a custom toPrimitive method.
|
overridevirtual |
Reimplemented from bpp::bpp_entity.
|
overridevirtual |
Reimplemented from bpp::bpp_entity.
|
private |
|
private |
|
private |