diff --git a/src/SerializedObject.cpp b/src/SerializedObject.cpp index afd876410..1477a2393 100644 --- a/src/SerializedObject.cpp +++ b/src/SerializedObject.cpp @@ -206,6 +206,8 @@ bool STObject::isValidForType() bool STObject::isFieldAllowed(SField::ref field) { + if (isFree()) + return true; BOOST_FOREACH(SOElement::ptr elem, mType) { // are any required elemnents missing if (elem->e_field == field) @@ -242,6 +244,14 @@ std::auto_ptr STObject::deserialize(SerializerIterator& sit, SFi return object; } +bool STObject::hasMatchingEntry(const SerializedType& t) +{ + const SerializedType* o = peekAtPField(t.getFName()); + if (!o) + return false; + return t == *o; +} + std::string STObject::getFullText() const { std::string ret; diff --git a/src/SerializedObject.h b/src/SerializedObject.h index 02587d36b..75d9ca64c 100644 --- a/src/SerializedObject.h +++ b/src/SerializedObject.h @@ -156,6 +156,9 @@ public: iterator end() { return mData.end(); } const_iterator begin() const { return mData.begin(); } const_iterator end() const { return mData.end(); } + bool empty() const { return mData.empty(); } + + bool hasMatchingEntry(const SerializedType&); bool operator==(const STObject& o) const; bool operator!=(const STObject& o) const { return ! (*this == o); }