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

The main program. More...

#include <bpp.h>

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

Public Member Functions

 bpp_program ()
 
bool set_containing_class (std::weak_ptr< bpp_class > containing_class) override
 
void set_output_stream (std::shared_ptr< std::ostream > output_stream)
 
bool prepare_class (std::shared_ptr< bpp_class > class_)
 Prepare a class for addition to the program by adding it to the classes map.
 
bool add_class (std::shared_ptr< bpp_class > class_) override
 Add a class to the program.
 
std::shared_ptr< bpp_classget_primitive_class () const
 
void set_include_paths (std::shared_ptr< std::vector< std::string > > paths)
 
std::shared_ptr< std::vector< std::string > > get_include_paths () const
 
void increment_supershell_counter ()
 
uint64_t get_supershell_counter () const
 
void increment_assignment_counter ()
 
uint64_t get_assignment_counter () const
 
void increment_function_counter ()
 
uint64_t get_function_counter () const
 
void increment_dynamic_cast_counter ()
 
uint64_t get_dynamic_cast_counter () const
 
void increment_typeof_counter ()
 
uint64_t get_typeof_counter () const
 
void increment_object_counter ()
 
uint64_t get_object_counter () const
 
void set_target_bash_version (uint16_t major, uint16_t minor)
 
std::pair< uint16_t, uint16_t > get_target_bash_version () const
 
void mark_entity (const std::string &file, uint32_t start_line, uint32_t start_column, uint32_t end_line, uint32_t end_column, std::shared_ptr< bpp::bpp_entity > entity)
 
std::shared_ptr< bpp::bpp_entityget_active_entity (const std::string &file, uint32_t line, uint32_t column)
 
std::vector< std::string > get_source_files () const
 
std::string get_main_source_file () const
 
void set_main_source_file (const std::string &file)
 
void add_source_file (const std::string &file)
 
void add_diagnostic (const std::string &file, diagnostic_type type, const std::string &message, uint32_t start_line, uint32_t start_column, uint32_t end_line, uint32_t end_column)
 
std::vector< bpp::diagnosticget_diagnostics (const std::string &file) const
 
void clear_diagnostics (const std::string &file)
 
- Public Member Functions inherited from bpp::bpp_code_entity
 bpp_code_entity ()
 
virtual void add_code (const std::string &code, bool add_newline=true)
 Add code to the code entity.
 
virtual void add_code_to_previous_line (const std::string &code)
 Add code to the code entity's pre-code buffer.
 
virtual void add_code_to_next_line (const std::string &code)
 Add code to the code entity's post-code buffer.
 
bool add_object (std::shared_ptr< bpp_object > object, bool make_local=false) override
 Add an object to the code entity.
 
virtual void flush_nextline_buffer ()
 
virtual void flush_postline_buffer ()
 
virtual void flush_code_buffers ()
 
virtual void clear_all_buffers ()
 
virtual std::string get_code () const
 Return the contents of the main code buffer as a string.
 
virtual std::string get_pre_code () const
 Return the contents of the pre-code buffer as a string.
 
virtual std::string get_post_code () const
 Return the contents of the post-code buffer as a string.
 
- Public Member Functions inherited from bpp::bpp_entity
virtual ~bpp_entity ()=default
 
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 bool set_containing_class (std::weak_ptr< bpp::bpp_class > containing_class)
 
virtual void inherit (std::shared_ptr< bpp_entity > parent)
 Inherit from a parent entity.
 
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
 
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_classget_class (const std::string &name)
 
std::shared_ptr< bpp_objectget_object (const std::string &name)
 
std::shared_ptr< bpp_classget_parent () const
 

Private Attributes

std::shared_ptr< bpp_classprimitive_class
 
uint64_t supershell_counter = 0
 
uint64_t assignment_counter = 0
 
uint64_t function_counter = 0
 
uint64_t dynamic_cast_counter = 0
 
uint64_t typeof_counter = 0
 
uint64_t object_counter = 0
 
std::pair< uint16_t, uint16_t > target_bash_version = {5, 2}
 
std::string main_source_file
 
std::unordered_map< std::string, EntityMapentity_maps
 
std::unordered_map< std::string, std::vector< bpp::diagnostic > > diagnostics
 
std::shared_ptr< std::vector< std::string > > include_paths
 

Additional Inherited Members

- Protected Attributes inherited from bpp::bpp_code_entity
std::shared_ptr< std::ostream > code = std::make_shared<std::ostringstream>()
 
std::string nextline_buffer = ""
 
std::string postline_buffer = ""
 
bool buffers_flushed = false
 
- Protected Attributes inherited from bpp::bpp_entity
std::string name = ""
 
std::unordered_map< std::string, std::shared_ptr< bpp_class > > classes
 A map of class names to class objects within this entity.
 
std::unordered_map< std::string, std::shared_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_classtype = nullptr
 
std::weak_ptr< bpp_classcontaining_class
 
std::vector< std::shared_ptr< bpp_class > > parents
 
bpp::SymbolPosition initial_definition
 
std::list< bpp::SymbolPositionreferences
 

Detailed Description

The main program.

Constructor & Destructor Documentation

◆ bpp_program()

bpp::bpp_program::bpp_program ( )

Member Function Documentation

◆ add_class()

bool bpp::bpp_program::add_class ( std::shared_ptr< bpp_class class_)
overridevirtual

Add a class to the program.

This function adds a class to the program, including all necessary code for the class.

Reimplemented from bpp::bpp_entity.

◆ add_diagnostic()

void bpp::bpp_program::add_diagnostic ( const std::string &  file,
diagnostic_type  type,
const std::string &  message,
uint32_t  start_line,
uint32_t  start_column,
uint32_t  end_line,
uint32_t  end_column 
)

◆ add_source_file()

void bpp::bpp_program::add_source_file ( const std::string &  file)

◆ clear_diagnostics()

void bpp::bpp_program::clear_diagnostics ( const std::string &  file)

◆ get_active_entity()

std::shared_ptr< bpp::bpp_entity > bpp::bpp_program::get_active_entity ( const std::string &  file,
uint32_t  line,
uint32_t  column 
)

◆ get_assignment_counter()

uint64_t bpp::bpp_program::get_assignment_counter ( ) const

◆ get_diagnostics()

std::vector< bpp::diagnostic > bpp::bpp_program::get_diagnostics ( const std::string &  file) const

◆ get_dynamic_cast_counter()

uint64_t bpp::bpp_program::get_dynamic_cast_counter ( ) const

◆ get_function_counter()

uint64_t bpp::bpp_program::get_function_counter ( ) const

◆ get_include_paths()

std::shared_ptr< std::vector< std::string > > bpp::bpp_program::get_include_paths ( ) const

◆ get_main_source_file()

std::string bpp::bpp_program::get_main_source_file ( ) const

◆ get_object_counter()

uint64_t bpp::bpp_program::get_object_counter ( ) const

◆ get_primitive_class()

std::shared_ptr< bpp::bpp_class > bpp::bpp_program::get_primitive_class ( ) const

◆ get_source_files()

std::vector< std::string > bpp::bpp_program::get_source_files ( ) const

◆ get_supershell_counter()

uint64_t bpp::bpp_program::get_supershell_counter ( ) const

◆ get_target_bash_version()

std::pair< uint16_t, uint16_t > bpp::bpp_program::get_target_bash_version ( ) const

◆ get_typeof_counter()

uint64_t bpp::bpp_program::get_typeof_counter ( ) const

◆ increment_assignment_counter()

void bpp::bpp_program::increment_assignment_counter ( )

◆ increment_dynamic_cast_counter()

void bpp::bpp_program::increment_dynamic_cast_counter ( )

◆ increment_function_counter()

void bpp::bpp_program::increment_function_counter ( )

◆ increment_object_counter()

void bpp::bpp_program::increment_object_counter ( )

◆ increment_supershell_counter()

void bpp::bpp_program::increment_supershell_counter ( )

◆ increment_typeof_counter()

void bpp::bpp_program::increment_typeof_counter ( )

◆ mark_entity()

void bpp::bpp_program::mark_entity ( const std::string &  file,
uint32_t  start_line,
uint32_t  start_column,
uint32_t  end_line,
uint32_t  end_column,
std::shared_ptr< bpp::bpp_entity entity 
)

◆ prepare_class()

bool bpp::bpp_program::prepare_class ( std::shared_ptr< bpp_class class_)

Prepare a class for addition to the program by adding it to the classes map.

This means that the class will be accessible for use in the program, but it does not add any code for the class yet.

That is handled by add_class().

Returns
true if the class was prepared successfully, false if the class already exists

◆ set_containing_class()

bool bpp::bpp_program::set_containing_class ( std::weak_ptr< bpp_class containing_class)
override

◆ set_include_paths()

void bpp::bpp_program::set_include_paths ( std::shared_ptr< std::vector< std::string > >  paths)

◆ set_main_source_file()

void bpp::bpp_program::set_main_source_file ( const std::string &  file)

◆ set_output_stream()

void bpp::bpp_program::set_output_stream ( std::shared_ptr< std::ostream >  output_stream)

◆ set_target_bash_version()

void bpp::bpp_program::set_target_bash_version ( uint16_t  major,
uint16_t  minor 
)

Member Data Documentation

◆ assignment_counter

uint64_t bpp::bpp_program::assignment_counter = 0
private

◆ diagnostics

std::unordered_map<std::string, std::vector<bpp::diagnostic> > bpp::bpp_program::diagnostics
private

◆ dynamic_cast_counter

uint64_t bpp::bpp_program::dynamic_cast_counter = 0
private

◆ entity_maps

std::unordered_map<std::string, EntityMap> bpp::bpp_program::entity_maps
private

◆ function_counter

uint64_t bpp::bpp_program::function_counter = 0
private

◆ include_paths

std::shared_ptr<std::vector<std::string> > bpp::bpp_program::include_paths
private

◆ main_source_file

std::string bpp::bpp_program::main_source_file
private

◆ object_counter

uint64_t bpp::bpp_program::object_counter = 0
private

◆ primitive_class

std::shared_ptr<bpp_class> bpp::bpp_program::primitive_class
private

◆ supershell_counter

uint64_t bpp::bpp_program::supershell_counter = 0
private

◆ target_bash_version

std::pair<uint16_t, uint16_t> bpp::bpp_program::target_bash_version = {5, 2}
private

◆ typeof_counter

uint64_t bpp::bpp_program::typeof_counter = 0
private

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