libutap  0.93
Uppaal Timed Automata Parser
xmlwriter.h
Go to the documentation of this file.
1 // -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 
3 /* libutap - Uppaal Timed Automata Parser.
4  Copyright (C) 2002-2006 Uppsala University and Aalborg University.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public License
8  as published by the Free Software Foundation; either version 2.1 of
9  the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  USA
20  */
21 
22 #ifndef XMLWRITER_H
23 #define XMLWRITER_H
24 
25 #include "utap/system.h"
26 #include "utap/common.h"
27 
28 #include <libxml/encoding.h>
29 #include <libxml/xmlwriter.h>
30 #include <libxml/xmlreader.h>
31 
32 #include <cstdio>
33 #include <cstdarg>
34 #include <cctype>
35 #include <cmath>
36 #include <cassert>
37 #include <stdexcept>
38 #include <list>
39 #include <sstream>
40 
41 namespace UTAP {
42 
43  xmlChar * ConvertInput(const char *in, const char *encoding);
44 
48  std::string concat(const std::string& s, int i);
52  std::string concatDouble(const std::string& s, double i);
53 
54  class XMLWriter
55  {
56  public: // was private - needed for derived class SBMLtoXMLWriter
57  xmlTextWriterPtr writer;
59  std::map<int, int> selfLoops;
60 
61  void startDocument();
62  void endDocument();
63  void startElement(const char* element);
64  void endElement();
65  void writeElement(const char* name, const char* content);
66  void writeAttribute(const char* name, const char* value);
67  void writeString(const char* content);
68  void xmlwriteString(const xmlChar* content);
69 
70  void taTempl(const template_t& templ);
71  void location(const state_t& state);
72  void init(const template_t& templ);
73  void name(const state_t& state, int x, int y);
74  void writeStateAttributes(const state_t& state, int x, int y);
75  void transition(const edge_t& edge);
76  void nail(int x, int y);
77 
78  void label(const char* kind, std::string data, int x, int y);
79  int source(const edge_t& edge);
80  int target(const edge_t& edge);
81  void selfLoop(int loc, float initialAngle, const edge_t& edge);
82  void labels(int x, int y, const edge_t& edge);
83 
84  void declaration();
85  std::string getChanPriority() const;
86  void parameter();
87  void system_instantiation();
88 
89  //public:
90  XMLWriter(xmlTextWriterPtr writer, TimedAutomataSystem* taSystem);
91  virtual ~XMLWriter();
92  void project();
93  };
94 }
95 
96 
97 #endif /* XMLWRITER_H */
98 
XMLWriter(xmlTextWriterPtr writer, TimedAutomataSystem *taSystem)
Definition: xmlwriter.cpp:51
std::map< int, int > selfLoops
Definition: xmlwriter.h:59
void project()
Parse the project document.
Definition: xmlwriter.cpp:338
void system_instantiation()
Definition: xmlwriter.cpp:319
void labels(int x, int y, const edge_t &edge)
Definition: xmlwriter.cpp:267
Information about a location.
Definition: system.h:56
void taTempl(const template_t &templ)
writes a template
Definition: xmlwriter.cpp:289
void writeStateAttributes(const state_t &state, int x, int y)
Definition: xmlwriter.cpp:161
void label(const char *kind, std::string data, int x, int y)
Definition: xmlwriter.cpp:132
xmlTextWriterPtr writer
The underlying xmlTextWriter.
Definition: xmlwriter.h:57
std::string getChanPriority() const
Definition: xmlwriter.cpp:116
Information about an edge.
Definition: system.h:85
void writeString(const char *content)
Definition: xmlwriter.cpp:85
void declaration()
Parses optional declaration.
Definition: xmlwriter.cpp:108
void startDocument()
Definition: xmlwriter.cpp:353
void selfLoop(int loc, float initialAngle, const edge_t &edge)
Definition: xmlwriter.cpp:224
int target(const edge_t &edge)
Definition: xmlwriter.cpp:215
void name(const state_t &state, int x, int y)
Definition: xmlwriter.cpp:152
void nail(int x, int y)
Definition: xmlwriter.cpp:241
void writeElement(const char *name, const char *content)
Definition: xmlwriter.cpp:77
void endDocument()
Definition: xmlwriter.cpp:368
void startElement(const char *element)
Definition: xmlwriter.cpp:62
xmlChar * ConvertInput(const char *in, const char *encoding)
ConvertInput: : string in a given encoding : the encoding used.
Definition: xmlwriter.cpp:383
std::string concat(const std::string &s, int i)
concatenates a string and an int
std::string concatDouble(const std::string &s, double i)
concatenates a string and a double
void transition(const edge_t &edge)
Definition: xmlwriter.cpp:249
TimedAutomataSystem * taSystem
The system to write.
Definition: xmlwriter.h:58
void endElement()
Definition: xmlwriter.cpp:69
void location(const state_t &state)
Definition: xmlwriter.cpp:169
Definition: lexer.cc:817
int source(const edge_t &edge)
Definition: xmlwriter.cpp:205
void xmlwriteString(const xmlChar *content)
Definition: xmlwriter.cpp:92
void writeAttribute(const char *name, const char *value)
Definition: xmlwriter.cpp:100
virtual ~XMLWriter()
Definition: xmlwriter.cpp:55
void init(const template_t &templ)
Definition: xmlwriter.cpp:197