Import Geant4 11.4.0 source tree
This commit is contained in:
+2
-61
@@ -4,15 +4,12 @@
|
||||
#ifndef tools_xml_element
|
||||
#define tools_xml_element
|
||||
|
||||
// This is only needed to satisfy a use in source/analysis/hntools/src/G4PlotManager.cc
|
||||
#include "../srep"
|
||||
|
||||
#include "../sto"
|
||||
#include "../scast"
|
||||
|
||||
#ifdef TOOLS_MEM
|
||||
#include "../mem"
|
||||
#include "../S_STRING"
|
||||
#endif
|
||||
|
||||
namespace tools {
|
||||
namespace xml {
|
||||
|
||||
@@ -24,9 +21,6 @@ public:
|
||||
};
|
||||
|
||||
class element : public virtual ielem {
|
||||
#ifdef TOOLS_MEM
|
||||
TOOLS_SCLASS(tools::xml::element)
|
||||
#endif
|
||||
public:
|
||||
static cid id_class() {return 0;}
|
||||
virtual void* cast(cid a_class) const {
|
||||
@@ -39,24 +33,15 @@ public:
|
||||
element(const std::string& a_name,
|
||||
const std::vector<atb>& a_atbs,
|
||||
const std::string& a_value){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
m_name = a_name;
|
||||
m_atbs = a_atbs;
|
||||
m_value = a_value;
|
||||
}
|
||||
virtual ~element(){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
element(const element& a_from)
|
||||
:ielem(a_from) {
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
m_name = a_from.m_name;
|
||||
m_atbs = a_from.m_atbs;
|
||||
m_value = a_from.m_value;
|
||||
@@ -72,18 +57,6 @@ public:
|
||||
const std::vector<atb>& attributes() const {return m_atbs;}
|
||||
const std::string& value() const {return m_value;}
|
||||
|
||||
void set_value(const std::string& a_value) {m_value = a_value;}
|
||||
bool is_attribute(const std::string& a_name) const {
|
||||
tools_vforcit(atb,m_atbs,it) {
|
||||
if((*it).first==a_name) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void add_attribute(const std::string& a_name,const std::string& a_value){
|
||||
// No check is done about an existing a_name.
|
||||
m_atbs.push_back(atb(a_name,a_value));
|
||||
}
|
||||
|
||||
bool attribute_value(const std::string& a_atb,std::string& a_value) const {
|
||||
tools_vforcit(atb,m_atbs,it) {
|
||||
if((*it).first==a_atb) {
|
||||
@@ -102,38 +75,6 @@ public:
|
||||
return to<T>(sv,a_value);
|
||||
}
|
||||
|
||||
|
||||
bool set_attribute_value(const std::string& a_atb,const std::string& a_value) {
|
||||
tools_vforit(atb,m_atbs,it) {
|
||||
if((*it).first==a_atb) {
|
||||
(*it).second = a_value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Not found, add one :
|
||||
m_atbs.push_back(atb(a_atb,a_value));
|
||||
return true;
|
||||
}
|
||||
|
||||
void remove_attributes(const std::string& a_atb) {
|
||||
std::vector<atb>::iterator it;
|
||||
for(it=m_atbs.begin();it!=m_atbs.end();) {
|
||||
if((*it).first==a_atb) {
|
||||
it = m_atbs.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void replace(const std::string& a_old,const std::string& a_new) {
|
||||
// Used by the obuild template system.
|
||||
tools_vforit(atb,m_atbs,it) {
|
||||
replace_((*it).second,a_old,a_new);
|
||||
}
|
||||
replace_(m_value,a_old,a_new);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string m_name;
|
||||
std::vector<atb> m_atbs;
|
||||
|
||||
Reference in New Issue
Block a user