libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
UPnPClient::UPnPDirObject Class Reference

UPnP Media Server directory entry, converted from XML data. More...

#include <cdircontent.hxx>

Classes

struct  PropertyValue
 A PropertyValue object describes one instance of a property (the name of which is the key in the parent map), with its attribute values). More...
 

Public Types

enum  ObjType { objtnone = -1, item, container }
 
enum  ItemClass {
  ITC_audioItem = 0, ITC_playlist = 1, ITC_unknown = 2, ITC_videoItem = 3,
  ITC_audioItem_musicTrack = ITC_audioItem, ITC_audioItem_playlist = ITC_playlist
}
 
typedef std::map< std::string, std::vector< PropertyValue > > PropertyMap
 

Public Member Functions

bool getprop (const std::string &name, std::string &value) const
 Get named property. More...
 
const std::string & getprop (const std::string &name) const
 Get named property. More...
 
bool getrprop (unsigned int ridx, const std::string &nm, std::string &val) const
 Get named resource attribute. More...
 
std::string f2s (const std::string &nm, bool isresfield)
 Simplified interface to retrieving values: we don't distinguish between non-existing and empty, and we only use the first ressource.
 
int getDurationSeconds (unsigned ridx=0) const
 Return resource duration in seconds. More...
 
std::string getdidl () const
 Get a DIDL document suitable for sending to a mediaserver. More...
 
void clear (bool detailed=false)
 
std::string dump () const
 

Public Attributes

std::string m_id
 Object Id.
 
std::string m_pid
 Parent Object Id.
 
std::string m_title
 Value of dc:title.
 
ObjType m_type
 Item or container.
 
ItemClass m_iclass
 Item type details.
 
std::map< std::string, std::string > m_props
 Basic/compat storage for the properties, with multiple values concatenated. More...
 
std::shared_ptr< PropertyMap > m_allprops {std::shared_ptr<PropertyMap>()}
 Extended storage for properties, with support for multiple values, and for storing the attributes. More...
 
std::vector< UPnPResourcem_resources
 Resources: there may be several, for example for different audio formats of the same track, each with an URI and descriptor fields. More...
 

Friends

class UPnPDirParser
 

Detailed Description

UPnP Media Server directory entry, converted from XML data.

This is a dumb data holder class, a struct with helpers.

Member Function Documentation

◆ getdidl()

string UPnPClient::UPnPDirObject::getdidl ( ) const

Get a DIDL document suitable for sending to a mediaserver.

Only works for items, not containers. We may have missed useful stuff while parsing the data from the content directory, so we send the original if we can.

◆ getDurationSeconds()

int UPnPClient::UPnPDirObject::getDurationSeconds ( unsigned  ridx = 0) const
inline

Return resource duration in seconds.

Parameters
ridxresource index.
Returns
duration or 1 if the attribute is not found.

◆ getprop() [1/2]

bool UPnPClient::UPnPDirObject::getprop ( const std::string &  name,
std::string &  value 
) const
inline

Get named property.

Parameters
name(e.g. upnp:artist, upnp:album...). Use m_title instead for dc:title.
[out]valuethe parameter value if found
Returns
true if found.

◆ getprop() [2/2]

const std::string& UPnPClient::UPnPDirObject::getprop ( const std::string &  name) const
inline

Get named property.

Parameters
name(e.g. upnp:artist, upnp:album...). Use m_title instead for dc:title.
Returns
value if found, empty string if not found.

◆ getrprop()

bool UPnPClient::UPnPDirObject::getrprop ( unsigned int  ridx,
const std::string &  nm,
std::string &  val 
) const
inline

Get named resource attribute.

Field names: "bitrate", "duration" (H:mm:ss.ms), "nrAudioChannels", "protocolInfo", "sampleFrequency" (Hz), "size" (bytes).

Parameters
ridxindex in resources array.
nmattribute name.

Member Data Documentation

◆ m_allprops

std::shared_ptr<PropertyMap> UPnPClient::UPnPDirObject::m_allprops {std::shared_ptr<PropertyMap>()}

Extended storage for properties, with support for multiple values, and for storing the attributes.

The key is the property name (e.g. "artist"). See PropertyMap and

This is only created if the

Parameters
detailedparse param is true

◆ m_props

std::map<std::string, std::string> UPnPClient::UPnPDirObject::m_props

Basic/compat storage for the properties, with multiple values concatenated.

See m_allprops for an extended version.

Properties as gathered from the XML document (album, artist, etc.), The map keys are the XML tag names except for title which has a proper field. Multiple values for a given key are concatenated with ", " as a separator, possibly qualified by 'role' which is the only attribute we look at.

◆ m_resources

std::vector<UPnPResource> UPnPClient::UPnPDirObject::m_resources

Resources: there may be several, for example for different audio formats of the same track, each with an URI and descriptor fields.


The documentation for this class was generated from the following files: