35 bool anyEqual(boost::any lhs, boost::any rhs) {
36 return boost::any_cast<T>(lhs) == boost::any_cast<T>(rhs);
40 if (this->size() != other.size())
43 for (Properties::const_iterator it = other.begin();
44 it != other.end(); ++it) {
45 Properties::const_iterator it_ = this->find(it->first);
46 if (it_ == this->end())
49 boost::any myValue = it_->second;
50 boost::any otherValue = it->second;
52 if (myValue.type() != otherValue.type())
55 if (myValue.type() ==
typeid(std::string)) {
56 if (!anyEqual<std::string>(myValue, otherValue))
58 }
else if (myValue.type() ==
typeid(bool)) {
59 if (!anyEqual<bool>(myValue, otherValue))
61 }
else if (myValue.type() ==
typeid(int)) {
62 if (!anyEqual<int>(myValue, otherValue))
64 }
else if (myValue.type() ==
typeid(
unsigned int)) {
65 if (!anyEqual<unsigned int>(myValue, otherValue))
67 }
else if (myValue.type() ==
typeid(double)) {
68 if (!anyEqual<double>(myValue, otherValue))
71 throw std::runtime_error(boost::str(boost::format(
"Cannot compare values of type %1%")
80 for (Properties::const_iterator it = other.begin();
81 it != other.end(); ++it) {
82 (*this)[it->first] = it->second;
90 return find(name) != end();
98 for (Properties::const_iterator it = Properties1.begin();
99 it != Properties1.end(); ++it) {
100 result[it->first] = it->second;
102 for (Properties::const_iterator it = Properties2.begin();
103 it != Properties2.end(); ++it) {
104 result[it->first] = it->second;
Properties & operator<<=(const Properties &other)
Merge with other.
std::string typeName(const std::type_info &type)
Returns a (demangled) string representation of type.
bool anyEqual(boost::any lhs, boost::any rhs)
Properties objects are basically glorified map<string, boost::any> objects.
ostream & operator<<(ostream &stream, const Printable &record)
Output operator on std::ostream for reference Printables.
bool operator==(const Properties &other) const
Compare to other.
bool has(const std::string &name) const