18 #ifndef _UPNPDIRCONTENT_H_X_INCLUDED_ 19 #define _UPNPDIRCONTENT_H_X_INCLUDED_ 28 #include "libupnpp/upnpavutils.hxx" 45 std::map<std::string, std::string>
m_props;
49 const auto it = m_props.find(
"protocolInfo");
50 if (it == m_props.end()) {
53 return UPnPP::parseProtoInfEntry(it->second, e);
68 enum ObjType {objtnone = -1, item, container};
76 enum ItemClass {ITC_audioItem = 0, ITC_playlist = 1,
79 ITC_audioItem_musicTrack = ITC_audioItem,
80 ITC_audioItem_playlist = ITC_playlist
91 const std::map<std::string, std::string>& a)
94 attrs =
new std::map<std::string, std::string>(a);
101 attrs =
new std::map<std::string, std::string>(*l.attrs);
110 std::map <std::string, std::string> *attrs{
nullptr};
112 typedef std::map<std::string, std::vector<PropertyValue>> PropertyMap;
143 std::shared_ptr<PropertyMap> m_allprops{std::shared_ptr<PropertyMap>()};
160 bool getprop(
const std::string& name, std::string& value)
const {
161 const auto it = m_props.find(name);
162 if (it == m_props.end())
173 const std::string&
getprop(
const std::string& name)
const {
174 const auto it = m_props.find(name);
175 return (it == m_props.end()) ? nullstr : it->second;
186 bool getrprop(
unsigned int ridx,
const std::string& nm, std::string& val)
188 if (ridx >= m_resources.size())
190 const auto it = m_resources[ridx].m_props.find(nm);
191 if (it == m_resources[ridx].m_props.end())
200 std::string
f2s(
const std::string& nm,
bool isresfield) {
203 getrprop(0, nm, val);
216 if (!getrprop(ridx,
"duration", sdur)) {
220 return UPnPP::upnpdurationtos(sdur);
229 std::string getdidl()
const;
231 void clear(
bool detailed=
false) {
236 m_iclass = ITC_unknown;
239 m_allprops = std::shared_ptr<PropertyMap>(
new PropertyMap);
241 m_allprops = std::shared_ptr<PropertyMap>();
247 std::string dump()
const {
248 std::ostringstream os;
249 os <<
"UPnPDirObject: " << (m_type == item ?
"item" :
"container") <<
250 " id [" << m_id <<
"] pid [" << m_pid <<
251 "] title [" << m_title <<
"]" << std::endl;
252 os <<
"Properties: " << std::endl;
253 for (std::map<std::string,std::string>::const_iterator it =
255 it != m_props.end(); it++) {
256 os <<
"[" << it->first <<
"]->[" << it->second <<
"] " 259 os <<
"Resources:" << std::endl;
260 for (std::vector<UPnPResource>::const_iterator it =
261 m_resources.begin(); it != m_resources.end(); it++) {
262 os <<
" Uri [" << it->m_uri <<
"]" << std::endl;
263 os <<
" Resource attributes:" << std::endl;
264 for (std::map<std::string, std::string>::const_iterator it1 =
266 it1 != it->m_props.end(); it1++) {
267 os <<
" [" << it1->first <<
"]->[" << it1->second <<
"] " 278 std::string m_didlfrag;
279 static std::string nullstr;
288 std::vector<UPnPDirObject> m_containers;
289 std::vector<UPnPDirObject> m_items;
293 m_containers.clear();
312 bool parse(
const std::string& didltext,
bool detailed =
false);
Definition: cdircontent.cxx:41
ItemClass m_iclass
Item type details.
Definition: cdircontent.hxx:126
const std::string & getprop(const std::string &name) const
Get named property.
Definition: cdircontent.hxx:173
std::string m_uri
URI Value.
Definition: cdircontent.hxx:42
std::string m_title
Value of dc:title.
Definition: cdircontent.hxx:122
std::vector< UPnPResource > m_resources
Resources: there may be several, for example for different audio formats of the same track...
Definition: cdircontent.hxx:148
bool protoInfo(UPnPP::ProtocolinfoEntry &e) const
Get the protocolinfo attribute in cooked form.
Definition: cdircontent.hxx:48
bool getprop(const std::string &name, std::string &value) const
Get named property.
Definition: cdircontent.hxx:160
std::map< std::string, std::string > m_props
Basic/compat storage for the properties, with multiple values concatenated.
Definition: cdircontent.hxx:136
Decoded protocolinfo entry data.
Definition: upnpavutils.hxx:39
int getDurationSeconds(unsigned ridx=0) const
Return resource duration in seconds.
Definition: cdircontent.hxx:214
std::string m_id
Object Id.
Definition: cdircontent.hxx:118
std::map< std::string, std::string > m_props
Resource attributes.
Definition: cdircontent.hxx:45
Image of a MediaServer Directory Service container (directory), possibly containing items and subordi...
Definition: cdircontent.hxx:286
A PropertyValue object describes one instance of a property (the name of which is the key in the pare...
Definition: cdircontent.hxx:88
UPnP resource.
Definition: cdircontent.hxx:39
std::string m_pid
Parent Object Id.
Definition: cdircontent.hxx:120
UPnP Media Server directory entry, converted from XML data.
Definition: cdircontent.hxx:62
std::string f2s(const std::string &nm, bool isresfield)
Simplified interface to retrieving values: we don't distinguish between non-existing and empty...
Definition: cdircontent.hxx:200
bool getrprop(unsigned int ridx, const std::string &nm, std::string &val) const
Get named resource attribute.
Definition: cdircontent.hxx:186
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition: avlastchg.cxx:27
ObjType m_type
Item or container.
Definition: cdircontent.hxx:124