diff options
author | Max Kellermann <max@duempel.org> | 2014-11-08 10:52:35 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-11-08 10:52:35 +0100 |
commit | 5e73007b1d44589bb9232a73b534814414bc56d7 (patch) | |
tree | 66cb07b0a74523a381dd686e1889624ccab10524 /src/db/plugins | |
parent | 2d9876a261d62192b5ce976eae376ac4e1fd4b38 (diff) | |
download | mpd-5e73007b1d44589bb9232a73b534814414bc56d7.tar.gz mpd-5e73007b1d44589bb9232a73b534814414bc56d7.tar.xz mpd-5e73007b1d44589bb9232a73b534814414bc56d7.zip |
db/upnp/Object: apply coding style
Diffstat (limited to 'src/db/plugins')
-rw-r--r-- | src/db/plugins/upnp/Directory.cxx | 16 | ||||
-rw-r--r-- | src/db/plugins/upnp/Object.hxx | 19 | ||||
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 14 |
3 files changed, 28 insertions, 21 deletions
diff --git a/src/db/plugins/upnp/Directory.cxx b/src/db/plugins/upnp/Directory.cxx index e94a1a997..c7fd04236 100644 --- a/src/db/plugins/upnp/Directory.cxx +++ b/src/db/plugins/upnp/Directory.cxx @@ -129,7 +129,7 @@ public: state(NONE), tag_type(TAG_NUM_OF_ITEM_TYPES) { - m_tobj.clear(); + m_tobj.Clear(); } protected: @@ -147,31 +147,31 @@ protected: switch (name[0]) { case 'c': if (!strcmp(name, "container")) { - m_tobj.clear(); + m_tobj.Clear(); m_tobj.type = UPnPDirObject::Type::CONTAINER; const char *id = GetAttribute(attrs, "id"); if (id != nullptr) - m_tobj.m_id = id; + m_tobj.id = id; const char *pid = GetAttribute(attrs, "parentID"); if (pid != nullptr) - m_tobj.m_pid = pid; + m_tobj.parent_id = pid; } break; case 'i': if (!strcmp(name, "item")) { - m_tobj.clear(); + m_tobj.Clear(); m_tobj.type = UPnPDirObject::Type::ITEM; const char *id = GetAttribute(attrs, "id"); if (id != nullptr) - m_tobj.m_id = id; + m_tobj.id = id; const char *pid = GetAttribute(attrs, "parentID"); if (pid != nullptr) - m_tobj.m_pid = pid; + m_tobj.parent_id = pid; } break; @@ -198,7 +198,7 @@ protected: } bool checkobjok() { - if (m_tobj.m_id.empty() || m_tobj.m_pid.empty() || + 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)) diff --git a/src/db/plugins/upnp/Object.hxx b/src/db/plugins/upnp/Object.hxx index 16a66c774..55ceafcfa 100644 --- a/src/db/plugins/upnp/Object.hxx +++ b/src/db/plugins/upnp/Object.hxx @@ -50,8 +50,16 @@ public: PLAYLIST, }; - std::string m_id; // ObjectId - std::string m_pid; // Parent ObjectId + /** + * ObjectId + */ + std::string id; + + /** + * Parent's ObjectId + */ + std::string parent_id; + std::string url; /** @@ -71,10 +79,9 @@ public: UPnPDirObject &operator=(UPnPDirObject &&) = default; - void clear() - { - m_id.clear(); - m_pid.clear(); + void Clear() { + id.clear(); + parent_id.clear(); url.clear(); type = Type::UNKNOWN; item_class = ItemClass::UNKNOWN; diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 21ddb8790..f038a668c 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -412,7 +412,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server, // So we return synthetic and ugly paths based on the object id, // which we later have to detect. const std::string path = songPath(server.getFriendlyName(), - dirent.m_id); + dirent.id); if (!visitSong(std::move(dirent), path.c_str(), selection, visit_song, error)) @@ -447,13 +447,13 @@ UpnpDatabase::BuildPath(const ContentDirectoryService &server, std::string &path, Error &error) const { - const char *pid = idirent.m_id.c_str(); + const char *pid = idirent.id.c_str(); path.clear(); UPnPDirObject dirent; while (strcmp(pid, rootid) != 0) { if (!ReadNode(server, pid, dirent, error)) return false; - pid = dirent.m_pid.c_str(); + pid = dirent.parent_id.c_str(); if (path.empty()) path = dirent.name; @@ -509,7 +509,7 @@ UpnpDatabase::Namei(const ContentDirectoryService &server, return false; } - objid = std::move(child->m_id); + objid = std::move(child->id); } } @@ -621,7 +621,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server, } std::string path = songPath(server.getFriendlyName(), - dirent.m_id); + dirent.id); if (!visitSong(std::move(dirent), path.c_str(), selection, visit_song, error)) @@ -640,7 +640,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server, recursion (1-deep) here, which will handle the "add dir" case. */ if (selection.recursive && selection.filter) - return SearchSongs(server, tdirent.m_id.c_str(), selection, + return SearchSongs(server, tdirent.id.c_str(), selection, visit_song, error); const char *const base_uri = selection.uri.empty() @@ -658,7 +658,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server, and loop here, but it's not useful as mpd will only return data to the client when we're done anyway. */ UPnPDirContent dirbuf; - if (!server.readDir(handle, tdirent.m_id.c_str(), dirbuf, + if (!server.readDir(handle, tdirent.id.c_str(), dirbuf, error)) return false; |