mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Type STObject helper functions, 'empty' and 'hasMatchingEntry'.
A small 'isFieldAllowed' bugfix.
This commit is contained in:
@@ -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<SerializedType> 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;
|
||||
|
||||
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user