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


Public Member Functions | |
| 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. | |
| const std::vector< std::shared_ptr< bpp_method > > & | get_methods () const |
| 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 () |
| std::vector< std::shared_ptr< bpp_class > > | get_all_known_classes () const override |
| 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 | |
| bpp_entity ()=default | |
| virtual | ~bpp_entity ()=default |
| bpp_entity (const bpp_entity &other)=default | |
| bpp_entity & | operator= (const bpp_entity &other)=default |
| bpp_entity (bpp_entity &&other) noexcept=default | |
| bpp_entity & | operator= (bpp_entity &&other) noexcept=default |
| 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 |
| virtual std::shared_ptr< bpp_class > | get_class (const std::string &name, size_t max_visible_index=SIZE_MAX) |
| std::shared_ptr< bpp_object > | get_object (const std::string &name, size_t max_visible_index=SIZE_MAX) |
| virtual std::vector< std::shared_ptr< bpp_object > > | get_all_known_objects () const |
| const OwnedEntityList< bpp_object > & | get_local_objects () const |
| std::shared_ptr< bpp_class > | get_parent () const |
| size_t | number_of_known_objects () const |
| virtual size_t | number_of_known_classes () 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 |
| OwnedEntityList< bpp_object > | local_objects |
| size_t | parent_visible_object_count_at_creation = 0 |
| size_t | program_visible_class_count_at_creation = 0 |
| std::weak_ptr< bpp_class > | type |
| std::weak_ptr< bpp_class > | containing_class |
| std::weak_ptr< bpp_program > | containing_program |
| std::vector< std::weak_ptr< bpp_class > > | parents |
| For classes: the list of parent classes, in order. | |
| std::weak_ptr< bpp_entity > | parent_entity |
| For all entities (except program), the parent entity from which this entity inherits. | |
| std::weak_ptr< bpp_method > | overridden_method |
| bpp::SymbolPosition | initial_definition |
| std::list< bpp::SymbolPosition > | references |
A class in Bash++.
| 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 |
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 | ) |
| const 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 |
| const 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.
| 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 |