libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
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>

Public Types

enum  ObjType { 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
}
 

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 duration in seconds. More...
 
std::string getdidl () const
 Get a DIDL document suitable for sending to a mediaserver. More...
 
void clear ()
 
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
 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. 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. The idea is that 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 duration in seconds.

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_props

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

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.

If there is a "role" attribute for a given property, the value is stored under a prop key (e.g. props["upnp:artist@role"] = "Composer")

◆ 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: