ROOT logo
// @(#)root/xml:$Id$
// Author: Sergey Linev  10.05.2004

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TXMLSetup
#define ROOT_TXMLSetup

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif

namespace xmlio {
   extern const char* Root;
   extern const char* Setup;
   extern const char* ClassVersion;
   extern const char* IOVersion;
   extern const char* OnlyVersion;
   extern const char* Ptr;
   extern const char* Ref;
   extern const char* Null;
   extern const char* IdBase;
   extern const char* Size;
   extern const char* Xmlobject;
   extern const char* Xmlkey;
   extern const char* Cycle;
   extern const char* XmlBlock;
   extern const char* Zip;
   extern const char* Object;
   extern const char* ObjClass;
   extern const char* Class;
   extern const char* Member;
   extern const char* Item;
   extern const char* Name;
   extern const char* Title;
   extern const char* CreateTm;
   extern const char* ModifyTm;
   extern const char* ObjectUUID;
   extern const char* Type;
   extern const char* Value;
   extern const char* v;
   extern const char* cnt;
   extern const char* True;
   extern const char* False;
   extern const char* SInfos;
    
   extern const char* Array;
   extern const char* Bool;
   extern const char* Char;
   extern const char* Short;
   extern const char* Int;
   extern const char* Long;
   extern const char* Long64;
   extern const char* Float;
   extern const char* Double;
   extern const char* UChar;
   extern const char* UShort;
   extern const char* UInt;
   extern const char* ULong;
   extern const char* ULong64;
   extern const char* String;
   extern const char* CharStar;
}

class TStreamerElement;

class TXMLSetup {
   public:
      enum EXMLLayout { kSpecialized = 2,
                        kGeneralized = 3 };

      TXMLSetup();
      TXMLSetup(const char* opt);
      TXMLSetup(const TXMLSetup& src);
      virtual ~TXMLSetup();

      TString        GetSetupAsString();

      void           PrintSetup();

      EXMLLayout     GetXmlLayout() const { return fXmlLayout; }
      Bool_t         IsStoreStreamerInfos() const { return fStoreStreamerInfos; }
      Bool_t         IsUseDtd() const { return fUseDtd; }
      Bool_t         IsUseNamespaces() const { return fUseNamespaces; }
      
      virtual void   SetXmlLayout(EXMLLayout layout) { fXmlLayout = layout; }
      virtual void   SetStoreStreamerInfos(Bool_t iConvert = kTRUE) { fStoreStreamerInfos = iConvert; }
      virtual void   SetUsedDtd(Bool_t use = kTRUE) { fUseDtd = use; }
      virtual void   SetUseNamespaces(Bool_t iUseNamespaces = kTRUE) { fUseNamespaces = iUseNamespaces; }

      const char*    XmlConvertClassName(const char* name);
      const char*    XmlClassNameSpaceRef(const TClass* cl);
      const char*    XmlGetElementName(const TStreamerElement* el);
      
      Int_t          GetNextRefCounter() { return fRefCounter++; }
      
      static TString DefaultXmlSetup();
      static void    SetNameSpaceBase(const char* namespacebase);

   protected:

      TClass*        XmlDefineClass(const char* xmlClassName);
      const char*    GetElItemName(TStreamerElement* el);
      
      Bool_t         IsValidXmlSetup(const char* setupstr);
      Bool_t         ReadSetupFromStr(const char* setupstr);

      Int_t          AtoI(const char* sbuf, Int_t def = 0, const char* errinfo = 0);

      EXMLLayout     fXmlLayout;
      Bool_t         fStoreStreamerInfos;
      Bool_t         fUseDtd;
      Bool_t         fUseNamespaces;

      Int_t          fRefCounter;      //!  counter , used to build id of xml references

      TString        fStrBuf;          //!  buffer, used in XmlDefineClass() function
      
      static TString fgNameSpaceBase;   

   ClassDef(TXMLSetup,1) //settings to be stored in XML files
};

#endif
 TXMLSetup.h:1
 TXMLSetup.h:2
 TXMLSetup.h:3
 TXMLSetup.h:4
 TXMLSetup.h:5
 TXMLSetup.h:6
 TXMLSetup.h:7
 TXMLSetup.h:8
 TXMLSetup.h:9
 TXMLSetup.h:10
 TXMLSetup.h:11
 TXMLSetup.h:12
 TXMLSetup.h:13
 TXMLSetup.h:14
 TXMLSetup.h:15
 TXMLSetup.h:16
 TXMLSetup.h:17
 TXMLSetup.h:18
 TXMLSetup.h:19
 TXMLSetup.h:20
 TXMLSetup.h:21
 TXMLSetup.h:22
 TXMLSetup.h:23
 TXMLSetup.h:24
 TXMLSetup.h:25
 TXMLSetup.h:26
 TXMLSetup.h:27
 TXMLSetup.h:28
 TXMLSetup.h:29
 TXMLSetup.h:30
 TXMLSetup.h:31
 TXMLSetup.h:32
 TXMLSetup.h:33
 TXMLSetup.h:34
 TXMLSetup.h:35
 TXMLSetup.h:36
 TXMLSetup.h:37
 TXMLSetup.h:38
 TXMLSetup.h:39
 TXMLSetup.h:40
 TXMLSetup.h:41
 TXMLSetup.h:42
 TXMLSetup.h:43
 TXMLSetup.h:44
 TXMLSetup.h:45
 TXMLSetup.h:46
 TXMLSetup.h:47
 TXMLSetup.h:48
 TXMLSetup.h:49
 TXMLSetup.h:50
 TXMLSetup.h:51
 TXMLSetup.h:52
 TXMLSetup.h:53
 TXMLSetup.h:54
 TXMLSetup.h:55
 TXMLSetup.h:56
 TXMLSetup.h:57
 TXMLSetup.h:58
 TXMLSetup.h:59
 TXMLSetup.h:60
 TXMLSetup.h:61
 TXMLSetup.h:62
 TXMLSetup.h:63
 TXMLSetup.h:64
 TXMLSetup.h:65
 TXMLSetup.h:66
 TXMLSetup.h:67
 TXMLSetup.h:68
 TXMLSetup.h:69
 TXMLSetup.h:70
 TXMLSetup.h:71
 TXMLSetup.h:72
 TXMLSetup.h:73
 TXMLSetup.h:74
 TXMLSetup.h:75
 TXMLSetup.h:76
 TXMLSetup.h:77
 TXMLSetup.h:78
 TXMLSetup.h:79
 TXMLSetup.h:80
 TXMLSetup.h:81
 TXMLSetup.h:82
 TXMLSetup.h:83
 TXMLSetup.h:84
 TXMLSetup.h:85
 TXMLSetup.h:86
 TXMLSetup.h:87
 TXMLSetup.h:88
 TXMLSetup.h:89
 TXMLSetup.h:90
 TXMLSetup.h:91
 TXMLSetup.h:92
 TXMLSetup.h:93
 TXMLSetup.h:94
 TXMLSetup.h:95
 TXMLSetup.h:96
 TXMLSetup.h:97
 TXMLSetup.h:98
 TXMLSetup.h:99
 TXMLSetup.h:100
 TXMLSetup.h:101
 TXMLSetup.h:102
 TXMLSetup.h:103
 TXMLSetup.h:104
 TXMLSetup.h:105
 TXMLSetup.h:106
 TXMLSetup.h:107
 TXMLSetup.h:108
 TXMLSetup.h:109
 TXMLSetup.h:110
 TXMLSetup.h:111
 TXMLSetup.h:112
 TXMLSetup.h:113
 TXMLSetup.h:114
 TXMLSetup.h:115
 TXMLSetup.h:116
 TXMLSetup.h:117
 TXMLSetup.h:118
 TXMLSetup.h:119
 TXMLSetup.h:120
 TXMLSetup.h:121
 TXMLSetup.h:122
 TXMLSetup.h:123
 TXMLSetup.h:124
 TXMLSetup.h:125
 TXMLSetup.h:126
 TXMLSetup.h:127
 TXMLSetup.h:128
 TXMLSetup.h:129
 TXMLSetup.h:130
 TXMLSetup.h:131
 TXMLSetup.h:132
 TXMLSetup.h:133