OMNeT++ NEDXML  6.0.3
xmlgenerator.h
Go to the documentation of this file.
1 //==========================================================================
2 // XMLGENERATOR.H - part of
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 //==========================================================================
8 
9 /*--------------------------------------------------------------*
10  Copyright (C) 2002-2017 Andras Varga
11  Copyright (C) 2006-2017 OpenSim Ltd.
12 
13  This file is distributed WITHOUT ANY WARRANTY. See the file
14  `license' for details on this and other legal matters.
15 *--------------------------------------------------------------*/
16 
17 
18 #ifndef __OMNETPP_NEDXML_XMLGENERATOR_H
19 #define __OMNETPP_NEDXML_XMLGENERATOR_H
20 
21 
22 #include <iostream>
23 #include "astnode.h"
24 
25 namespace omnetpp {
26 namespace nedxml {
27 
33 NEDXML_API void generateXML(std::ostream& out, ASTNode *tree, bool srcloc, int indentsize = 4);
34 
40 NEDXML_API std::string generateXML(ASTNode *tree, bool srcloc, int indentsize = 4);
41 
48 {
49  protected:
50  bool printSrcLoc = true;
51  int indentSize = 2;
52  virtual void printAttrValue(std::ostream& out, const char *s);
53  virtual void doGenerate(std::ostream& out, ASTNode *node, int level);
54 
55  public:
60 
64  virtual ~XMLGenerator() {}
65 
73  virtual void setSourceLocationAttributes(bool srcloc);
74 
78  virtual void setIndentSize(int indentsize);
79 
88  virtual void generate(std::ostream& out, ASTNode *tree);
89 
93  virtual std::string generate(ASTNode *tree);
94 
95 };
96 
97 } // namespace nedxml
98 } // namespace omnetpp
99 
100 
101 #endif
omnetpp::nedxml::generateXML
NEDXML_API void generateXML(std::ostream &out, ASTNode *tree, bool srcloc, int indentsize=4)
Simple front-end to XMLGenerator.
astnode.h
NEDXML_API
#define NEDXML_API
Definition: nedxmldefs.h:31
omnetpp
Definition: astbuilder.h:25
omnetpp::nedxml::XMLGenerator::XMLGenerator
XMLGenerator()
Definition: xmlgenerator.h:59
omnetpp::nedxml::ASTNode
Definition: astnode.h:87
omnetpp::nedxml::XMLGenerator::~XMLGenerator
virtual ~XMLGenerator()
Definition: xmlgenerator.h:64
omnetpp::nedxml::XMLGenerator
Serializes an AST in XML format.
Definition: xmlgenerator.h:47