db/upnp/Directory: move checkobjok() to class UPnPDirObject
This commit is contained in:
parent
5e73007b1d
commit
e67afc35b8
@ -197,16 +197,6 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkobjok() {
|
|
||||||
if (m_tobj.id.empty() || m_tobj.parent_id.empty() ||
|
|
||||||
m_tobj.name.empty() ||
|
|
||||||
(m_tobj.type == UPnPDirObject::Type::ITEM &&
|
|
||||||
m_tobj.item_class == UPnPDirObject::ItemClass::UNKNOWN))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void EndElement(const XML_Char *name)
|
virtual void EndElement(const XML_Char *name)
|
||||||
{
|
{
|
||||||
if (tag_type != TAG_NUM_OF_ITEM_TYPES) {
|
if (tag_type != TAG_NUM_OF_ITEM_TYPES) {
|
||||||
@ -223,7 +213,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!strcmp(name, "container") || !strcmp(name, "item")) &&
|
if ((!strcmp(name, "container") || !strcmp(name, "item")) &&
|
||||||
checkobjok()) {
|
m_tobj.Check()) {
|
||||||
tag.Commit(m_tobj.tag);
|
tag.Commit(m_tobj.tag);
|
||||||
m_dir.objects.emplace_back(std::move(m_tobj));
|
m_dir.objects.emplace_back(std::move(m_tobj));
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define MPD_UPNP_OBJECT_HXX
|
#define MPD_UPNP_OBJECT_HXX
|
||||||
|
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -87,6 +88,13 @@ public:
|
|||||||
item_class = ItemClass::UNKNOWN;
|
item_class = ItemClass::UNKNOWN;
|
||||||
tag.Clear();
|
tag.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
|
bool Check() const {
|
||||||
|
return !id.empty() && !parent_id.empty() && !name.empty() &&
|
||||||
|
(type != UPnPDirObject::Type::ITEM ||
|
||||||
|
item_class != UPnPDirObject::ItemClass::UNKNOWN);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _UPNPDIRCONTENT_H_X_INCLUDED_ */
|
#endif /* _UPNPDIRCONTENT_H_X_INCLUDED_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user