#include <formatter.h>
|
bool | ensure_braces_for_block = true |
|
bool | compact_block = true |
|
bool | eos_after_block = false |
|
bool | sep_after_block = true |
|
Formatter for generating C++ code.
◆ enterNamespace()
void Formatter::enterNamespace |
( |
const std::string & |
absolute_ns | ) |
|
Enters a namespace for subsequent elements. In contrast to pushNamespace
, this takes an absolute namespace (i.e., from the root level) that the method might adopt based on what the formatter's current namespace is. For example, if the current namespace matches the new namespace, no namespace
directive needs to be inserted at all. If the new namespace is a sub-namespace of the current one, the inserted namespace
directive will include only the relative part.
- Parameters
-
absolute_ns | the namespace, which will be adapted before being used as part of a a namespace directive. |
◆ leaveNamespace()
void Formatter::leaveNamespace |
( |
| ) |
|
Leaves all current namespaces, clearing out the stack.
◆ namespace_()
std::optional< std::string > Formatter::namespace_ |
( |
int |
level = -1 | ) |
const |
Returns the formatter's current absolute namespace, optionally just to a given level.
- Parameters
-
level | max level to include, with 1 being the first. |
◆ popNamespace()
void Formatter::popNamespace |
( |
| ) |
|
Removes the most recently opened namespace from the stack.
◆ pushNamespace()
void Formatter::pushNamespace |
( |
std::string |
relative_ns | ) |
|
Opens a new namespace that's relative to whatever the current namespace is. The new namespace will go onto the formatter's namespace stack.
- Parameters
-
relative_ns | the namespace, which will be used as is for a new namespace directive. |
◆ relativeID()
Adjust an ID's scoping relative to a namespace.
- Parameters
-
id | with absolute scoping |
level | depth of current namespace to consider |
- Returns
- id with scoping relative to level elements of the current namespacing path
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/spicy-docs/checkouts/v1.7.0/hilti/toolchain/include/compiler/detail/cxx/formatter.h
- /home/docs/checkouts/readthedocs.org/user_builds/spicy-docs/checkouts/v1.7.0/hilti/toolchain/src/compiler/cxx/formatter.cc