Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/xml:$Id$
2// Author: Sergey Linev 10.05.2004
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 *************************************************************************/
12#ifndef ROOT_TXMLSetup
13#define ROOT_TXMLSetup
15#include "TObject.h"
16#include "TString.h"
18#ifdef Bool
19#undef Bool
21#ifdef True
22#undef True
24#ifdef False
25#undef False
28namespace xmlio {
29extern const char *Root;
30extern const char *Setup;
31extern const char *ClassVersion;
32extern const char *IOVersion;
33extern const char *OnlyVersion;
34extern const char *Ptr;
35extern const char *Ref;
36extern const char *Null;
37extern const char *IdBase;
38extern const char *Size;
39extern const char *Xmlobject;
40extern const char *Xmlkey;
41extern const char *Cycle;
42extern const char *XmlBlock;
43extern const char *Zip;
44extern const char *Object;
45extern const char *ObjClass;
46extern const char *Class;
47extern const char *Member;
48extern const char *Item;
49extern const char *Name;
50extern const char *Title;
51extern const char *CreateTm;
52extern const char *ModifyTm;
53extern const char *ObjectUUID;
54extern const char *Type;
55extern const char *Value;
56extern const char *v;
57extern const char *cnt;
58extern const char *True;
59extern const char *False;
60extern const char *SInfos;
62extern const char *Array;
63extern const char *Bool;
64extern const char *Char;
65extern const char *Short;
66extern const char *Int;
67extern const char *Long;
68extern const char *Long64;
69extern const char *Float;
70extern const char *Double;
71extern const char *UChar;
72extern const char *UShort;
73extern const char *UInt;
74extern const char *ULong;
75extern const char *ULong64;
76extern const char *String;
77extern const char *CharStar;
82class TXMLSetup {
86 TXMLSetup() = default;
87 TXMLSetup(const char *opt);
88 TXMLSetup(const TXMLSetup &src);
89 virtual ~TXMLSetup() = default;
91 TXMLSetup &operator=(const TXMLSetup &rhs);
95 void PrintSetup();
99 Bool_t IsUseDtd() const { return fUseDtd; }
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; }
107 const char *XmlConvertClassName(const char *name);
108 const char *XmlClassNameSpaceRef(const TClass *cl);
109 const char *XmlGetElementName(const TStreamerElement *el);
113 static TString DefaultXmlSetup();
114 static void SetNameSpaceBase(const char *namespacebase);
117 TClass *XmlDefineClass(const char *xmlClassName);
118 const char *GetElItemName(TStreamerElement *el);
120 Bool_t IsValidXmlSetup(const char *setupstr);
121 Bool_t ReadSetupFromStr(const char *setupstr);
123 Int_t AtoI(const char *sbuf, Int_t def = 0, const char *errinfo = nullptr);
130 Int_t fRefCounter{0}; //! counter , used to build id of xml references
132 TString fStrBuf; //! buffer, used in XmlDefineClass() function
136 ClassDef(TXMLSetup, 1) // settings to be stored in XML files
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
Basic string class.
Definition: TString.h:131
virtual void SetUsedDtd(Bool_t use=kTRUE)
Definition: TXMLSetup.h:104
Bool_t fUseNamespaces
Definition: TXMLSetup.h:128
TClass * XmlDefineClass(const char *xmlClassName)
define class for the converted class name, where special symbols were replaced by '_'
Definition: TXMLSetup.cxx:264
const char * XmlClassNameSpaceRef(const TClass *cl)
produce string which used as reference in class namespace definition
Definition: TXMLSetup.cxx:224
EXMLLayout GetXmlLayout() const
Definition: TXMLSetup.h:97
static void SetNameSpaceBase(const char *namespacebase)
set namespace base
Definition: TXMLSetup.cxx:110
virtual void SetUseNamespaces(Bool_t iUseNamespaces=kTRUE)
Definition: TXMLSetup.h:105
Bool_t fUseDtd
Definition: TXMLSetup.h:127
const char * XmlConvertClassName(const char *name)
convert class name to exclude any special symbols like ':', '<' '>' ',' and spaces
Definition: TXMLSetup.cxx:210
TString GetSetupAsString()
return setup values as string
Definition: TXMLSetup.cxx:147
Bool_t IsValidXmlSetup(const char *setupstr)
checks if string is valid setup
Definition: TXMLSetup.cxx:162
Bool_t ReadSetupFromStr(const char *setupstr)
get values from string
Definition: TXMLSetup.cxx:179
const char * GetElItemName(TStreamerElement *el)
get item name for given element
Definition: TXMLSetup.cxx:251
Int_t AtoI(const char *sbuf, Int_t def=0, const char *errinfo=nullptr)
converts string to integer.
Definition: TXMLSetup.cxx:283
Bool_t IsStoreStreamerInfos() const
Definition: TXMLSetup.h:98
static TString DefaultXmlSetup()
return default value for XML setup
Definition: TXMLSetup.cxx:102
const char * XmlGetElementName(const TStreamerElement *el)
return converted name for TStreamerElement
Definition: TXMLSetup.cxx:237
Bool_t IsUseDtd() const
Definition: TXMLSetup.h:99
EXMLLayout fXmlLayout
Definition: TXMLSetup.h:125
Int_t GetNextRefCounter()
Definition: TXMLSetup.h:111
Bool_t fStoreStreamerInfos
Definition: TXMLSetup.h:126
Int_t fRefCounter
Definition: TXMLSetup.h:130
static TString fgNameSpaceBase
buffer, used in XmlDefineClass() function
Definition: TXMLSetup.h:134
virtual ~TXMLSetup()=default
TString fStrBuf
counter , used to build id of xml references
Definition: TXMLSetup.h:132
Bool_t IsUseNamespaces() const
Definition: TXMLSetup.h:100
void PrintSetup()
show setup values
Definition: TXMLSetup.cxx:198
virtual void SetStoreStreamerInfos(Bool_t iConvert=kTRUE)
Definition: TXMLSetup.h:103
@ kSpecialized
Definition: TXMLSetup.h:84
@ kGeneralized
Definition: TXMLSetup.h:84
TXMLSetup & operator=(const TXMLSetup &rhs)
assign operator
Definition: TXMLSetup.cxx:135
virtual void SetXmlLayout(EXMLLayout layout)
Definition: TXMLSetup.h:102
const char * UChar
Definition: TXMLSetup.cxx:88
const char * Root
Definition: TXMLSetup.cxx:46
const char * Ptr
Definition: TXMLSetup.cxx:51
const char * Name
Definition: TXMLSetup.cxx:66
const char * SInfos
Definition: TXMLSetup.cxx:77
const char * IOVersion
Definition: TXMLSetup.cxx:49
const char * v
Definition: TXMLSetup.cxx:73
const char * Bool
Definition: TXMLSetup.cxx:80
const char * Xmlobject
Definition: TXMLSetup.cxx:56
const char * Long64
Definition: TXMLSetup.cxx:85
const char * ModifyTm
Definition: TXMLSetup.cxx:69
const char * False
Definition: TXMLSetup.cxx:76
const char * True
Definition: TXMLSetup.cxx:75
const char * Int
Definition: TXMLSetup.cxx:83
const char * ULong64
Definition: TXMLSetup.cxx:92
const char * Member
Definition: TXMLSetup.cxx:64
const char * OnlyVersion
Definition: TXMLSetup.cxx:50
const char * Long
Definition: TXMLSetup.cxx:84
const char * Title
Definition: TXMLSetup.cxx:67
const char * Float
Definition: TXMLSetup.cxx:86
const char * Value
Definition: TXMLSetup.cxx:72
const char * Array
Definition: TXMLSetup.cxx:79
const char * ClassVersion
Definition: TXMLSetup.cxx:48
const char * String
Definition: TXMLSetup.cxx:93
const char * Double
Definition: TXMLSetup.cxx:87
const char * Object
Definition: TXMLSetup.cxx:61
const char * Ref
Definition: TXMLSetup.cxx:52
const char * cnt
Definition: TXMLSetup.cxx:74
const char * IdBase
Definition: TXMLSetup.cxx:54
const char * Size
Definition: TXMLSetup.cxx:55
const char * XmlBlock
Definition: TXMLSetup.cxx:59
const char * Cycle
Definition: TXMLSetup.cxx:58
const char * Type
Definition: TXMLSetup.cxx:71
const char * Null
Definition: TXMLSetup.cxx:53
const char * Char
Definition: TXMLSetup.cxx:81
const char * UShort
Definition: TXMLSetup.cxx:89
const char * CharStar
Definition: TXMLSetup.cxx:94
const char * UInt
Definition: TXMLSetup.cxx:90
const char * ULong
Definition: TXMLSetup.cxx:91
const char * CreateTm
Definition: TXMLSetup.cxx:68
const char * Class
Definition: TXMLSetup.cxx:63
const char * ObjClass
Definition: TXMLSetup.cxx:62
const char * Short
Definition: TXMLSetup.cxx:82
const char * Zip
Definition: TXMLSetup.cxx:60
const char * Setup
Definition: TXMLSetup.cxx:47
const char * ObjectUUID
Definition: TXMLSetup.cxx:70
const char * Xmlkey
Definition: TXMLSetup.cxx:57
const char * Item
Definition: TXMLSetup.cxx:65