|
a/libupnpp/control/mediaserver.cxx |
|
b/libupnpp/control/mediaserver.cxx |
|
... |
|
... |
17 |
|
17 |
|
18 |
#include "libupnpp/config.h"
|
18 |
#include "libupnpp/config.h"
|
19 |
|
19 |
|
20 |
#include "libupnpp/control/mediaserver.hxx"
|
20 |
#include "libupnpp/control/mediaserver.hxx"
|
21 |
|
21 |
|
22 |
#include UNORDERED_MAP_INCLUDE
|
22 |
#include <unordered_map>
|
23 |
#include <ostream> // for endl
|
23 |
#include <ostream> // for endl
|
24 |
#include <string> // for string
|
24 |
#include <string> // for string
|
25 |
#include <utility> // for pair
|
25 |
#include <utility> // for pair
|
26 |
#include <vector> // for vector
|
26 |
#include <vector> // for vector
|
27 |
|
27 |
|
|
... |
|
... |
29 |
#include "libupnpp/control/description.hxx" // for UPnPDeviceDesc, etc
|
29 |
#include "libupnpp/control/description.hxx" // for UPnPDeviceDesc, etc
|
30 |
#include "libupnpp/control/discovery.hxx" // for UPnPDeviceDirectory, etc
|
30 |
#include "libupnpp/control/discovery.hxx" // for UPnPDeviceDirectory, etc
|
31 |
#include "libupnpp/log.hxx" // for LOGERR
|
31 |
#include "libupnpp/log.hxx" // for LOGERR
|
32 |
|
32 |
|
33 |
using namespace std;
|
33 |
using namespace std;
|
34 |
using namespace STD_PLACEHOLDERS;
|
34 |
using namespace std::placeholders;
|
35 |
using namespace UPnPP;
|
35 |
using namespace UPnPP;
|
36 |
|
36 |
|
37 |
namespace UPnPClient {
|
37 |
namespace UPnPClient {
|
38 |
|
38 |
|
39 |
const string
|
39 |
const string
|
|
... |
|
... |
45 |
{
|
45 |
{
|
46 |
const string::size_type sz(DType.size()-2);
|
46 |
const string::size_type sz(DType.size()-2);
|
47 |
return !DType.compare(0, sz, st, 0, sz);
|
47 |
return !DType.compare(0, sz, st, 0, sz);
|
48 |
}
|
48 |
}
|
49 |
|
49 |
|
50 |
static bool MDAccum(STD_UNORDERED_MAP<string, UPnPDeviceDesc>* out,
|
50 |
static bool MDAccum(std::unordered_map<string, UPnPDeviceDesc>* out,
|
51 |
const string& friendlyName,
|
51 |
const string& friendlyName,
|
52 |
const UPnPDeviceDesc& device,
|
52 |
const UPnPDeviceDesc& device,
|
53 |
const UPnPServiceDesc& service)
|
53 |
const UPnPServiceDesc& service)
|
54 |
{
|
54 |
{
|
55 |
//LOGDEB("MDAccum: friendlyname: " << friendlyName <<
|
55 |
//LOGDEB("MDAccum: friendlyname: " << friendlyName <<
|
|
... |
|
... |
64 |
}
|
64 |
}
|
65 |
|
65 |
|
66 |
bool MediaServer::getDeviceDescs(vector<UPnPDeviceDesc>& devices,
|
66 |
bool MediaServer::getDeviceDescs(vector<UPnPDeviceDesc>& devices,
|
67 |
const string& friendlyName)
|
67 |
const string& friendlyName)
|
68 |
{
|
68 |
{
|
69 |
STD_UNORDERED_MAP<string, UPnPDeviceDesc> mydevs;
|
69 |
std::unordered_map<string, UPnPDeviceDesc> mydevs;
|
70 |
|
70 |
|
71 |
UPnPDeviceDirectory::Visitor visitor = bind(MDAccum, &mydevs, friendlyName,
|
71 |
UPnPDeviceDirectory::Visitor visitor = bind(MDAccum, &mydevs, friendlyName,
|
72 |
_1, _2);
|
72 |
_1, _2);
|
73 |
UPnPDeviceDirectory::getTheDir()->traverse(visitor);
|
73 |
UPnPDeviceDirectory::getTheDir()->traverse(visitor);
|
74 |
for (STD_UNORDERED_MAP<string, UPnPDeviceDesc>::iterator it = mydevs.begin();
|
74 |
for (std::unordered_map<string, UPnPDeviceDesc>::iterator it = mydevs.begin();
|
75 |
it != mydevs.end(); it++)
|
75 |
it != mydevs.end(); it++)
|
76 |
devices.push_back(it->second);
|
76 |
devices.push_back(it->second);
|
77 |
return !devices.empty();
|
77 |
return !devices.empty();
|
78 |
}
|
78 |
}
|
79 |
|
79 |
|