]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGen/EvtGenBase/EvtParserXml.hh
Fix for definitions for CINT
[u/mrichter/AliRoot.git] / TEvtGen / EvtGen / EvtGenBase / EvtParserXml.hh
1 //--------------------------------------------------------------------------
2 //
3 // Environment:
4 //      This software is part of the EvtGen package developed jointly
5 //      for the BaBar and CLEO collaborations.  If you use all or part
6 //      of it, please give an appropriate acknowledgement.
7 //
8 // Copyright Information: See EvtGen/COPYRIGHT
9 //      Copyright (C) 1998      Caltech, UCSB
10 //
11 // Module: EvtGen/EvtParserXml.hh
12 //
13 // Description:
14 //
15 // Modification history:
16 //
17 //    DCC     24 October, 2011         Module created
18 //
19 //------------------------------------------------------------------------
20
21 #ifndef EVTPARSERXML_HH
22 #define EVTPARSERXML_HH
23
24 #include <string>
25 #include <vector>
26
27 #include <fstream>
28
29 class EvtParserXml {
30 public:
31   EvtParserXml();
32   ~EvtParserXml();
33
34   bool open(std::string filename);
35   bool close();
36
37   bool readNextTag();
38
39   std::string getTagTitle() { return _tagTitle; }
40   std::string getParentTagTitle();
41   int getLineNumber() { return _lineNo; }
42   bool isTagInline() { return _inLineTag; }
43   
44   std::string readAttribute(std::string attribute, std::string defaultValue="");
45   bool readAttributeBool(std::string attribute, bool defaultValue=false);
46   int readAttributeInt(std::string attribute, int defaultValue=-1);
47   double readAttributeDouble(std::string attribute, double defaultValue=-1.);
48
49 private:
50
51   std::ifstream _fin;
52   std::string _line;
53   int _lineNo;
54
55   std::string _tag;
56   std::string _tagTitle;
57   bool _inLineTag;
58   std::vector<std::string> _tagTree;
59
60   bool processTagTree();
61
62   bool expandEnvVars(std::string& str);
63   bool isAlphaNum(char c);
64 }; 
65
66 #endif
67