MsgGenerator Class Reference

NEDXML API: MsgGenerator Class Reference
NEDXML API
MsgGenerator Class Reference

Public Member Functions

 MsgGenerator ()
 ~MsgGenerator ()
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 generateItem (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)
Getters for comments
Generate MSG source code from the given element

Description

Generates MSG source from an AST.

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

Constructor & Destructor Documentation

◆ MsgGenerator()

MsgGenerator ( )
inline

Constructor.

◆ ~MsgGenerator()

~MsgGenerator ( )
inline

Destructor.

Member Function Documentation

◆ setIndentSize()

void setIndentSize ( int indentsize)

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

◆ generate() [1/2]

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

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

◆ generate() [2/2]

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

Generates MSG source code and returns it as a string.

◆ generateItem()

void generateItem ( 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 generateItem() on all children

◆ generateChildrenWithType()

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

Invoke generateItem() on all children of the given tagcode

◆ generateChildrenWithTypes()

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

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