OMNeT++ NEDXML  5.4.1
MsgGenerator Class Reference

#include <msggenerator.h>

Description

Generates MSG source from an AST.

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

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

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)
 
void doMsgClassOrStructBody (ASTNode *msgclassorstruct, const char *indent)
 
Change indentation level
const char * increaseIndent (const char *indent)
 
const char * decreaseIndent (const char *indent)
 
Getters for comments
std::string concatInnerComments (ASTNode *node)
 
std::string getBannerComment (ASTNode *node, const char *indent)
 
std::string getRightComment (ASTNode *node)
 
std::string getInlineRightComment (ASTNode *node)
 
std::string getTrailingComment (ASTNode *node)
 
Generate MSG source code from the given element
void doFiles (FilesElement *node, const char *indent, bool islast, const char *)
 
void doMsgFile (MsgFileElement *node, const char *indent, bool islast, const char *)
 
void doImport (ImportElement *node, const char *indent, bool islast, const char *)
 
void doProperty (PropertyElement *node, const char *indent, bool islast, const char *sep)
 
void doPropertyKey (PropertyKeyElement *node, const char *indent, bool islast, const char *sep)
 
void doLiteral (LiteralElement *node, const char *indent, bool islast, const char *)
 
void doNamespace (NamespaceElement *node, const char *indent, bool islast, const char *)
 
void doCplusplus (CplusplusElement *node, const char *indent, bool islast, const char *)
 
void doStructDecl (StructDeclElement *node, const char *indent, bool islast, const char *)
 
void doClassDecl (ClassDeclElement *node, const char *indent, bool islast, const char *)
 
void doMessageDecl (MessageDeclElement *node, const char *indent, bool islast, const char *)
 
void doPacketDecl (PacketDeclElement *node, const char *indent, bool islast, const char *)
 
void doEnumDecl (EnumDeclElement *node, const char *indent, bool islast, const char *)
 
void doEnum (EnumElement *node, const char *indent, bool islast, const char *)
 
void doEnumField (EnumFieldElement *node, const char *indent, bool islast, const char *)
 
void doMessage (MessageElement *node, const char *indent, bool islast, const char *)
 
void doPacket (PacketElement *node, const char *indent, bool islast, const char *)
 
void doClass (ClassElement *node, const char *indent, bool islast, const char *)
 
void doStruct (StructElement *node, const char *indent, bool islast, const char *)
 
void doField (FieldElement *node, const char *indent, bool islast, const char *)
 
void doComment (CommentElement *node, const char *indent, bool islast, const char *)
 

Protected Attributes

int indentSize
 
std::ostream * outp
 

Constructor & Destructor Documentation

Constructor.

Destructor.

Member Function Documentation

void setIndentSize ( int  indentsize)

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

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.

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

Generates MSG source code and returns it as a string.

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

Dispatch to various doXXX() methods according to node type

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

Invoke generateItem() on all children

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

Invoke generateItem() on all children of the given tagcode

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)

void doMsgClassOrStructBody ( ASTNode msgclassorstruct,
const char *  indent 
)
protected
std::string concatInnerComments ( ASTNode node)
protected
std::string getBannerComment ( ASTNode node,
const char *  indent 
)
protected
std::string getRightComment ( ASTNode node)
protected
std::string getInlineRightComment ( ASTNode node)
protected
std::string getTrailingComment ( ASTNode node)
protected
void doFiles ( FilesElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doMsgFile ( MsgFileElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doImport ( ImportElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doProperty ( PropertyElement *  node,
const char *  indent,
bool  islast,
const char *  sep 
)
protected
void doPropertyKey ( PropertyKeyElement *  node,
const char *  indent,
bool  islast,
const char *  sep 
)
protected
void doLiteral ( LiteralElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doNamespace ( NamespaceElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doCplusplus ( CplusplusElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doStructDecl ( StructDeclElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doClassDecl ( ClassDeclElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doMessageDecl ( MessageDeclElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doPacketDecl ( PacketDeclElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doEnumDecl ( EnumDeclElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doEnum ( EnumElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doEnumField ( EnumFieldElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doMessage ( MessageElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doPacket ( PacketElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doClass ( ClassElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doStruct ( StructElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doField ( FieldElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected
void doComment ( CommentElement *  node,
const char *  indent,
bool  islast,
const char *   
)
protected

Member Data Documentation

int indentSize
protected
std::ostream* outp
protected

The documentation for this class was generated from the following file: