EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtParserXml.hh
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
21#ifndef EVTPARSERXML_HH
22#define EVTPARSERXML_HH
23
24#include <fstream>
25#include <string>
26#include <vector>
27
28class EvtParserXml final {
29 public:
30 bool open( std::string filename );
31 bool close();
32
33 bool readNextTag();
34
35 std::string getTagTitle() { return m_tagTitle; }
36 std::string getParentTagTitle();
37 int getLineNumber() { return m_lineNo; }
38 bool isTagInline() { return m_inLineTag; }
39
40 std::string readAttribute( std::string attribute,
41 std::string defaultValue = "" );
42 bool readAttributeBool( std::string attribute, bool defaultValue = false );
43 int readAttributeInt( std::string attribute, int defaultValue = -1 );
44 double readAttributeDouble( std::string attribute, double defaultValue = -1. );
45
46 private:
47 std::ifstream m_fin;
48 std::string m_line;
49 int m_lineNo = 0;
50
51 std::string m_tag;
52 std::string m_tagTitle;
54 std::vector<std::string> m_tagTree;
55
56 bool processTagTree();
57
58 bool expandEnvVars( std::string& str );
59 bool isAlphaNum( char c );
60};
61
62#endif
std::string readAttribute(std::string attribute, std::string defaultValue="")
bool processTagTree()
bool open(std::string filename)
int getLineNumber()
bool isAlphaNum(char c)
double readAttributeDouble(std::string attribute, double defaultValue=-1.)
bool readAttributeBool(std::string attribute, bool defaultValue=false)
std::string m_line
std::string m_tag
std::string getParentTagTitle()
std::string getTagTitle()
std::string m_tagTitle
std::vector< std::string > m_tagTree
int readAttributeInt(std::string attribute, int defaultValue=-1)
bool expandEnvVars(std::string &str)
std::ifstream m_fin
bool isTagInline()