Logo ROOT  
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 "Rtypes.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:
85 
86  TXMLSetup() = default;
87  TXMLSetup(const char *opt);
88  TXMLSetup(const TXMLSetup &src);
89  virtual ~TXMLSetup() = default;
90 
91  TXMLSetup &operator=(const TXMLSetup &rhs);
92 
94 
95  void PrintSetup();
96 
97  EXMLLayout GetXmlLayout() const { return fXmlLayout; }
99  Bool_t IsUseDtd() const { return fUseDtd; }
101 
102  virtual void SetXmlLayout(EXMLLayout layout) { fXmlLayout = layout; }
103  virtual void SetStoreStreamerInfos(Bool_t iConvert = kTRUE) { fStoreStreamerInfos = iConvert; }
104  virtual void SetUsedDtd(Bool_t use = kTRUE) { fUseDtd = use; }
105  virtual void SetUseNamespaces(Bool_t iUseNamespaces = kTRUE) { fUseNamespaces = iUseNamespaces; }
106 
107  const char *XmlConvertClassName(const char *name);
108  const char *XmlClassNameSpaceRef(const TClass *cl);
109  const char *XmlGetElementName(const TStreamerElement *el);
110 
112 
113  static TString DefaultXmlSetup();
114  static void SetNameSpaceBase(const char *namespacebase);
115 
116 protected:
117  TClass *XmlDefineClass(const char *xmlClassName);
118  const char *GetElItemName(TStreamerElement *el);
119 
120  Bool_t IsValidXmlSetup(const char *setupstr);
121  Bool_t ReadSetupFromStr(const char *setupstr);
122 
123  Int_t AtoI(const char *sbuf, Int_t def = 0, const char *errinfo = nullptr);
124 
129 
130  Int_t fRefCounter{0}; //! counter , used to build id of xml references
131 
132  TString fStrBuf; //! buffer, used in XmlDefineClass() function
133 
135 
136  ClassDef(TXMLSetup, 1) // settings to be stored in XML files
137 };
138 
139 #endif
TXMLSetup::IsStoreStreamerInfos
Bool_t IsStoreStreamerInfos() const
Definition: TXMLSetup.h:98
xmlio::CreateTm
const char * CreateTm
Definition: TXMLSetup.cxx:69
TXMLSetup::PrintSetup
void PrintSetup()
show setup values
Definition: TXMLSetup.cxx:199
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TXMLSetup::fRefCounter
Int_t fRefCounter
Definition: TXMLSetup.h:130
TXMLSetup::XmlDefineClass
TClass * XmlDefineClass(const char *xmlClassName)
define class for the converted class name, where special symbols were replaced by '_'
Definition: TXMLSetup.cxx:265
TXMLSetup::SetNameSpaceBase
static void SetNameSpaceBase(const char *namespacebase)
set namespace base
Definition: TXMLSetup.cxx:111
xmlio::Float
const char * Float
Definition: TXMLSetup.cxx:87
TXMLSetup::GetNextRefCounter
Int_t GetNextRefCounter()
Definition: TXMLSetup.h:111
xmlio::v
const char * v
Definition: TXMLSetup.cxx:74
xmlio::Zip
const char * Zip
Definition: TXMLSetup.cxx:61
xmlio::ClassVersion
const char * ClassVersion
Definition: TXMLSetup.cxx:49
xmlio
Definition: TXMLSetup.h:28
xmlio::IdBase
const char * IdBase
Definition: TXMLSetup.cxx:55
TXMLSetup::SetUsedDtd
virtual void SetUsedDtd(Bool_t use=kTRUE)
Definition: TXMLSetup.h:104
xmlio::Object
const char * Object
Definition: TXMLSetup.cxx:62
xmlio::Int
const char * Int
Definition: TXMLSetup.cxx:84
xmlio::Class
const char * Class
Definition: TXMLSetup.cxx:64
TXMLSetup::IsUseDtd
Bool_t IsUseDtd() const
Definition: TXMLSetup.h:99
xmlio::ModifyTm
const char * ModifyTm
Definition: TXMLSetup.cxx:70
xmlio::Double
const char * Double
Definition: TXMLSetup.cxx:88
Int_t
int Int_t
Definition: RtypesCore.h:45
xmlio::ObjClass
const char * ObjClass
Definition: TXMLSetup.cxx:63
xmlio::Title
const char * Title
Definition: TXMLSetup.cxx:68
TXMLSetup::fStoreStreamerInfos
Bool_t fStoreStreamerInfos
Definition: TXMLSetup.h:126
xmlio::CharStar
const char * CharStar
Definition: TXMLSetup.cxx:95
TXMLSetup::IsValidXmlSetup
Bool_t IsValidXmlSetup(const char *setupstr)
checks if string is valid setup
Definition: TXMLSetup.cxx:163
xmlio::Xmlobject
const char * Xmlobject
Definition: TXMLSetup.cxx:57
xmlio::Bool
const char * Bool
Definition: TXMLSetup.cxx:81
TString
Basic string class.
Definition: TString.h:136
xmlio::Item
const char * Item
Definition: TXMLSetup.cxx:66
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TXMLSetup
Definition: TXMLSetup.h:82
TXMLSetup::~TXMLSetup
virtual ~TXMLSetup()=default
xmlio::Long64
const char * Long64
Definition: TXMLSetup.cxx:86
TString.h
TXMLSetup::SetUseNamespaces
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
Definition: TXMLSetup.h:105
bool
TXMLSetup::XmlClassNameSpaceRef
const char * XmlClassNameSpaceRef(const TClass *cl)
produce string which used as reference in class namespace definition
Definition: TXMLSetup.cxx:225
TXMLSetup::SetStoreStreamerInfos
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
Definition: TXMLSetup.h:103
xmlio::Xmlkey
const char * Xmlkey
Definition: TXMLSetup.cxx:58
TXMLSetup::XmlGetElementName
const char * XmlGetElementName(const TStreamerElement *el)
return converted name for TStreamerElement
Definition: TXMLSetup.cxx:238
xmlio::Root
const char * Root
Definition: TXMLSetup.cxx:47
xmlio::ObjectUUID
const char * ObjectUUID
Definition: TXMLSetup.cxx:71
TXMLSetup::DefaultXmlSetup
static TString DefaultXmlSetup()
return default value for XML setup
Definition: TXMLSetup.cxx:103
TXMLSetup::operator=
TXMLSetup & operator=(const TXMLSetup &rhs)
assign operator
Definition: TXMLSetup.cxx:136
TXMLSetup::IsUseNamespaces
Bool_t IsUseNamespaces() const
Definition: TXMLSetup.h:100
TXMLSetup::GetSetupAsString
TString GetSetupAsString()
return setup values as string
Definition: TXMLSetup.cxx:148
TXMLSetup::kGeneralized
@ kGeneralized
Definition: TXMLSetup.h:84
xmlio::IOVersion
const char * IOVersion
Definition: TXMLSetup.cxx:50
TXMLSetup::fXmlLayout
EXMLLayout fXmlLayout
Definition: TXMLSetup.h:125
xmlio::UShort
const char * UShort
Definition: TXMLSetup.cxx:90
xmlio::Value
const char * Value
Definition: TXMLSetup.cxx:73
xmlio::ULong
const char * ULong
Definition: TXMLSetup.cxx:92
xmlio::Char
const char * Char
Definition: TXMLSetup.cxx:82
TXMLSetup::fUseNamespaces
Bool_t fUseNamespaces
Definition: TXMLSetup.h:128
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
xmlio::XmlBlock
const char * XmlBlock
Definition: TXMLSetup.cxx:60
xmlio::Short
const char * Short
Definition: TXMLSetup.cxx:83
xmlio::String
const char * String
Definition: TXMLSetup.cxx:94
TXMLSetup::XmlConvertClassName
const char * XmlConvertClassName(const char *name)
convert class name to exclude any special symbols like ':', '<' '>' ',' and spaces
Definition: TXMLSetup.cxx:211
TXMLSetup::fUseDtd
Bool_t fUseDtd
Definition: TXMLSetup.h:127
xmlio::Member
const char * Member
Definition: TXMLSetup.cxx:65
xmlio::UInt
const char * UInt
Definition: TXMLSetup.cxx:91
xmlio::Null
const char * Null
Definition: TXMLSetup.cxx:54
xmlio::Size
const char * Size
Definition: TXMLSetup.cxx:56
xmlio::OnlyVersion
const char * OnlyVersion
Definition: TXMLSetup.cxx:51
TXMLSetup::fStrBuf
TString fStrBuf
counter , used to build id of xml references
Definition: TXMLSetup.h:132
xmlio::Name
const char * Name
Definition: TXMLSetup.cxx:67
TXMLSetup::kSpecialized
@ kSpecialized
Definition: TXMLSetup.h:84
TXMLSetup::SetXmlLayout
virtual void SetXmlLayout(EXMLLayout layout)
Definition: TXMLSetup.h:102
TXMLSetup::ReadSetupFromStr
Bool_t ReadSetupFromStr(const char *setupstr)
get values from string
Definition: TXMLSetup.cxx:180
TXMLSetup::GetXmlLayout
EXMLLayout GetXmlLayout() const
Definition: TXMLSetup.h:97
xmlio::SInfos
const char * SInfos
Definition: TXMLSetup.cxx:78
TXMLSetup::fgNameSpaceBase
static TString fgNameSpaceBase
buffer, used in XmlDefineClass() function
Definition: TXMLSetup.h:134
xmlio::Type
const char * Type
Definition: TXMLSetup.cxx:72
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TXMLSetup::GetElItemName
const char * GetElItemName(TStreamerElement *el)
get item name for given element
Definition: TXMLSetup.cxx:252
TXMLSetup::EXMLLayout
EXMLLayout
Definition: TXMLSetup.h:84
xmlio::Setup
const char * Setup
Definition: TXMLSetup.cxx:48
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
xmlio::Ptr
const char * Ptr
Definition: TXMLSetup.cxx:52
name
char name[80]
Definition: TGX11.cxx:110
xmlio::ULong64
const char * ULong64
Definition: TXMLSetup.cxx:93
xmlio::Ref
const char * Ref
Definition: TXMLSetup.cxx:53
xmlio::Array
const char * Array
Definition: TXMLSetup.cxx:80
xmlio::UChar
const char * UChar
Definition: TXMLSetup.cxx:89
xmlio::cnt
const char * cnt
Definition: TXMLSetup.cxx:75
xmlio::True
const char * True
Definition: TXMLSetup.cxx:76
xmlio::Long
const char * Long
Definition: TXMLSetup.cxx:85
Rtypes.h
TStreamerElement
Definition: TStreamerElement.h:33
xmlio::False
const char * False
Definition: TXMLSetup.cxx:77
xmlio::Cycle
const char * Cycle
Definition: TXMLSetup.cxx:59
TXMLSetup::TXMLSetup
TXMLSetup()=default
int
TXMLSetup::AtoI
Int_t AtoI(const char *sbuf, Int_t def=0, const char *errinfo=nullptr)
converts string to integer.
Definition: TXMLSetup.cxx:284