NedGenerator Class Reference

NEDXML API: NedGenerator Class Reference
NEDXML API
NedGenerator Class Reference

Public Member Functions

 NedGenerator ()
 ~NedGenerator ()
void setIndentSize (int indentsize)
void generate (std::ostream &out, ASTNode *node, const char *indent)
std::string generate (ASTNode *node, const char *indent)

Protected Member Functions

Change indentation level
void generateNedItem (ASTNode *node, const char *indent, bool islast, const char *arg=nullptr)
void generateChildren (ASTNode *node, const char *indent, const char *arg=nullptr)
void generateChildrenWithType (ASTNode *node, int tagcode, const char *indent, const char *arg=nullptr)
void generateChildrenWithTypes (ASTNode *node, int tagcodes[], const char *indent, const char *arg=nullptr)
Utilities
Getters for comments
Generate NED code from the given element

Description

Generates NED code from a NED AST.

Assumes that the object tree has already passed all validation stages (DTD, syntax, semantic).

Constructor & Destructor Documentation

◆ NedGenerator()

NedGenerator ( )
inline

Constructor.

◆ ~NedGenerator()

~NedGenerator ( )
inline

Destructor.

Member Function Documentation

◆ setIndentSize()

void setIndentSize ( int indentsize)

Sets the indent size in the generated NED code. Default is 4 spaces.

◆ generate() [1/2]

void generate ( std::ostream & out,
ASTNode * node,
const char * indent )

Generates NED code. Takes an output stream where the generated NED code will be written, the object tree and the base indentation.

◆ generate() [2/2]

std::string generate ( ASTNode * node,
const char * indent )

Generates NED code and returns it as a string.

◆ generateNedItem()

void generateNedItem ( ASTNode * node,
const char * indent,
bool islast,
const char * arg = nullptr )
protected

Dispatch to various doXXX() methods according to node type

◆ generateChildren()

void generateChildren ( ASTNode * node,
const char * indent,
const char * arg = nullptr )
protected

Invoke generateNedItem() on all children

◆ generateChildrenWithType()

void generateChildrenWithType ( ASTNode * node,
int tagcode,
const char * indent,
const char * arg = nullptr )
protected

Invoke generateNedItem() on all children of the given tagcode

◆ generateChildrenWithTypes()

void generateChildrenWithTypes ( ASTNode * node,
int tagcodes[],
const char * indent,
const char * arg = nullptr )
protected

Invoke generateNedItem() on children of the given tagcodes (NED_NULL-terminated array)