diff options
author | Max Kellermann <max@duempel.org> | 2014-01-14 12:36:15 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-14 13:37:21 +0100 |
commit | ddc75cc46b35639bfbb8fe014070d8948a259dad (patch) | |
tree | f6544564c362d8896509b145c43ae352eb607255 /src/db/upnp/Directory.hxx | |
parent | dafd0bc49a1a2d6d60b6c3f6231e153b14bf85a1 (diff) | |
download | mpd-ddc75cc46b35639bfbb8fe014070d8948a259dad.tar.gz mpd-ddc75cc46b35639bfbb8fe014070d8948a259dad.tar.xz mpd-ddc75cc46b35639bfbb8fe014070d8948a259dad.zip |
db/upnp/Directory: merge m_containers and m_items
There is no use in duplicating these containers. It only means that
we have to search both, duplicating the code.
Diffstat (limited to 'src/db/upnp/Directory.hxx')
-rw-r--r-- | src/db/upnp/Directory.hxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/db/upnp/Directory.hxx b/src/db/upnp/Directory.hxx index 55dc09c71..3324b2232 100644 --- a/src/db/upnp/Directory.hxx +++ b/src/db/upnp/Directory.hxx @@ -21,6 +21,7 @@ #define MPD_UPNP_DIRECTORY_HXX #include "Object.hxx" +#include "Compiler.h" #include <string> #include <vector> @@ -33,8 +34,16 @@ class Error; */ class UPnPDirContent { public: - std::vector<UPnPDirObject> m_containers; - std::vector<UPnPDirObject> m_items; + std::vector<UPnPDirObject> objects; + + gcc_pure + const UPnPDirObject *FindObject(const char *name) const { + for (const auto &o : objects) + if (o.name == name) + return &o; + + return nullptr; + } /** * Parse from DIDL-Lite XML data. |