17 #ifndef COM_BORA_SOFTWARE__BALAU_LANG_CSS_UTIL__PROPERTY_AST_TO_STRING 18 #define COM_BORA_SOFTWARE__BALAU_LANG_CSS_UTIL__PROPERTY_AST_TO_STRING 29 private:
const std::string indentString =
"\t";
31 private: std::ostream & builder;
32 private:
size_t indentCount = 0;
36 public:
void write(
const std::string_view & text) {
40 public:
void incrementIndent() {
44 public:
void decrementIndent() {
48 public:
void writeIndent() {
49 for (
size_t m = 0; m < indentCount; m++) {
50 builder << indentString;
60 for (
auto & node :
object.getNodes()) {
61 node->visit(payload, *
this);
68 pl.write(
object.getName());
70 pl.write(
object.getValue());
77 pl.write(
object.getName());
81 for (
const auto & node :
object.getNodes()) {
82 node->visit(payload, *
this);
94 pl.write(
object.getText());
102 pl.write(
object.getText());
118 object.
visit(payload, astToString);
130 std::ostringstream stream;
142 template <
typename AllocatorT>
151 #endif // COM_BORA_SOFTWARE__BALAU_LANG_CSS_UTIL__PROPERTY_AST_TO_STRING void visit(Payload &payload, const IncludePropertyNode &object) override
Visit an include property node.
Definition: PropertyAstToString.hpp:90
The Property parser AST node classes.
void visit(Payload &payload, const EmptyLinePropertyNode &object) override
Visit a blank line property node.
Definition: PropertyAstToString.hpp:106
Simple name-value property node.
Definition: PropertyAst.hpp:221
void visit(Payload &payload, const CompositeProperty &object) override
Visit a composite property node.
Definition: PropertyAstToString.hpp:74
void visit(Payload &payload, const ValueProperty &object) override
Visit a value property node.
Definition: PropertyAstToString.hpp:65
Visitor interface for property AST nodes.
Definition: PropertyVisitor.hpp:49
The property AST visitor used in the property AST toString implementation.
Definition: PropertyAstToString.hpp:58
Abstract base class of Property AST node classes.
Definition: PropertyAst.hpp:35
The payload used in the property AST toString implementation.
Definition: PropertyAstToString.hpp:28
Represents a blank line in a property file.
Definition: PropertyAst.hpp:465
Composite name-value property node.
Definition: PropertyAst.hpp:288
Base class of property visitor payloads.
Definition: PropertyVisitor.hpp:39
std::basic_ostringstream< char, std::char_traits< char >, AllocatorT > U8OStringStream
UTF-8 output string stream type with selectable allocator.
Definition: ToStringA.hpp:59
void visit(Payload &payload, const Properties &object) override
Visit a Properties node.
Definition: PropertyAstToString.hpp:59
std::string toString(const PropertyNode &object)
The property AST toString function.
Definition: PropertyAstToString.hpp:129
Base Balau exception classes.
std::ostream & operator<<(std::ostream &stream, const PropertyNode &object)
Pretty print the supplied AST to the output stream.
Definition: PropertyAstToString.hpp:115
Include property node.
Definition: PropertyAst.hpp:357
std::basic_string< char, std::char_traits< char >, AllocatorT > U8String
UTF-8 string type with selectable allocator.
Definition: ToStringA.hpp:41
void visit(Payload &payload, const CommentPropertyNode &object) override
Visit a comment property node.
Definition: PropertyAstToString.hpp:98
The Property parser abstract syntax tree node classes.
Definition: PropertyAst.hpp:30
The outer structure.
Definition: PropertyAst.hpp:175