mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-12 18:20:27 +01:00
Cosmetic improvements for poco_json_adapter.hpp and property_tree_adapter.hpp
This commit is contained in:
parent
e5c1cbfe88
commit
77d2ef8299
@ -61,7 +61,7 @@ public:
|
|||||||
|
|
||||||
/// Construct a PocoJsonArray referencing an empty array.
|
/// Construct a PocoJsonArray referencing an empty array.
|
||||||
PocoJsonArray()
|
PocoJsonArray()
|
||||||
: value(emptyArray())
|
: m_value(emptyArray())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
* an array.
|
* an array.
|
||||||
*/
|
*/
|
||||||
PocoJsonArray(const Poco::Dynamic::Var &value)
|
PocoJsonArray(const Poco::Dynamic::Var &value)
|
||||||
: value(value)
|
: m_value(value)
|
||||||
{
|
{
|
||||||
if (value.type() != typeid(Poco::JSON::Array::Ptr)) {
|
if (value.type() != typeid(Poco::JSON::Array::Ptr)) {
|
||||||
throw std::runtime_error("Value is not an array.");
|
throw std::runtime_error("Value is not an array.");
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
/// Return the number of elements in the array
|
/// Return the number of elements in the array
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return value.extract<Poco::JSON::Array::Ptr>()->size();
|
return m_value.extract<Poco::JSON::Array::Ptr>()->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -115,7 +115,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Contained value
|
/// Contained value
|
||||||
Poco::Dynamic::Var value;
|
Poco::Dynamic::Var m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,7 +138,7 @@ public:
|
|||||||
|
|
||||||
/// Construct a PocoJsonObject an empty object.
|
/// Construct a PocoJsonObject an empty object.
|
||||||
PocoJsonObject()
|
PocoJsonObject()
|
||||||
: value(emptyObject())
|
: m_value(emptyObject())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,7 +151,7 @@ public:
|
|||||||
* an object.
|
* an object.
|
||||||
*/
|
*/
|
||||||
PocoJsonObject(const Poco::Dynamic::Var &value)
|
PocoJsonObject(const Poco::Dynamic::Var &value)
|
||||||
: value(value)
|
: m_value(value)
|
||||||
{
|
{
|
||||||
if (value.type() != typeid(Poco::JSON::Object::Ptr)) {
|
if (value.type() != typeid(Poco::JSON::Object::Ptr)) {
|
||||||
throw std::runtime_error("Value is not an object.");
|
throw std::runtime_error("Value is not an object.");
|
||||||
@ -189,7 +189,7 @@ public:
|
|||||||
/// Returns the number of members belonging to this object.
|
/// Returns the number of members belonging to this object.
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return value.extract<Poco::JSON::Object::Ptr>()->size();
|
return m_value.extract<Poco::JSON::Object::Ptr>()->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -204,7 +204,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Contained value
|
/// Contained value
|
||||||
Poco::Dynamic::Var value;
|
Poco::Dynamic::Var m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,12 +226,12 @@ public:
|
|||||||
* @param source the PocoJson value to be copied
|
* @param source the PocoJson value to be copied
|
||||||
*/
|
*/
|
||||||
explicit PocoJsonFrozenValue(const Poco::Dynamic::Var &source)
|
explicit PocoJsonFrozenValue(const Poco::Dynamic::Var &source)
|
||||||
: value(source)
|
: m_value(source)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual FrozenValue * clone() const
|
virtual FrozenValue * clone() const
|
||||||
{
|
{
|
||||||
return new PocoJsonFrozenValue(value);
|
return new PocoJsonFrozenValue(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool equalTo(const Adapter &other, bool strict) const;
|
virtual bool equalTo(const Adapter &other, bool strict) const;
|
||||||
@ -239,7 +239,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
/// Stored PocoJson value
|
/// Stored PocoJson value
|
||||||
Poco::Dynamic::Var value;
|
Poco::Dynamic::Var m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -263,12 +263,12 @@ public:
|
|||||||
|
|
||||||
/// Construct a wrapper for the empty object
|
/// Construct a wrapper for the empty object
|
||||||
PocoJsonValue()
|
PocoJsonValue()
|
||||||
: value(emptyObject())
|
: m_value(emptyObject())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/// Construct a wrapper for a specific PocoJson value
|
/// Construct a wrapper for a specific PocoJson value
|
||||||
PocoJsonValue(const Poco::Dynamic::Var& value)
|
PocoJsonValue(const Poco::Dynamic::Var& value)
|
||||||
: value(value)
|
: m_value(value)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,7 +280,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
FrozenValue * freeze() const
|
FrozenValue * freeze() const
|
||||||
{
|
{
|
||||||
return new PocoJsonFrozenValue(value);
|
return new PocoJsonFrozenValue(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -294,8 +294,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
opt::optional<PocoJsonArray> getArrayOptional() const
|
opt::optional<PocoJsonArray> getArrayOptional() const
|
||||||
{
|
{
|
||||||
if (value.type() == typeid(Poco::JSON::Array::Ptr)) {
|
if (m_value.type() == typeid(Poco::JSON::Array::Ptr)) {
|
||||||
return opt::make_optional(PocoJsonArray(value));
|
return opt::make_optional(PocoJsonArray(m_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return opt::optional<PocoJsonArray>();
|
return opt::optional<PocoJsonArray>();
|
||||||
@ -314,8 +314,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getArraySize(size_t &result) const
|
bool getArraySize(size_t &result) const
|
||||||
{
|
{
|
||||||
if (value.type() == typeid(Poco::JSON::Array::Ptr)) {
|
if (m_value.type() == typeid(Poco::JSON::Array::Ptr)) {
|
||||||
result = value.extract<Poco::JSON::Array::Ptr>()->size();
|
result = m_value.extract<Poco::JSON::Array::Ptr>()->size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +324,8 @@ public:
|
|||||||
|
|
||||||
bool getBool(bool &result) const
|
bool getBool(bool &result) const
|
||||||
{
|
{
|
||||||
if (value.isBoolean()) {
|
if (m_value.isBoolean()) {
|
||||||
result = value.convert<bool>();
|
result = m_value.convert<bool>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,8 +334,8 @@ public:
|
|||||||
|
|
||||||
bool getDouble(double &result) const
|
bool getDouble(double &result) const
|
||||||
{
|
{
|
||||||
if (value.isNumeric() && !value.isInteger()) {
|
if (m_value.isNumeric() && !m_value.isInteger()) {
|
||||||
result = value.convert<double>();
|
result = m_value.convert<double>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,8 +344,8 @@ public:
|
|||||||
|
|
||||||
bool getInteger(int64_t &result) const
|
bool getInteger(int64_t &result) const
|
||||||
{
|
{
|
||||||
if (value.isInteger()) {
|
if (m_value.isInteger()) {
|
||||||
result = value.convert<int>();
|
result = m_value.convert<int>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -362,8 +362,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
opt::optional<PocoJsonObject> getObjectOptional() const
|
opt::optional<PocoJsonObject> getObjectOptional() const
|
||||||
{
|
{
|
||||||
if (value.type() == typeid(Poco::JSON::Object::Ptr)) {
|
if (m_value.type() == typeid(Poco::JSON::Object::Ptr)) {
|
||||||
return opt::make_optional(PocoJsonObject(value));
|
return opt::make_optional(PocoJsonObject(m_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return opt::optional<PocoJsonObject>();
|
return opt::optional<PocoJsonObject>();
|
||||||
@ -382,8 +382,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getObjectSize(size_t &result) const
|
bool getObjectSize(size_t &result) const
|
||||||
{
|
{
|
||||||
if (value.type() == typeid(Poco::JSON::Object::Ptr)) {
|
if (m_value.type() == typeid(Poco::JSON::Object::Ptr)) {
|
||||||
result = value.extract<Poco::JSON::Object::Ptr>()->size();
|
result = m_value.extract<Poco::JSON::Object::Ptr>()->size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,8 +392,8 @@ public:
|
|||||||
|
|
||||||
bool getString(std::string &result) const
|
bool getString(std::string &result) const
|
||||||
{
|
{
|
||||||
if (value.isString()) {
|
if (m_value.isString()) {
|
||||||
result = value.convert<std::string>();
|
result = m_value.convert<std::string>();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,42 +407,42 @@ public:
|
|||||||
|
|
||||||
bool isArray() const
|
bool isArray() const
|
||||||
{
|
{
|
||||||
return value.type() == typeid(Poco::JSON::Array::Ptr);
|
return m_value.type() == typeid(Poco::JSON::Array::Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBool() const
|
bool isBool() const
|
||||||
{
|
{
|
||||||
return value.isBoolean();
|
return m_value.isBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDouble() const
|
bool isDouble() const
|
||||||
{
|
{
|
||||||
return value.isNumeric() && !value.isInteger();
|
return m_value.isNumeric() && !m_value.isInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInteger() const
|
bool isInteger() const
|
||||||
{
|
{
|
||||||
return !isBool() && value.isInteger();
|
return !isBool() && m_value.isInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNull() const
|
bool isNull() const
|
||||||
{
|
{
|
||||||
return value.isEmpty();
|
return m_value.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNumber() const
|
bool isNumber() const
|
||||||
{
|
{
|
||||||
return value.isNumeric();
|
return m_value.isNumeric();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isObject() const
|
bool isObject() const
|
||||||
{
|
{
|
||||||
return value.type() == typeid(Poco::JSON::Object::Ptr);
|
return m_value.type() == typeid(Poco::JSON::Object::Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isString() const
|
bool isString() const
|
||||||
{
|
{
|
||||||
return value.isString();
|
return m_value.isString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -455,7 +455,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Contained value
|
/// Contained value
|
||||||
Poco::Dynamic::Var value;
|
Poco::Dynamic::Var m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -495,10 +495,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @see PocoJsonArray
|
* @see PocoJsonArray
|
||||||
*/
|
*/
|
||||||
class PocoJsonArrayValueIterator :
|
class PocoJsonArrayValueIterator : public std::iterator<std::bidirectional_iterator_tag, PocoJsonAdapter>
|
||||||
public std::iterator<
|
|
||||||
std::bidirectional_iterator_tag, // bi-directional iterator
|
|
||||||
PocoJsonAdapter> // value type
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -509,14 +506,14 @@ public:
|
|||||||
* @param itr PocoJson iterator to store
|
* @param itr PocoJson iterator to store
|
||||||
*/
|
*/
|
||||||
PocoJsonArrayValueIterator(const Poco::JSON::Array::ConstIterator &itr)
|
PocoJsonArrayValueIterator(const Poco::JSON::Array::ConstIterator &itr)
|
||||||
: itr(itr)
|
: m_itr(itr)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/// Returns a PocoJsonAdapter that contains the value of the current
|
/// Returns a PocoJsonAdapter that contains the value of the current
|
||||||
/// element.
|
/// element.
|
||||||
PocoJsonAdapter operator*() const
|
PocoJsonAdapter operator*() const
|
||||||
{
|
{
|
||||||
return PocoJsonAdapter(*itr);
|
return PocoJsonAdapter(*m_itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DerefProxy<PocoJsonAdapter> operator->() const
|
DerefProxy<PocoJsonAdapter> operator->() const
|
||||||
@ -537,42 +534,42 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool operator==(const PocoJsonArrayValueIterator &other) const
|
bool operator==(const PocoJsonArrayValueIterator &other) const
|
||||||
{
|
{
|
||||||
return itr == other.itr;
|
return m_itr == other.m_itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const PocoJsonArrayValueIterator &other) const
|
bool operator!=(const PocoJsonArrayValueIterator &other) const
|
||||||
{
|
{
|
||||||
return !(itr == other.itr);
|
return !(m_itr == other.m_itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PocoJsonArrayValueIterator& operator++()
|
const PocoJsonArrayValueIterator& operator++()
|
||||||
{
|
{
|
||||||
itr++;
|
m_itr++;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PocoJsonArrayValueIterator operator++(int)
|
PocoJsonArrayValueIterator operator++(int)
|
||||||
{
|
{
|
||||||
PocoJsonArrayValueIterator iterator_pre(itr);
|
PocoJsonArrayValueIterator iterator_pre(m_itr);
|
||||||
++(*this);
|
++(*this);
|
||||||
return iterator_pre;
|
return iterator_pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PocoJsonArrayValueIterator& operator--()
|
const PocoJsonArrayValueIterator& operator--()
|
||||||
{
|
{
|
||||||
itr--;
|
m_itr--;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void advance(std::ptrdiff_t n)
|
void advance(std::ptrdiff_t n)
|
||||||
{
|
{
|
||||||
itr += n;
|
m_itr += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Poco::JSON::Array::ConstIterator itr;
|
Poco::JSON::Array::ConstIterator m_itr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -586,10 +583,7 @@ private:
|
|||||||
* @see PocoJsonObject
|
* @see PocoJsonObject
|
||||||
* @see PocoJsonObjectMember
|
* @see PocoJsonObjectMember
|
||||||
*/
|
*/
|
||||||
class PocoJsonObjectMemberIterator :
|
class PocoJsonObjectMemberIterator : public std::iterator<std::bidirectional_iterator_tag, PocoJsonObjectMember>
|
||||||
public std::iterator<
|
|
||||||
std::bidirectional_iterator_tag, // bi-directional iterator
|
|
||||||
PocoJsonObjectMember> // value type
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -599,7 +593,7 @@ public:
|
|||||||
* @param itr PocoJson iterator to store
|
* @param itr PocoJson iterator to store
|
||||||
*/
|
*/
|
||||||
PocoJsonObjectMemberIterator(const Poco::JSON::Object::ConstIterator &itr)
|
PocoJsonObjectMemberIterator(const Poco::JSON::Object::ConstIterator &itr)
|
||||||
: itr(itr)
|
: m_itr(itr)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -608,7 +602,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
PocoJsonObjectMember operator*() const
|
PocoJsonObjectMember operator*() const
|
||||||
{
|
{
|
||||||
return PocoJsonObjectMember(itr->first, itr->second);
|
return PocoJsonObjectMember(m_itr->first, m_itr->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
DerefProxy<PocoJsonObjectMember> operator->() const
|
DerefProxy<PocoJsonObjectMember> operator->() const
|
||||||
@ -629,31 +623,31 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool operator==(const PocoJsonObjectMemberIterator &other) const
|
bool operator==(const PocoJsonObjectMemberIterator &other) const
|
||||||
{
|
{
|
||||||
return itr == other.itr;
|
return m_itr == other.m_itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const PocoJsonObjectMemberIterator &other) const
|
bool operator!=(const PocoJsonObjectMemberIterator &other) const
|
||||||
{
|
{
|
||||||
return !(itr == other.itr);
|
return !(m_itr == other.m_itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PocoJsonObjectMemberIterator& operator++()
|
const PocoJsonObjectMemberIterator& operator++()
|
||||||
{
|
{
|
||||||
itr++;
|
m_itr++;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PocoJsonObjectMemberIterator operator++(int)
|
PocoJsonObjectMemberIterator operator++(int)
|
||||||
{
|
{
|
||||||
PocoJsonObjectMemberIterator iterator_pre(itr);
|
PocoJsonObjectMemberIterator iterator_pre(m_itr);
|
||||||
++(*this);
|
++(*this);
|
||||||
return iterator_pre;
|
return iterator_pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PocoJsonObjectMemberIterator& operator--()
|
const PocoJsonObjectMemberIterator& operator--()
|
||||||
{
|
{
|
||||||
itr--;
|
m_itr--;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -661,7 +655,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
/// Iternal copy of the original PocoJson iterator
|
/// Iternal copy of the original PocoJson iterator
|
||||||
Poco::JSON::Object::ConstIterator itr;
|
Poco::JSON::Object::ConstIterator m_itr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Specialisation of the AdapterTraits template struct for PocoJsonAdapter.
|
/// Specialisation of the AdapterTraits template struct for PocoJsonAdapter.
|
||||||
@ -678,32 +672,29 @@ struct AdapterTraits<valijson::adapters::PocoJsonAdapter>
|
|||||||
|
|
||||||
inline PocoJsonArrayValueIterator PocoJsonArray::begin() const
|
inline PocoJsonArrayValueIterator PocoJsonArray::begin() const
|
||||||
{
|
{
|
||||||
return value.extract<Poco::JSON::Array::Ptr>()->begin();
|
return m_value.extract<Poco::JSON::Array::Ptr>()->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PocoJsonArrayValueIterator PocoJsonArray::end() const
|
inline PocoJsonArrayValueIterator PocoJsonArray::end() const
|
||||||
{
|
{
|
||||||
return value.extract<Poco::JSON::Array::Ptr>()->end();
|
return m_value.extract<Poco::JSON::Array::Ptr>()->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PocoJsonObjectMemberIterator PocoJsonObject::begin() const
|
inline PocoJsonObjectMemberIterator PocoJsonObject::begin() const
|
||||||
{
|
{
|
||||||
return value.extract<Poco::JSON::Object::Ptr>()->begin();
|
return m_value.extract<Poco::JSON::Object::Ptr>()->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PocoJsonObjectMemberIterator PocoJsonObject::end() const
|
inline PocoJsonObjectMemberIterator PocoJsonObject::end() const
|
||||||
{
|
{
|
||||||
return value.extract<Poco::JSON::Object::Ptr>()->end();
|
return m_value.extract<Poco::JSON::Object::Ptr>()->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PocoJsonObjectMemberIterator PocoJsonObject::find(
|
inline PocoJsonObjectMemberIterator PocoJsonObject::find(const std::string &propertyName) const
|
||||||
const std::string &propertyName) const
|
|
||||||
{
|
{
|
||||||
auto& ptr = value.extract<Poco::JSON::Object::Ptr>();
|
auto& ptr = m_value.extract<Poco::JSON::Object::Ptr>();
|
||||||
|
|
||||||
auto it = std::find_if(ptr->begin(), ptr->end(),
|
auto it = std::find_if(ptr->begin(), ptr->end(), [&propertyName](const Poco::JSON::Object::ValueType& p) {
|
||||||
[&propertyName](const Poco::JSON::Object::ValueType& p)
|
|
||||||
{
|
|
||||||
return p.first == propertyName;
|
return p.first == propertyName;
|
||||||
});
|
});
|
||||||
return it;
|
return it;
|
||||||
@ -711,7 +702,7 @@ inline PocoJsonObjectMemberIterator PocoJsonObject::find(
|
|||||||
|
|
||||||
inline bool PocoJsonFrozenValue::equalTo(const Adapter &other, bool strict) const
|
inline bool PocoJsonFrozenValue::equalTo(const Adapter &other, bool strict) const
|
||||||
{
|
{
|
||||||
return PocoJsonAdapter(value).equalTo(other, strict);
|
return PocoJsonAdapter(m_value).equalTo(other, strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace adapters
|
} // namespace adapters
|
||||||
|
@ -61,10 +61,10 @@ public:
|
|||||||
typedef PropertyTreeArrayValueIterator const_iterator;
|
typedef PropertyTreeArrayValueIterator const_iterator;
|
||||||
typedef PropertyTreeArrayValueIterator iterator;
|
typedef PropertyTreeArrayValueIterator iterator;
|
||||||
|
|
||||||
/// Construct a PropertyTreeArra7 referencing an empty property tree
|
/// Construct a PropertyTreeArray referencing an empty property tree
|
||||||
/// singleton.
|
/// singleton.
|
||||||
PropertyTreeArray()
|
PropertyTreeArray()
|
||||||
: array(emptyTree()) { }
|
: m_array(emptyTree()) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct PropertyTreeArray referencing a specific Boost
|
* @brief Construct PropertyTreeArray referencing a specific Boost
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
* checked due to runtime cost.
|
* checked due to runtime cost.
|
||||||
*/
|
*/
|
||||||
explicit PropertyTreeArray(const boost::property_tree::ptree &array)
|
explicit PropertyTreeArray(const boost::property_tree::ptree &array)
|
||||||
: array(array) { }
|
: m_array(array) { }
|
||||||
|
|
||||||
/// Return an iterator for the first element in the array.
|
/// Return an iterator for the first element in the array.
|
||||||
PropertyTreeArrayValueIterator begin() const;
|
PropertyTreeArrayValueIterator begin() const;
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
/// Return the number of elements in the array
|
/// Return the number of elements in the array
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return array.size();
|
return m_array.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -105,7 +105,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reference to the contained value
|
/// Reference to the contained value
|
||||||
const boost::property_tree::ptree &array;
|
const boost::property_tree::ptree &m_array;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
|
|
||||||
/// Construct a PropertyTreeObject referencing an empty property tree.
|
/// Construct a PropertyTreeObject referencing an empty property tree.
|
||||||
PropertyTreeObject()
|
PropertyTreeObject()
|
||||||
: object(emptyTree()) { }
|
: m_object(emptyTree()) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a PropertyTreeObject referencing a specific property
|
* @brief Construct a PropertyTreeObject referencing a specific property
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
* runtime cost of doing so.
|
* runtime cost of doing so.
|
||||||
*/
|
*/
|
||||||
PropertyTreeObject(const boost::property_tree::ptree &object)
|
PropertyTreeObject(const boost::property_tree::ptree &object)
|
||||||
: object(object) { }
|
: m_object(object) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return an iterator for this first object member
|
* @brief Return an iterator for this first object member
|
||||||
@ -176,7 +176,7 @@ public:
|
|||||||
/// Returns the number of members belonging to this object.
|
/// Returns the number of members belonging to this object.
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return object.size();
|
return m_object.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -193,7 +193,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reference to the contained object
|
/// Reference to the contained object
|
||||||
const boost::property_tree::ptree &object;
|
const boost::property_tree::ptree &m_object;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -215,30 +215,28 @@ public:
|
|||||||
*
|
*
|
||||||
* @param source string containing the POD vlaue
|
* @param source string containing the POD vlaue
|
||||||
*/
|
*/
|
||||||
explicit PropertyTreeFrozenValue(
|
explicit PropertyTreeFrozenValue(const boost::property_tree::ptree::data_type &source)
|
||||||
const boost::property_tree::ptree::data_type &source)
|
: m_value(source) { }
|
||||||
: value(source) { }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Make a copy of a Boost property tree object or array value
|
* @brief Make a copy of a Boost property tree object or array value
|
||||||
*
|
*
|
||||||
* @param source the property tree to be copied
|
* @param source the property tree to be copied
|
||||||
*/
|
*/
|
||||||
explicit PropertyTreeFrozenValue(
|
explicit PropertyTreeFrozenValue(const boost::property_tree::ptree &source)
|
||||||
const boost::property_tree::ptree &source)
|
: m_value(source) { }
|
||||||
: value(source) { }
|
|
||||||
|
|
||||||
virtual FrozenValue * clone() const
|
FrozenValue * clone() const override
|
||||||
{
|
{
|
||||||
return new PropertyTreeFrozenValue(value);
|
return new PropertyTreeFrozenValue(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool equalTo(const Adapter &other, bool strict) const;
|
bool equalTo(const Adapter &other, bool strict) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// Stored value
|
/// Stored value
|
||||||
boost::property_tree::ptree value;
|
boost::property_tree::ptree m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,7 +259,7 @@ public:
|
|||||||
|
|
||||||
/// Construct a wrapper for an empty property tree
|
/// Construct a wrapper for an empty property tree
|
||||||
PropertyTreeValue()
|
PropertyTreeValue()
|
||||||
: object(emptyTree()) { }
|
: m_object(emptyTree()) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a PropertyTreeValue from a tree object
|
* @brief Construct a PropertyTreeValue from a tree object
|
||||||
@ -279,8 +277,8 @@ public:
|
|||||||
PropertyTreeValue(const boost::property_tree::ptree &tree)
|
PropertyTreeValue(const boost::property_tree::ptree &tree)
|
||||||
{
|
{
|
||||||
if (tree.data().empty()) { // No string content
|
if (tree.data().empty()) { // No string content
|
||||||
if (tree.size() == 0) { // No children
|
if (tree.empty()) { // No children
|
||||||
array.emplace(tree); // Treat as empty array
|
m_array.emplace(tree); // Treat as empty array
|
||||||
} else {
|
} else {
|
||||||
bool isArray = true;
|
bool isArray = true;
|
||||||
for (const auto &node : tree) {
|
for (const auto &node : tree) {
|
||||||
@ -291,13 +289,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
array.emplace(tree);
|
m_array.emplace(tree);
|
||||||
} else {
|
} else {
|
||||||
object.emplace(tree);
|
m_object.emplace(tree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value = tree.data();
|
m_value = tree.data();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,12 +308,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
FrozenValue* freeze() const
|
FrozenValue* freeze() const
|
||||||
{
|
{
|
||||||
if (array) {
|
if (m_array) {
|
||||||
return new PropertyTreeFrozenValue(*array);
|
return new PropertyTreeFrozenValue(*m_array);
|
||||||
} else if (object) {
|
} else if (m_object) {
|
||||||
return new PropertyTreeFrozenValue(*object);
|
return new PropertyTreeFrozenValue(*m_object);
|
||||||
} else {
|
} else {
|
||||||
return new PropertyTreeFrozenValue(*value);
|
return new PropertyTreeFrozenValue(*m_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,11 +328,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
opt::optional<PropertyTreeArray> getArrayOptional() const
|
opt::optional<PropertyTreeArray> getArrayOptional() const
|
||||||
{
|
{
|
||||||
if (array) {
|
if (m_array) {
|
||||||
return opt::make_optional(PropertyTreeArray(*array));
|
return opt::make_optional(PropertyTreeArray(*m_array));
|
||||||
}
|
}
|
||||||
|
|
||||||
return opt::optional<PropertyTreeArray>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -350,25 +348,25 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getArraySize(size_t &result) const
|
bool getArraySize(size_t &result) const
|
||||||
{
|
{
|
||||||
if (array) {
|
if (m_array) {
|
||||||
result = array->size();
|
result = m_array->size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getBool(bool &) const
|
static bool getBool(bool &)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getDouble(double &) const
|
static bool getDouble(double &)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getInteger(int64_t &) const
|
static bool getInteger(int64_t &)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -384,11 +382,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
opt::optional<PropertyTreeObject> getObjectOptional() const
|
opt::optional<PropertyTreeObject> getObjectOptional() const
|
||||||
{
|
{
|
||||||
if (object) {
|
if (m_object) {
|
||||||
return opt::make_optional(PropertyTreeObject(*object));
|
return opt::make_optional(PropertyTreeObject(*m_object));
|
||||||
}
|
}
|
||||||
|
|
||||||
return opt::optional<PropertyTreeObject>();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -404,8 +402,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool getObjectSize(size_t &result) const
|
bool getObjectSize(size_t &result) const
|
||||||
{
|
{
|
||||||
if (object) {
|
if (m_object) {
|
||||||
result = object->size();
|
result = m_object->size();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,8 +412,8 @@ public:
|
|||||||
|
|
||||||
bool getString(std::string &result) const
|
bool getString(std::string &result) const
|
||||||
{
|
{
|
||||||
if (value) {
|
if (m_value) {
|
||||||
result = *value;
|
result = *m_value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,42 +427,42 @@ public:
|
|||||||
|
|
||||||
bool isArray() const
|
bool isArray() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(array);
|
return static_cast<bool>(m_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBool() const
|
static bool isBool()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDouble() const
|
static bool isDouble()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInteger() const
|
static bool isInteger()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNull() const
|
static bool isNull()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNumber() const
|
static bool isNumber()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isObject() const
|
bool isObject() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(object);
|
return static_cast<bool>(m_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isString() const
|
bool isString() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(value);
|
return static_cast<bool>(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -476,13 +474,13 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reference used if the value is known to be an array
|
/// Reference used if the value is known to be an array
|
||||||
opt::optional<const boost::property_tree::ptree &> array;
|
opt::optional<const boost::property_tree::ptree &> m_array;
|
||||||
|
|
||||||
/// Reference used if the value is known to be an object
|
/// Reference used if the value is known to be an object
|
||||||
opt::optional<const boost::property_tree::ptree &> object;
|
opt::optional<const boost::property_tree::ptree &> m_object;
|
||||||
|
|
||||||
/// Reference used if the value is known to be a POD type
|
/// Reference used if the value is known to be a POD type
|
||||||
opt::optional<std::string> value;
|
opt::optional<std::string> m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -522,10 +520,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @see PropertyTreeArray
|
* @see PropertyTreeArray
|
||||||
*/
|
*/
|
||||||
class PropertyTreeArrayValueIterator:
|
class PropertyTreeArrayValueIterator : public std::iterator<std::bidirectional_iterator_tag, PropertyTreeAdapter>
|
||||||
public std::iterator<
|
|
||||||
std::bidirectional_iterator_tag, // bi-directional iterator
|
|
||||||
PropertyTreeAdapter> // value type
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -537,13 +532,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
PropertyTreeArrayValueIterator(
|
PropertyTreeArrayValueIterator(
|
||||||
const boost::property_tree::ptree::const_iterator &itr)
|
const boost::property_tree::ptree::const_iterator &itr)
|
||||||
: itr(itr) { }
|
: m_itr(itr) { }
|
||||||
|
|
||||||
/// Returns a PropertyTreeAdapter that contains the value of the current
|
/// Returns a PropertyTreeAdapter that contains the value of the current
|
||||||
/// element.
|
/// element.
|
||||||
PropertyTreeAdapter operator*() const
|
PropertyTreeAdapter operator*() const
|
||||||
{
|
{
|
||||||
return PropertyTreeAdapter(itr->second);
|
return PropertyTreeAdapter(m_itr->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
DerefProxy<PropertyTreeAdapter> operator->() const
|
DerefProxy<PropertyTreeAdapter> operator->() const
|
||||||
@ -564,31 +559,31 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool operator==(const PropertyTreeArrayValueIterator &rhs) const
|
bool operator==(const PropertyTreeArrayValueIterator &rhs) const
|
||||||
{
|
{
|
||||||
return itr == rhs.itr;
|
return m_itr == rhs.m_itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const PropertyTreeArrayValueIterator &rhs) const
|
bool operator!=(const PropertyTreeArrayValueIterator &rhs) const
|
||||||
{
|
{
|
||||||
return !(itr == rhs.itr);
|
return !(m_itr == rhs.m_itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PropertyTreeArrayValueIterator& operator++()
|
const PropertyTreeArrayValueIterator& operator++()
|
||||||
{
|
{
|
||||||
itr++;
|
m_itr++;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyTreeArrayValueIterator operator++(int)
|
PropertyTreeArrayValueIterator operator++(int)
|
||||||
{
|
{
|
||||||
PropertyTreeArrayValueIterator iterator_pre(itr);
|
PropertyTreeArrayValueIterator iterator_pre(m_itr);
|
||||||
++(*this);
|
++(*this);
|
||||||
return iterator_pre;
|
return iterator_pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PropertyTreeArrayValueIterator& operator--()
|
const PropertyTreeArrayValueIterator& operator--()
|
||||||
{
|
{
|
||||||
itr--;
|
m_itr--;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -597,18 +592,18 @@ public:
|
|||||||
{
|
{
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
while (n-- > 0) {
|
while (n-- > 0) {
|
||||||
itr++;
|
m_itr++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (n++ < 0) {
|
while (n++ < 0) {
|
||||||
itr--;
|
m_itr--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::property_tree::ptree::const_iterator itr;
|
boost::property_tree::ptree::const_iterator m_itr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -621,10 +616,7 @@ private:
|
|||||||
* @see PropertyTreeObject
|
* @see PropertyTreeObject
|
||||||
* @see PropertyTreeObjectMember
|
* @see PropertyTreeObjectMember
|
||||||
*/
|
*/
|
||||||
class PropertyTreeObjectMemberIterator:
|
class PropertyTreeObjectMemberIterator: public std::iterator<std::bidirectional_iterator_tag, PropertyTreeObjectMember>
|
||||||
public std::iterator<
|
|
||||||
std::bidirectional_iterator_tag, // bi-directional iterator
|
|
||||||
PropertyTreeObjectMember> // value type
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -635,7 +627,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
PropertyTreeObjectMemberIterator(
|
PropertyTreeObjectMemberIterator(
|
||||||
boost::property_tree::ptree::const_assoc_iterator itr)
|
boost::property_tree::ptree::const_assoc_iterator itr)
|
||||||
: itr(itr) { }
|
: m_itr(itr) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a PropertyTreeObjectMember that contains the key and
|
* @brief Returns a PropertyTreeObjectMember that contains the key and
|
||||||
@ -643,7 +635,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
PropertyTreeObjectMember operator*() const
|
PropertyTreeObjectMember operator*() const
|
||||||
{
|
{
|
||||||
return PropertyTreeObjectMember(itr->first, itr->second);
|
return PropertyTreeObjectMember(m_itr->first, m_itr->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
DerefProxy<PropertyTreeObjectMember> operator->() const
|
DerefProxy<PropertyTreeObjectMember> operator->() const
|
||||||
@ -664,38 +656,38 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool operator==(const PropertyTreeObjectMemberIterator &rhs) const
|
bool operator==(const PropertyTreeObjectMemberIterator &rhs) const
|
||||||
{
|
{
|
||||||
return itr == rhs.itr;
|
return m_itr == rhs.m_itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const PropertyTreeObjectMemberIterator &rhs) const
|
bool operator!=(const PropertyTreeObjectMemberIterator &rhs) const
|
||||||
{
|
{
|
||||||
return !(itr == rhs.itr);
|
return !(m_itr == rhs.m_itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PropertyTreeObjectMemberIterator& operator++()
|
const PropertyTreeObjectMemberIterator& operator++()
|
||||||
{
|
{
|
||||||
itr++;
|
m_itr++;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyTreeObjectMemberIterator operator++(int)
|
PropertyTreeObjectMemberIterator operator++(int)
|
||||||
{
|
{
|
||||||
PropertyTreeObjectMemberIterator iterator_pre(itr);
|
PropertyTreeObjectMemberIterator iterator_pre(m_itr);
|
||||||
++(*this);
|
++(*this);
|
||||||
return iterator_pre;
|
return iterator_pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PropertyTreeObjectMemberIterator& operator--()
|
const PropertyTreeObjectMemberIterator& operator--()
|
||||||
{
|
{
|
||||||
itr--;
|
m_itr--;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::property_tree::ptree::const_assoc_iterator itr;
|
boost::property_tree::ptree::const_assoc_iterator m_itr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Specialisation of the AdapterTraits template struct for PropertyTreeAdapter.
|
/// Specialisation of the AdapterTraits template struct for PropertyTreeAdapter.
|
||||||
@ -712,40 +704,39 @@ struct AdapterTraits<valijson::adapters::PropertyTreeAdapter>
|
|||||||
|
|
||||||
inline bool PropertyTreeFrozenValue::equalTo(const Adapter &other, bool strict) const
|
inline bool PropertyTreeFrozenValue::equalTo(const Adapter &other, bool strict) const
|
||||||
{
|
{
|
||||||
return PropertyTreeAdapter(value).equalTo(other, strict);
|
return PropertyTreeAdapter(m_value).equalTo(other, strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropertyTreeArrayValueIterator PropertyTreeArray::begin() const
|
inline PropertyTreeArrayValueIterator PropertyTreeArray::begin() const
|
||||||
{
|
{
|
||||||
return array.begin();
|
return m_array.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropertyTreeArrayValueIterator PropertyTreeArray::end() const
|
inline PropertyTreeArrayValueIterator PropertyTreeArray::end() const
|
||||||
{
|
{
|
||||||
return array.end();
|
return m_array.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropertyTreeObjectMemberIterator PropertyTreeObject::begin() const
|
inline PropertyTreeObjectMemberIterator PropertyTreeObject::begin() const
|
||||||
{
|
{
|
||||||
return object.ordered_begin();
|
return m_object.ordered_begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropertyTreeObjectMemberIterator PropertyTreeObject::end() const
|
inline PropertyTreeObjectMemberIterator PropertyTreeObject::end() const
|
||||||
{
|
{
|
||||||
return object.not_found();
|
return m_object.not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PropertyTreeObjectMemberIterator PropertyTreeObject::find(
|
inline PropertyTreeObjectMemberIterator PropertyTreeObject::find(
|
||||||
const std::string &propertyName) const
|
const std::string &propertyName) const
|
||||||
{
|
{
|
||||||
const boost::property_tree::ptree::const_assoc_iterator
|
const boost::property_tree::ptree::const_assoc_iterator itr = m_object.find(propertyName);
|
||||||
itr = object.find(propertyName);
|
|
||||||
|
|
||||||
if (itr != object.not_found()) {
|
if (itr != m_object.not_found()) {
|
||||||
return itr;
|
return itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return object.not_found();
|
return m_object.not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace adapters
|
} // namespace adapters
|
||||||
|
Loading…
Reference in New Issue
Block a user