Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
XMLWriter.h
이 파일의 문서화 페이지로 가기
1 // Copyright FreeHEP, 2005.
2 #ifndef CHEPREP_XMLWRITER_H
3 #define CHEPREP_XMLWRITER_H 1
4 
5 #include "cheprep/config.h"
6 
7 #include <iostream>
8 #include <map>
9 #include <stack>
10 #include <vector>
11 #include <string>
12 
15 
20 namespace cheprep {
21 
22 class XMLWriter : public AbstractXMLWriter {
23 
24  public:
25  XMLWriter(std::ostream* out, std::string indentString = " ", std::string defaultNameSpace = "");
26  virtual ~XMLWriter();
27  void close();
28  void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false);
29  void referToDTD(std::string name, std::string pid, std::string ref);
30  void referToDTD(std::string name, std::string system);
31  void closeDoc(bool force = false);
32  void printComment(std::string comment);
33  void printPlain(std::string text);
34  void print(std::string text);
35  void println(std::string text);
36  void openTag(std::string name);
37  void closeTag();
38  void printTag(std::string name);
39  void setAttribute(std::string name, char* value);
40  void setAttribute(std::string name, std::string value);
41  void setAttribute(std::string name, std::vector<double> value);
42  void setAttribute(std::string name, int64 value);
43  void setAttribute(std::string name, int value);
44  void setAttribute(std::string name, bool value);
45  void setAttribute(std::string name, double value);
46  void printAttributes(int tagLength);
47  std::string normalize(std::string s);
48  std::string normalizeText(std::string s);
49  void checkNameValid(std::string s);
50 
51  //
52  // Can be removed when we can properly inherit those (since names are equal to overloaded ones).
53  //
54  void openTag(std::string ns, std::string name) {
55  openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
56  }
57  void printTag(std::string ns, std::string name) {
58  printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
59  }
60  void setAttribute(std::string ns, std::string name, std::string value) {
61  setAttribute(ns.append(":").append(name), value);
62  }
63  void setAttribute(std::string ns, std::string name, double value) {
64  setAttribute(ns.append(":").append(name), value);
65  }
66 
67 
68 
69  protected:
70  bool closed;
72 
73  private:
74  std::string dtdName;
75  std::map<std::string, std::string> attributes;
76  std::stack<std::string> openTags;
77 };
78 
79 } // cheprep
80 
81 #endif
const XML_Char * name
Definition: expat.h:151
std::stack< std::string > openTags
Definition: XMLWriter.h:76
system("rm -rf microbeam.root")
void openTag(std::string name)
Definition: XMLWriter.cc:107
virtual ~XMLWriter()
Definition: XMLWriter.cc:26
void print(std::string text)
Definition: XMLWriter.cc:98
void printTag(std::string ns, std::string name)
Definition: XMLWriter.h:57
XMLWriter(std::ostream *out, std::string indentString=" ", std::string defaultNameSpace="")
Definition: XMLWriter.cc:18
std::string dtdName
Definition: XMLWriter.h:74
void printComment(std::string comment)
Definition: XMLWriter.cc:87
std::string normalize(std::string s)
Definition: XMLWriter.cc:201
const XML_Char const XML_Char int standalone
Definition: expat.h:187
std::string normalizeText(std::string s)
Definition: XMLWriter.cc:247
void println(std::string text)
Definition: XMLWriter.cc:102
const XML_Char * s
Definition: expat.h:262
void referToDTD(std::string name, std::string pid, std::string ref)
Definition: XMLWriter.cc:54
std::map< std::string, std::string > attributes
Definition: XMLWriter.h:75
const XML_Char int const XML_Char * value
Definition: expat.h:331
long long int64
Definition: config.h:31
void setAttribute(std::string name, char *value)
Definition: XMLWriter.cc:137
void openTag(std::string ns, std::string name)
Definition: XMLWriter.h:54
void printPlain(std::string text)
Definition: XMLWriter.cc:94
void printAttributes(int tagLength)
Definition: XMLWriter.cc:176
const XML_Char * version
Definition: expat.h:187
void checkNameValid(std::string s)
Definition: XMLWriter.cc:280
IndentPrintWriter * writer
Definition: XMLWriter.h:71
void setAttribute(std::string ns, std::string name, std::string value)
Definition: XMLWriter.h:60
void closeDoc(bool force=false)
Definition: XMLWriter.cc:70
void openDoc(std::string version="1.0", std::string encoding="", bool standalone=false)
Definition: XMLWriter.cc:36
void setAttribute(std::string ns, std::string name, double value)
Definition: XMLWriter.h:63
void printTag(std::string name)
Definition: XMLWriter.cc:130
#define ns
Definition: xmlparse.cc:614