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

A while/until loop in Bash++. More...

#include <bpp.h>

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

Public Member Functions

 bash_while_or_until_loop ()
 
void set_condition (std::shared_ptr< bpp::bash_while_or_until_condition > condition)
 
std::shared_ptr< bpp::bash_while_or_until_conditionget_condition () const
 
std::string get_code () const override
 Return the contents of the main code buffer as a string.
 
std::string get_pre_code () const override
 Return the contents of the pre-code buffer as a string.
 
std::string get_post_code () const override
 Return the contents of the post-code buffer as a string.
 
- 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 ()
 
void set_requires_perfect_forwarding (bool require)
 
bool get_requires_perfect_forwarding () const
 
- 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 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
 
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::bash_while_or_until_conditioncondition
 

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
 
bool requires_perfect_forwarding = false
 Signals to bash_command_sequence entities whether they should operate in perfect forwarding mode I.e., whether this entity has special need to separate its pre- and post-code from its main code.
 
- 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_classtype = nullptr
 
std::weak_ptr< bpp_classcontaining_class
 
std::weak_ptr< bpp_programcontaining_program
 
std::vector< std::weak_ptr< bpp_class > > parents
 
std::weak_ptr< bpp_methodoverridden_method
 
bpp::SymbolPosition initial_definition
 
std::list< bpp::SymbolPositionreferences
 

Detailed Description

A while/until loop in Bash++.

This entity gets pushed onto the entity stack when a while loop or an until loop is encountered in Bash++ code. It contains a bash_while_or_until_condition object which holds the condition for the loop

The reason for this is that the condition for the 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++

Constructor & Destructor Documentation

◆ bash_while_or_until_loop()

bpp::bash_while_or_until_loop::bash_while_or_until_loop ( )

Member Function Documentation

◆ get_code()

std::string bpp::bash_while_or_until_loop::get_code ( ) const
overridevirtual

Return the contents of the main code buffer as a string.

Reimplemented from bpp::bpp_code_entity.

◆ get_condition()

std::shared_ptr< bpp::bash_while_or_until_condition > bpp::bash_while_or_until_loop::get_condition ( ) const

◆ get_post_code()

std::string bpp::bash_while_or_until_loop::get_post_code ( ) const
overridevirtual

Return the contents of the post-code buffer as a string.

Reimplemented from bpp::bpp_code_entity.

◆ get_pre_code()

std::string bpp::bash_while_or_until_loop::get_pre_code ( ) const
overridevirtual

Return the contents of the pre-code buffer as a string.

Reimplemented from bpp::bpp_code_entity.

◆ set_condition()

void bpp::bash_while_or_until_loop::set_condition ( std::shared_ptr< bpp::bash_while_or_until_condition condition)

Member Data Documentation

◆ condition

std::shared_ptr<bpp::bash_while_or_until_condition> bpp::bash_while_or_until_loop::condition
private

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