Logo ROOT   6.12/07
Reference Guide
TXMLSetup.h
Go to the documentation of this file.
1 // @(#)root/xml:$Id$
2 // Author: Sergey Linev 10.05.2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TXMLSetup
13 #define ROOT_TXMLSetup
14 
15 #include "TObject.h"
16 #include "TString.h"
17 
18 #ifdef Bool
19 #undef Bool
20 #endif
21 #ifdef True
22 #undef True
23 #endif
24 #ifdef False
25 #undef False
26 #endif
27 
28 namespace xmlio {
29 extern const char *Root;
30 extern const char *Setup;
31 extern const char *ClassVersion;
32 extern const char *IOVersion;
33 extern const char *OnlyVersion;
34 extern const char *Ptr;
35 extern const char *Ref;
36 extern const char *Null;
37 extern const char *IdBase;
38 extern const char *Size;
39 extern const char *Xmlobject;
40 extern const char *Xmlkey;
41 extern const char *Cycle;
42 extern const char *XmlBlock;
43 extern const char *Zip;
44 extern const char *Object;
45 extern const char *ObjClass;
46 extern const char *Class;
47 extern const char *Member;
48 extern const char *Item;
49 extern const char *Name;
50 extern const char *Title;
51 extern const char *CreateTm;
52 extern const char *ModifyTm;
53 extern const char *ObjectUUID;
54 extern const char *Type;
55 extern const char *Value;
56 extern const char *v;
57 extern const char *cnt;
58 extern const char *True;
59 extern const char *False;
60 extern const char *SInfos;
61 
62 extern const char *Array;
63 extern const char *Bool;
64 extern const char *Char;
65 extern const char *Short;
66 extern const char *Int;
67 extern const char *Long;
68 extern const char *Long64;
69 extern const char *Float;
70 extern const char *Double;
71 extern const char *UChar;
72 extern const char *UShort;
73 extern const char *UInt;
74 extern const char *ULong;
75 extern const char *ULong64;
76 extern const char *String;
77 extern const char *CharStar;
78 }
79 
80 class TStreamerElement;
81 
82 class TXMLSetup {
83 public:
84  enum EXMLLayout { kSpecialized = 2, kGeneralized = 3 };
85 
86  TXMLSetup();
87  TXMLSetup(const char *opt);
88  TXMLSetup(const TXMLSetup &src);
89  virtual ~TXMLSetup();
90 
91  TString GetSetupAsString();
92 
93  void PrintSetup();
94 
95  EXMLLayout GetXmlLayout() const { return fXmlLayout; }
96  Bool_t IsStoreStreamerInfos() const { return fStoreStreamerInfos; }
97  Bool_t IsUseDtd() const { return fUseDtd; }
98  Bool_t IsUseNamespaces() const { return fUseNamespaces; }
99 
100  virtual void SetXmlLayout(EXMLLayout layout) { fXmlLayout = layout; }
101  virtual void SetStoreStreamerInfos(Bool_t iConvert = kTRUE) { fStoreStreamerInfos = iConvert; }
102  virtual void SetUsedDtd(Bool_t use = kTRUE) { fUseDtd = use; }
103  virtual void SetUseNamespaces(Bool_t iUseNamespaces = kTRUE) { fUseNamespaces = iUseNamespaces; }
104 
105  const char *XmlConvertClassName(const char *name);
106  const char *XmlClassNameSpaceRef(const TClass *cl);
107  const char *XmlGetElementName(const TStreamerElement *el);
108 
109  Int_t GetNextRefCounter() { return fRefCounter++; }
110 
111  static TString DefaultXmlSetup();
112  static void SetNameSpaceBase(const char *namespacebase);
113 
114 protected:
115  TClass *XmlDefineClass(const char *xmlClassName);
116  const char *GetElItemName(TStreamerElement *el);
117 
118  Bool_t IsValidXmlSetup(const char *setupstr);
119  Bool_t ReadSetupFromStr(const char *setupstr);
120 
121  Int_t AtoI(const char *sbuf, Int_t def = 0, const char *errinfo = 0);
122 
127 
128  Int_t fRefCounter; //! counter , used to build id of xml references
129 
130  TString fStrBuf; //! buffer, used in XmlDefineClass() function
131 
133 
134  ClassDef(TXMLSetup, 1) // settings to be stored in XML files
135 };
136 
137 #endif
const char * ULong
Definition: TXMLSetup.cxx:91
Int_t fRefCounter
Definition: TXMLSetup.h:128
const char * Object
Definition: TXMLSetup.cxx:61
const char * Long64
Definition: TXMLSetup.cxx:85
const char * XmlBlock
Definition: TXMLSetup.cxx:59
const char * UInt
Definition: TXMLSetup.cxx:90
const char * Ref
Definition: TXMLSetup.cxx:52
const char * ObjClass
Definition: TXMLSetup.cxx:62
const char * ModifyTm
Definition: TXMLSetup.cxx:69
const char * Double
Definition: TXMLSetup.cxx:87
const char * Title
Definition: TXMLSetup.cxx:67
const char * Size
Definition: TXMLSetup.cxx:55
EXMLLayout GetXmlLayout() const
Definition: TXMLSetup.h:95
const char * v
Definition: TXMLSetup.cxx:73
const char * ULong64
Definition: TXMLSetup.cxx:92
Basic string class.
Definition: TString.h:125
const char * Setup
Definition: TXMLSetup.cxx:47
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const char * Item
Definition: TXMLSetup.cxx:65
const char * Class
Definition: TXMLSetup.cxx:63
const char * False
Definition: TXMLSetup.cxx:76
const char * Type
Definition: TXMLSetup.cxx:71
const char * Name
Definition: TXMLSetup.cxx:66
const char * String
Definition: TXMLSetup.cxx:93
const char * Float
Definition: TXMLSetup.cxx:86
#define ClassDef(name, id)
Definition: Rtypes.h:320
const char * UChar
Definition: TXMLSetup.cxx:88
const char * Char
Definition: TXMLSetup.cxx:81
const char * Cycle
Definition: TXMLSetup.cxx:58
const char * Xmlkey
Definition: TXMLSetup.cxx:57
virtual void SetUsedDtd(Bool_t use=kTRUE)
Definition: TXMLSetup.h:102
TString fStrBuf
counter , used to build id of xml references
Definition: TXMLSetup.h:130
const char * CreateTm
Definition: TXMLSetup.cxx:68
const char * Array
Definition: TXMLSetup.cxx:79
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
Int_t GetNextRefCounter()
Definition: TXMLSetup.h:109
Bool_t fStoreStreamerInfos
Definition: TXMLSetup.h:124
Bool_t IsUseNamespaces() const
Definition: TXMLSetup.h:98
const char * Ptr
Definition: TXMLSetup.cxx:51
const char * Root
Definition: TXMLSetup.cxx:46
const char * IOVersion
Definition: TXMLSetup.cxx:49
const char * ObjectUUID
Definition: TXMLSetup.cxx:70
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
Definition: TXMLSetup.h:101
const char * Null
Definition: TXMLSetup.cxx:53
Bool_t fUseDtd
Definition: TXMLSetup.h:125
const char * CharStar
Definition: TXMLSetup.cxx:94
static TString fgNameSpaceBase
buffer, used in XmlDefineClass() function
Definition: TXMLSetup.h:132
const char * Member
Definition: TXMLSetup.cxx:64
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
Definition: TXMLSetup.h:103
const char * Int
Definition: TXMLSetup.cxx:83
Bool_t IsStoreStreamerInfos() const
Definition: TXMLSetup.h:96
EXMLLayout fXmlLayout
Definition: TXMLSetup.h:123
const char * Short
Definition: TXMLSetup.cxx:82
const char * OnlyVersion
Definition: TXMLSetup.cxx:50
Bool_t IsUseDtd() const
Definition: TXMLSetup.h:97
const char * ClassVersion
Definition: TXMLSetup.cxx:48
const char * True
Definition: TXMLSetup.cxx:75
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char * UShort
Definition: TXMLSetup.cxx:89
virtual void SetXmlLayout(EXMLLayout layout)
Definition: TXMLSetup.h:100
const char * SInfos
Definition: TXMLSetup.cxx:77
const char * IdBase
Definition: TXMLSetup.cxx:54
const char * Zip
Definition: TXMLSetup.cxx:60
char name[80]
Definition: TGX11.cxx:109
const char * cnt
Definition: TXMLSetup.cxx:74
const char * Xmlobject
Definition: TXMLSetup.cxx:56
const char * Long
Definition: TXMLSetup.cxx:84
const char * Value
Definition: TXMLSetup.cxx:72
const char * Bool
Definition: TXMLSetup.cxx:80
Bool_t fUseNamespaces
Definition: TXMLSetup.h:126