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()) {
44 for (Properties::const_iterator it = other.begin();
45 it != other.end(); ++it) {
46 Properties::const_iterator it_ = this->find(it->first);
47 if (it_ == this->end()) {
51 boost::any myValue = it_->second;
52 boost::any otherValue = it->second;
54 if (myValue.type() != otherValue.type()) {
58 if (myValue.type() ==
typeid(std::string)) {
59 if (!anyEqual<std::string>(myValue, otherValue))
61 }
else if (myValue.type() ==
typeid(bool)) {
62 if (!anyEqual<bool>(myValue, otherValue))
64 }
else if (myValue.type() ==
typeid(int)) {
65 if (!anyEqual<int>(myValue, otherValue))
67 }
else if (myValue.type() ==
typeid(
unsigned int)) {
68 if (!anyEqual<unsigned int>(myValue, otherValue))
70 }
else if (myValue.type() ==
typeid(double)) {
71 if (!anyEqual<double>(myValue, otherValue))
74 throw std::runtime_error(boost::str(boost::format(
"Cannot compare values of type %1%")
83 for (Properties::const_iterator it = other.begin();
84 it != other.end(); ++it) {
85 (*this)[it->first] = it->second;
93 return find(name) != end();
101 for (Properties::const_iterator it = Properties1.begin();
102 it != Properties1.end(); ++it) {
103 result[it->first] = it->second;
105 for (Properties::const_iterator it = Properties2.begin();
106 it != Properties2.end(); ++it) {
107 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)
friend RSC_EXPORT Properties operator<<(const Properties &properties1, const Properties &properties2)
Merge left and right.
Properties objects are basically glorified map<string, boost::any> objects.
bool operator==(const Properties &other) const
Compare to other.
bool has(const std::string &name) const