Bash++
Bash++ compiler internal documentation
|
A while loop in Bash++. More...
#include <bpp.h>
Public Member Functions | |
bash_while_loop () | |
void | set_while_condition (std::shared_ptr< bpp::bash_while_condition > while_condition) |
std::shared_ptr< bpp::bash_while_condition > | get_while_condition () const |
std::string | get_code () const override |
Return the contents of the main code buffer as a string. More... | |
std::string | get_pre_code () const override |
Return the contents of the pre-code buffer as a string. More... | |
std::string | get_post_code () const override |
Return the contents of the post-code buffer as a string. More... | |
![]() | |
bpp_code_entity () | |
virtual | ~bpp_code_entity ()=default |
virtual void | add_code (const std::string &code, bool add_newline=true) |
Add code to the code entity. More... | |
virtual void | add_code_to_previous_line (const std::string &code) |
Add code to the code entity's pre-code buffer. More... | |
virtual void | add_code_to_next_line (const std::string &code) |
Add code to the code entity's post-code buffer. More... | |
bool | add_object (std::shared_ptr< bpp_object > object) override |
Add an object to the code entity. More... | |
virtual void | flush_nextline_buffer () |
virtual void | flush_postline_buffer () |
virtual void | flush_code_buffers () |
virtual void | clear_all_buffers () |
![]() | |
virtual | ~bpp_entity ()=default |
virtual bool | add_class (std::shared_ptr< bpp_class > class_) |
Add a class to this entity's list of classes. More... | |
virtual std::shared_ptr< bpp_class > | get_class () const |
virtual std::string | get_address () const |
virtual std::string | get_name () const |
virtual std::weak_ptr< bpp::bpp_class > | get_containing_class () const |
Get the class which contains this entity. More... | |
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. More... | |
virtual void | inherit (std::shared_ptr< bpp_class > parent) |
virtual std::unordered_map< std::string, std::shared_ptr< bpp_class > > | get_classes () const |
virtual std::unordered_map< std::string, std::shared_ptr< bpp_object > > | get_objects () const |
virtual std::shared_ptr< bpp_class > | get_class (const std::string &name) |
virtual std::shared_ptr< bpp_object > | get_object (const std::string &name) |
Private Attributes | |
std::shared_ptr< bpp::bash_while_condition > | while_condition |
Additional Inherited Members | |
![]() | |
std::shared_ptr< std::ostream > | code = std::make_shared<std::ostringstream>() |
std::string | nextline_buffer = "" |
std::string | postline_buffer = "" |
bool | buffers_flushed = false |
![]() | |
std::unordered_map< std::string, std::shared_ptr< bpp_class > > | classes |
A map of class names to class objects within this entity. More... | |
std::unordered_map< std::string, std::shared_ptr< bpp_object > > | objects |
A map of object names to bpp_objects within this entity. More... | |
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. More... | |
std::shared_ptr< bpp_class > | type = nullptr |
std::weak_ptr< bpp_class > | containing_class |
std::vector< std::shared_ptr< bpp_class > > | parents |
A while loop in Bash++.
This entity gets pushed onto the entity stack when a while loop is encountered in Bash++ code. It contains a bash_while_condition object which holds the condition for the while loop
The reason for this is that the condition for the while loop may contain references which need to be resolved And the pre- and post-code for those references need to be added in specific places in the compiled code. E.g., supershells must be re-evaluated for each iteration of the loop
The 'bash_' prefix signifies that this is used to parse ordinary Bash code, not anything specific to Bash++
bpp::bash_while_loop::bash_while_loop | ( | ) |
|
overridevirtual |
Return the contents of the main code buffer as a string.
Reimplemented from bpp::bpp_code_entity.
|
overridevirtual |
Return the contents of the post-code buffer as a string.
Reimplemented from bpp::bpp_code_entity.
|
overridevirtual |
Return the contents of the pre-code buffer as a string.
Reimplemented from bpp::bpp_code_entity.
std::shared_ptr< bpp::bash_while_condition > bpp::bash_while_loop::get_while_condition | ( | ) | const |
void bpp::bash_while_loop::set_while_condition | ( | std::shared_ptr< bpp::bash_while_condition > | while_condition | ) |
|
private |