11 #include <boost/format.hpp>
15 bool gp::PropertyValue::IsSimple()
const {
16 return boost::get<std::string>(&value_) != NULL;
19 bool gp::PropertyValue::IsVector()
const {
20 return boost::get<std::vector<std::string> >(&value_) != NULL;
23 bool gp::PropertyValue::IsMap()
const {
24 return boost::get<std::map<std::string, std::string> >(&value_) != NULL;
30 if (IsSimple() || IsReference()) {
31 throw PropertyValueException::WrongLValue();
36 boost::get<VectorOfStrings>(value_).push_back(
37 boost::get<std::string>(right.
value_));
42 for (
const auto&
item : boost::get<VectorOfStrings>(right.
value_)) {
47 throw PropertyValueException::WrongRValue();
52 throw PropertyValueException::WrongRValue();
56 for (
const auto&
item : rmap) {
64 const gp::PropertyValue
72 if (IsSimple() || IsReference()) {
73 throw PropertyValueException::WrongLValue();
79 vec.erase(std::find(vec.begin(), vec.end(), right.
String()));
85 for (
const auto&
item : rvec) {
86 vec.erase(std::find(vec.begin(), vec.end(),
item));
90 throw PropertyValueException::WrongRValue();
102 for (
const auto&
item : rvec) {
107 throw PropertyValueException::WrongRValue();
109 throw PropertyValueException::WrongLValue();
112 const gp::PropertyValue
117 std::string gp::PropertyValue::ToString()
const {
119 const std::vector<std::string>*
120 value = boost::get<std::vector<std::string> >(&value_);
121 assert(value != NULL);
122 if (value->at(0) !=
"") {
123 return "@"+value->at(0)+
"."+value->at(1);
125 return "@"+value->at(0);
128 if (
const std::string*
value = boost::get<std::string>(&value_)) {
130 }
else if (
const std::vector<std::string>*
132 std::string result =
"[";
133 std::string delim =
"";
134 for (
const auto& in : *
value) {
135 result += delim + in;
139 }
else if (
const std::map<std::string, std::string>*
141 std::string result =
"{";
142 std::string delim =
"";
143 for (
const auto& in : *
value) {
144 result += delim + in.first +
":" + in.second;
151 return std::string();
std::vector< std::string > VectorOfStrings
std::map< std::string, std::string > MapOfStrings
KeyedObjectManager< vector > Vector
Forward declaration of specialized std::vector-like object manager.
GAUDI_API Stat operator+(const Stat &stat, const double value)
external operator for addition of Stat and a number
struct GAUDI_API map
Parametrisation class for map-like implementation.
GAUDI_API Stat operator-(const Stat &stat, const double value)
external operator for subtraction of Stat and a number
VectorOfStrings & Vector()
KeyedObjectManager< map > Map
Forward declaration of specialized std::map-like object manager.