aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/upnp/Directory.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-10 20:18:13 +0100
committerMax Kellermann <max@duempel.org>2014-01-10 22:56:52 +0100
commit09b00fa4e318af53821318a502010eb10b5064de (patch)
treefeb8ee2b333568fda611d87158514e85917bef34 /src/db/upnp/Directory.cxx
parent74842fd6d4d1cd35c7e80935e42d9b010751be49 (diff)
downloadmpd-09b00fa4e318af53821318a502010eb10b5064de.tar.gz
mpd-09b00fa4e318af53821318a502010eb10b5064de.tar.xz
mpd-09b00fa4e318af53821318a502010eb10b5064de.zip
db/upnp/Object: use strictly-typed enums
At the same time, rename the enum types and the class attributes, and add an "UNKNOWN" type/class. The latter avoids the "-1" hack.
Diffstat (limited to 'src/db/upnp/Directory.cxx')
-rw-r--r--src/db/upnp/Directory.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/db/upnp/Directory.cxx b/src/db/upnp/Directory.cxx
index 895e767be..da55f08e5 100644
--- a/src/db/upnp/Directory.cxx
+++ b/src/db/upnp/Directory.cxx
@@ -56,9 +56,9 @@ public:
:m_dir(dir)
{
m_okitems["object.item.audioItem.musicTrack"] =
- UPnPDirObject::audioItem_musicTrack;
+ UPnPDirObject::ItemClass::MUSIC;
m_okitems["object.item.playlistItem"] =
- UPnPDirObject::audioItem_playlist;
+ UPnPDirObject::ItemClass::PLAYLIST;
}
UPnPDirContent& m_dir;
@@ -74,7 +74,7 @@ protected:
case 'c':
if (!strcmp(name, "container")) {
m_tobj.clear();
- m_tobj.m_type = UPnPDirObject::container;
+ m_tobj.type = UPnPDirObject::Type::CONTAINER;
m_tobj.m_id = m_path.back().attributes["id"];
m_tobj.m_pid = m_path.back().attributes["parentID"];
}
@@ -82,7 +82,7 @@ protected:
case 'i':
if (!strcmp(name, "item")) {
m_tobj.clear();
- m_tobj.m_type = UPnPDirObject::item;
+ m_tobj.type = UPnPDirObject::Type::ITEM;
m_tobj.m_id = m_path.back().attributes["id"];
m_tobj.m_pid = m_path.back().attributes["parentID"];
}
@@ -96,14 +96,14 @@ protected:
bool ok = !m_tobj.m_id.empty() && !m_tobj.m_pid.empty() &&
!m_tobj.m_title.empty();
- if (ok && m_tobj.m_type == UPnPDirObject::item) {
+ if (ok && m_tobj.type == UPnPDirObject::Type::ITEM) {
auto it = m_okitems.find(m_tobj.m_props["upnp:class"]);
if (it == m_okitems.end()) {
PLOGINF("checkobjok: found object of unknown class: [%s]\n",
m_tobj.m_props["upnp:class"].c_str());
ok = false;
} else {
- m_tobj.m_iclass = it->second;
+ m_tobj.item_class = it->second;
}
}