Bash++
Bash++ compiler internal documentation
Public Member Functions | Protected Attributes | List of all members
bpp::bpp_entity Class Reference

The base class for all entities in the Bash++ compiler. More...

#include <bpp.h>

Inheritance diagram for bpp::bpp_entity:
Inheritance graph
[legend]
Collaboration diagram for bpp::bpp_entity:
Collaboration graph
[legend]

Public Member Functions

 bpp_entity ()=default
 
virtual ~bpp_entity ()=default
 
 bpp_entity (const bpp_entity &other)=default
 
bpp_entityoperator= (const bpp_entity &other)=default
 
 bpp_entity (bpp_entity &&other) noexcept=default
 
bpp_entityoperator= (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::shared_ptr< bpp_classget_class ()
 
virtual std::string get_address () const
 
virtual void set_name (const std::string &name)
 
virtual std::string get_name () const
 
virtual std::weak_ptr< bpp::bpp_classget_containing_class ()
 Get the class which contains this entity.
 
virtual std::weak_ptr< bpp_programget_containing_program ()
 
virtual bool set_containing_class (std::weak_ptr< bpp::bpp_class > containing_class)
 
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)
 
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::SymbolPositionget_references () const
 
virtual std::shared_ptr< bpp_classget_class (const std::string &name, size_t max_visible_index=SIZE_MAX)
 
std::shared_ptr< bpp_objectget_object (const std::string &name, size_t max_visible_index=SIZE_MAX)
 
virtual const OwnedEntityList< bpp_class > & get_classes () const
 
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_classget_parent () const
 
size_t number_of_known_objects () const
 
virtual size_t number_of_known_classes () const
 

Protected Attributes

std::string name
 
OwnedEntityList< bpp_objectlocal_objects
 
size_t parent_visible_object_count_at_creation = 0
 
size_t program_visible_class_count_at_creation = 0
 
std::weak_ptr< bpp_classtype
 
std::weak_ptr< bpp_classcontaining_class
 
std::weak_ptr< bpp_programcontaining_program
 
std::vector< std::weak_ptr< bpp_class > > parents
 For classes: the list of parent classes, in order.
 
std::weak_ptr< bpp_entityparent_entity
 For all entities (except program), the parent entity from which this entity inherits.
 
std::weak_ptr< bpp_methodoverridden_method
 
bpp::SymbolPosition initial_definition
 
std::list< bpp::SymbolPositionreferences
 

Detailed Description

The base class for all entities in the Bash++ compiler.

An entity is a class, object, method, or other construct in the Bash++ compiler. This class provides the basic functionality for all entities.

Constructor & Destructor Documentation

◆ bpp_entity() [1/3]

bpp::bpp_entity::bpp_entity ( )
default

◆ ~bpp_entity()

virtual bpp::bpp_entity::~bpp_entity ( )
virtualdefault

◆ bpp_entity() [2/3]

bpp::bpp_entity::bpp_entity ( const bpp_entity other)
default

◆ bpp_entity() [3/3]

bpp::bpp_entity::bpp_entity ( bpp_entity &&  other)
defaultnoexcept

Member Function Documentation

◆ add_object()

bool bpp::bpp_entity::add_object ( std::shared_ptr< bpp_object object,
bool  make_local = false 
)
virtual

Add an object to this entity's list of objects.

Parameters
objectThe object to add
Returns
true if the object was added, false if the object already exists

Reimplemented in bpp::bpp_method, and bpp::bpp_code_entity.

◆ add_reference()

void bpp::bpp_entity::add_reference ( const std::string &  file,
uint64_t  line,
uint64_t  column 
)

◆ get_address()

std::string bpp::bpp_entity::get_address ( ) const
virtual

Reimplemented in bpp::bpp_object, and bpp::bpp_datamember.

◆ get_all_known_objects()

std::vector< std::shared_ptr< bpp::bpp_object > > bpp::bpp_entity::get_all_known_objects ( ) const
virtual

◆ get_class() [1/2]

std::shared_ptr< bpp_class > bpp::bpp_entity::get_class ( )
virtual

Reimplemented in bpp::bpp_class.

◆ get_class() [2/2]

std::shared_ptr< bpp::bpp_class > bpp::bpp_entity::get_class ( const std::string &  name,
size_t  max_visible_index = SIZE_MAX 
)
virtual

Reimplemented in bpp::bpp_program.

◆ get_classes()

const bpp::OwnedEntityList< bpp::bpp_class > & bpp::bpp_entity::get_classes ( ) const
virtual

Reimplemented in bpp::bpp_program.

◆ get_containing_class()

std::weak_ptr< bpp::bpp_class > bpp::bpp_entity::get_containing_class ( )
virtual

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 in bpp::bpp_class.

◆ get_containing_program()

std::weak_ptr< bpp::bpp_program > bpp::bpp_entity::get_containing_program ( )
virtual

Reimplemented in bpp::bpp_program.

◆ get_initial_definition()

bpp::SymbolPosition bpp::bpp_entity::get_initial_definition ( ) const

◆ get_local_objects()

const bpp::OwnedEntityList< bpp::bpp_object > & bpp::bpp_entity::get_local_objects ( ) const

◆ get_name()

std::string bpp::bpp_entity::get_name ( ) const
virtual

◆ get_object()

std::shared_ptr< bpp::bpp_object > bpp::bpp_entity::get_object ( const std::string &  name,
size_t  max_visible_index = SIZE_MAX 
)

◆ get_parent()

std::shared_ptr< bpp::bpp_class > bpp::bpp_entity::get_parent ( ) const

◆ get_references()

std::list< bpp::SymbolPosition > bpp::bpp_entity::get_references ( ) const

◆ inherit() [1/3]

void bpp::bpp_entity::inherit ( std::shared_ptr< bpp_class parent)
virtual

Reimplemented in bpp::bpp_class, and bpp::bpp_class.

◆ inherit() [2/3]

void bpp::bpp_entity::inherit ( std::shared_ptr< bpp_entity parent)

Inherit from a parent entity.

Parameters
parentThe parent entity to inherit from

◆ inherit() [3/3]

void bpp::bpp_entity::inherit ( std::shared_ptr< bpp_program program)

◆ number_of_known_classes()

size_t bpp::bpp_entity::number_of_known_classes ( ) const
virtual

Reimplemented in bpp::bpp_program.

◆ number_of_known_objects()

size_t bpp::bpp_entity::number_of_known_objects ( ) const

◆ operator=() [1/2]

bpp_entity & bpp::bpp_entity::operator= ( bpp_entity &&  other)
defaultnoexcept

◆ operator=() [2/2]

bpp_entity & bpp::bpp_entity::operator= ( const bpp_entity other)
default

◆ set_containing_class()

bool bpp::bpp_entity::set_containing_class ( std::weak_ptr< bpp::bpp_class containing_class)
virtual

Reimplemented in bpp::bpp_class.

◆ set_definition_position()

void bpp::bpp_entity::set_definition_position ( const std::string &  file,
uint64_t  line,
uint64_t  column 
)

◆ set_name()

void bpp::bpp_entity::set_name ( const std::string &  name)
virtual

Reimplemented in bpp::bpp_class.

Member Data Documentation

◆ containing_class

std::weak_ptr<bpp_class> bpp::bpp_entity::containing_class
protected

◆ containing_program

std::weak_ptr<bpp_program> bpp::bpp_entity::containing_program
protected

◆ initial_definition

bpp::SymbolPosition bpp::bpp_entity::initial_definition
protected

◆ local_objects

OwnedEntityList<bpp_object> bpp::bpp_entity::local_objects
protected

◆ name

std::string bpp::bpp_entity::name
protected

◆ overridden_method

std::weak_ptr<bpp_method> bpp::bpp_entity::overridden_method
protected

◆ parent_entity

std::weak_ptr<bpp_entity> bpp::bpp_entity::parent_entity
protected

For all entities (except program), the parent entity from which this entity inherits.

◆ parent_visible_object_count_at_creation

size_t bpp::bpp_entity::parent_visible_object_count_at_creation = 0
protected

◆ parents

std::vector<std::weak_ptr<bpp_class> > bpp::bpp_entity::parents
protected

For classes: the list of parent classes, in order.

◆ program_visible_class_count_at_creation

size_t bpp::bpp_entity::program_visible_class_count_at_creation = 0
protected

◆ references

std::list<bpp::SymbolPosition> bpp::bpp_entity::references
protected

◆ type

std::weak_ptr<bpp_class> bpp::bpp_entity::type
protected

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