Body
class Body
Represents a body of an object or macro. This is the class other parts of the program interact with. It is a wrapper around the BodyElement hierarchy.
constructor Body
Constructs an empty body.
| Body | ( | ); |
constructor Body
Constructs a body with a given element.
| Body | ( | const std::shared_ptr< BodyElement > & element | ); |
| PARAMETER | DESCRIPTION |
|---|---|
element |
The element to wrap. |
method append
Appends a new element to the body.
If necessary, the body will be converted to a BlockBody to accommodate the new element.
| void append | ( | const Body & element | ); |
| PARAMETER | DESCRIPTION |
|---|---|
element |
The element to append. |
method append_sub
| std::pair< bool, std::optional< Body > > append_sub | ( | const Body & element | ); |
| PARAMETER | DESCRIPTION |
|---|---|
element |
| RETURNS | DESCRIPTION |
|---|---|
std::pair< bool, std::optional< Body > > |
method asconst
Get the body element as a specific type.
| T * as | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
T * |
The body element as type T, or nullptr if it is not of that type. |
method backconst
| std::optional< Body > back | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Body > |
method cloneconst
Create a deep copy of the body.
| Body clone | ( | const CloneContext & context | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
context |
| RETURNS | DESCRIPTION |
|---|---|
Body |
A new Body that is a deep copy of this body. |
method emptyconst
Check if it is an EmptyBody.
| bool empty | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method encode
| void encode | ( | std::string & bytes, | |
| const Memory * memory = nullptr | ); |
| PARAMETER | DESCRIPTION |
|---|---|
bytes |
|
memory |
method enter_names
| void enter_names | ( | Scope * scope, | |
| Entity * containing_entity | ); |
| PARAMETER | DESCRIPTION |
|---|---|
scope |
|
containing_entity |
method evaluate
| void evaluate | ( | const EvaluationContext & context | ); |
| PARAMETER | DESCRIPTION |
|---|---|
context |
method evaluatedconst
| std::optional< Body > evaluated | ( | const EvaluationContext & context | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
context |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Body > |
method expand_calls
Expand macro and function calls in the body.
This will recursively expand all macro and function calls within the body.
| void expand_calls | ( | ); |
method fully_evaluated
Check if all contained body elements and expressions have been fully evaluated.
| bool fully_evaluated | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method get_elementconst
Get the body element.
| std::shared_ptr< BodyElement > get_element | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::shared_ptr< BodyElement > |
The body element as a shared pointer. |
method isconst
Check if the body element is of a specific type.
| bool is | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method offsetconst
| SizeRange offset | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
SizeRange |
method resolve
Resolve all names in the body.
| void resolve | ( | Scope * scope, | |
| Entity * containing_entity | ); |
| PARAMETER | DESCRIPTION |
|---|---|
scope |
The scope to resolve names in. |
containing_entity |
The entity that contains the body. |
method serializeconst
| void serialize | ( | std::ostream & stream, | |
| const std::string & prefix = "" | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
|
prefix |
method sizeconst
| std::optional< uint64_t > size | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< uint64_t > |
method size_rangeconst
| SizeRange size_range | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
SizeRange |
method type_nameconst
| std::string_view type_name | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::string_view |
method validconst
| bool valid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |