xmlgenerator.h Source File

NEDXML API: xmlgenerator.h Source File
NEDXML API
xmlgenerator.h
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
25namespace omnetpp {
26namespace nedxml {
27
33NEDXML_API void generateXML(std::ostream& out, ASTNode *tree, bool srcloc, int indentsize = 4);
34
40NEDXML_API std::string generateXML(ASTNode *tree, bool srcloc, int indentsize = 4);
41
47class NEDXML_API XMLGenerator
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
Definition astnode.h:88
XMLGenerator()
Definition xmlgenerator.h:59
virtual ~XMLGenerator()
Definition xmlgenerator.h:64
virtual std::string generate(ASTNode *tree)
virtual void setSourceLocationAttributes(bool srcloc)
virtual void setIndentSize(int indentsize)
virtual void generate(std::ostream &out, ASTNode *tree)
NEDXML_API void generateXML(std::ostream &out, ASTNode *tree, bool srcloc, int indentsize=4)
Simple front-end to XMLGenerator.