|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
#include <PropertyValue.h>

Definition at line 22 of file PropertyValue.h.
| typedef boost::scoped_ptr<const PropertyValue> Gaudi::Parsers::PropertyValue::ConstScopedPtr |
Definition at line 28 of file PropertyValue.h.
| typedef boost::shared_ptr<const PropertyValue> Gaudi::Parsers::PropertyValue::ConstSharedPtr |
Definition at line 26 of file PropertyValue.h.
| typedef std::map<std::string, std::string> Gaudi::Parsers::PropertyValue::MapOfStrings |
Definition at line 33 of file PropertyValue.h.
| typedef boost::scoped_ptr<PropertyValue> Gaudi::Parsers::PropertyValue::ScopedPtr |
Definition at line 27 of file PropertyValue.h.
| typedef boost::shared_ptr<PropertyValue> Gaudi::Parsers::PropertyValue::SharedPtr |
Definition at line 25 of file PropertyValue.h.
| typedef boost::variant<std::string, std::vector<std::string>, std::map<std::string, std::string> > Gaudi::Parsers::PropertyValue::Value |
Definition at line 31 of file PropertyValue.h.
| typedef std::vector<std::string> Gaudi::Parsers::PropertyValue::VectorOfStrings |
Definition at line 32 of file PropertyValue.h.
| Gaudi::Parsers::PropertyValue::PropertyValue | ( | const Value & | value, |
| bool | is_reference = false |
||
| ) | [inline, explicit] |
Definition at line 36 of file PropertyValue.h.
: value_(value), is_reference_(is_reference) {}
| Gaudi::Parsers::PropertyValue::PropertyValue | ( | const Value & | value, |
| const Position & | position, | ||
| bool | is_reference = false |
||
| ) | [inline] |
Definition at line 38 of file PropertyValue.h.
: value_(value), position_(position), is_reference_(is_reference) {}
| bool Gaudi::Parsers::PropertyValue::HasPosition | ( | ) | const [inline] |
Definition at line 55 of file PropertyValue.h.
{return position_.Exists();}
| bool Gaudi::Parsers::PropertyValue::IsMap | ( | ) | const |
Definition at line 25 of file PropertyValue.cpp.
{
return boost::get<std::map<std::string, std::string> >(&value_) != NULL;
}
| bool Gaudi::Parsers::PropertyValue::IsReference | ( | ) | const [inline] |
Definition at line 59 of file PropertyValue.h.
{ return is_reference_;};
| bool Gaudi::Parsers::PropertyValue::IsSimple | ( | ) | const |
Definition at line 17 of file PropertyValue.cpp.
{
return boost::get<std::string>(&value_) != NULL;
}
| bool Gaudi::Parsers::PropertyValue::IsVector | ( | ) | const |
Definition at line 21 of file PropertyValue.cpp.
{
return boost::get<std::vector<std::string> >(&value_) != NULL;
}
| MapOfStrings& Gaudi::Parsers::PropertyValue::Map | ( | ) | [inline] |
Definition at line 51 of file PropertyValue.h.
{ return boost::get<MapOfStrings>(value_);}
| const MapOfStrings& Gaudi::Parsers::PropertyValue::Map | ( | ) | const [inline] |
Definition at line 52 of file PropertyValue.h.
{ return boost::get<MapOfStrings>(value_);}
| const gp::PropertyValue Gaudi::Parsers::PropertyValue::operator+ | ( | const PropertyValue & | right ) |
Definition at line 68 of file PropertyValue.cpp.
{
return PropertyValue(*this) += right;
}
| gp::PropertyValue & Gaudi::Parsers::PropertyValue::operator+= | ( | const PropertyValue & | right ) |
Definition at line 30 of file PropertyValue.cpp.
{
if (IsSimple() || IsReference()) {
throw PropertyValueException::WrongLValue();
}
if (IsVector()) {
if (right.IsSimple()) {
boost::get<VectorOfStrings>(value_).push_back(
boost::get<std::string>(right.value_));
return *this;
}
if (right.IsVector()){
VectorOfStrings& vec = boost::get<VectorOfStrings>(value_);
BOOST_FOREACH(const std::string& item,
boost::get<VectorOfStrings>(right.value_)) {
vec.push_back(item);
}
return *this;
}
throw PropertyValueException::WrongRValue();
}
if (IsMap()) {
if (!right.IsMap()) {
throw PropertyValueException::WrongRValue();
}
MapOfStrings& map = boost::get<MapOfStrings>(value_);
const MapOfStrings& rmap = boost::get<MapOfStrings>(right.value_);
BOOST_FOREACH(const MapOfStrings::value_type& item, rmap) {
map.insert(item);
}
return *this;
}
return *this;
}
| const gp::PropertyValue Gaudi::Parsers::PropertyValue::operator- | ( | const PropertyValue & | right ) |
Definition at line 116 of file PropertyValue.cpp.
{
return PropertyValue(*this) -= right;
}
| gp::PropertyValue & Gaudi::Parsers::PropertyValue::operator-= | ( | const PropertyValue & | right ) |
Definition at line 74 of file PropertyValue.cpp.
{
if (IsSimple() || IsReference()) {
throw PropertyValueException::WrongLValue();
}
if (IsVector()) {
VectorOfStrings& vec = Vector();
if (right.IsSimple()) {
vec.erase(std::find(vec.begin(), vec.end(), right.String()));
return *this;
}
if (right.IsVector()) {
const VectorOfStrings& rvec = right.Vector();
BOOST_FOREACH(const std::string& item, rvec) {
vec.erase(std::find(vec.begin(), vec.end(), item));
}
return *this;
}
throw PropertyValueException::WrongRValue();
}
if (IsMap()) {
MapOfStrings& map = Map();
if (right.IsSimple()) {
map.erase(right.String());
return *this;
}
if (right.IsVector()) {
const VectorOfStrings& rvec = right.Vector();
BOOST_FOREACH(const std::string& item, rvec) {
map.erase(item);
}
return *this;
}
throw PropertyValueException::WrongRValue();
}
throw PropertyValueException::WrongLValue();
}
| const Position& Gaudi::Parsers::PropertyValue::position | ( | ) | const [inline] |
Definition at line 42 of file PropertyValue.h.
{ return position_;}
| const std::string& Gaudi::Parsers::PropertyValue::String | ( | ) | const [inline] |
Definition at line 45 of file PropertyValue.h.
{ return boost::get<std::string>(value_);}
| std::string& Gaudi::Parsers::PropertyValue::String | ( | ) | [inline] |
Definition at line 44 of file PropertyValue.h.
{ return boost::get<std::string>(value_);}
| std::string Gaudi::Parsers::PropertyValue::ToString | ( | ) | const |
Definition at line 120 of file PropertyValue.cpp.
{
if (IsReference()) {
const std::vector<std::string>*
value = boost::get<std::vector<std::string> >(&value_);
assert(value != NULL);
if (value->at(0) != "") {
return "@"+value->at(0)+"."+value->at(1);
} else {
return "@"+value->at(0);
}
}
if (const std::string* value = boost::get<std::string>(&value_)) {
return *value;
} else if (const std::vector<std::string>*
value = boost::get<std::vector<std::string> >(&value_)) {
std::string result = "[";
std::string delim = "";
BOOST_FOREACH(const std::string& in, *value) {
result += delim + in;
delim = ", ";
}
return result+"]";
} else if (const std::map<std::string, std::string>*
value = boost::get<std::map<std::string, std::string> >(&value_)) {
std::string result = "{";
std::string delim = "";
typedef std::pair<std::string, std::string> pair_t;
BOOST_FOREACH(const pair_t& in, *value) {
result += delim + in.first + ":" + in.second;
delim = ", ";
}
return result+"}";
}
assert(false);
// @todo Check the validity of this logic
return std::string(); // avoid compilation warning
}
| const VectorOfStrings& Gaudi::Parsers::PropertyValue::Vector | ( | ) | const [inline] |
Definition at line 48 of file PropertyValue.h.
{
return boost::get<VectorOfStrings>(value_);}
| VectorOfStrings& Gaudi::Parsers::PropertyValue::Vector | ( | ) | [inline] |
Definition at line 47 of file PropertyValue.h.
{ return boost::get<VectorOfStrings>(value_);}
bool Gaudi::Parsers::PropertyValue::is_reference_ [private] |
Definition at line 72 of file PropertyValue.h.
Position Gaudi::Parsers::PropertyValue::position_ [private] |
Definition at line 71 of file PropertyValue.h.
Value Gaudi::Parsers::PropertyValue::value_ [private] |
Definition at line 70 of file PropertyValue.h.