00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef __UPNPCDSOBJECTS_H_
00012 #define __UPNPCDSOBJECTS_H_
00013
00014 #include <qdom.h>
00015 #include <qdatetime.h>
00016 #include <qtextstream.h>
00017 #include <qdict.h>
00018 #include <qptrlist.h>
00019
00020 class CDSObject;
00021
00023
00025
00026 typedef enum
00027 {
00028 OT_Undefined = 0,
00029 OT_Container = 1,
00030 OT_Item = 2,
00031 OT_Res = 3
00032
00033 } ObjectTypes;
00034
00036
00038
00039 class Property
00040 {
00041 public:
00042
00043 QString m_sName;
00044 QString m_sNameSpace;
00045 bool m_bRequired;
00046 QString m_sValue;
00047
00048 public:
00049
00050 Property( const QString &sName,
00051 const QString &sNameSpace = "",
00052 bool bRequired = false,
00053 const QString &sValue = "" )
00054 {
00055 m_sName = sName;
00056 m_sNameSpace = sNameSpace;
00057 m_bRequired = bRequired;
00058 m_sValue = sValue;
00059 }
00060 };
00061
00062 typedef QDict < Property > Properties;
00063 typedef QDictIterator< Property > PropertiesIterator;
00064 typedef QPtrList < CDSObject> CDSObjects;
00065
00067
00069
00070 class Resource
00071 {
00072 public:
00073
00074 QString m_sProtocolInfo;
00075 QString m_sURI;
00076
00077 NameValueList m_lstAttributes;
00078
00079 public:
00080
00081 Resource( const QString &sProtocolInfo,
00082 const QString &sURI )
00083 {
00084 m_sProtocolInfo = sProtocolInfo;
00085 m_sURI = sURI;
00086 }
00087
00088 void AddAttribute( const QString &sName,
00089 const QString &sValue )
00090 {
00091 m_lstAttributes.append( new NameValue( sName, sValue ));
00092 }
00093 };
00094
00095 typedef QPtrList < Resource > Resources;
00096
00098
00100
00101 class ContainerClass
00102 {
00103 public:
00104
00105 QString m_sClass;
00106 QString m_sName;
00107 bool m_bIncludeDerived;
00108
00109 public:
00110
00111 ContainerClass( const QString &sClass,
00112 const QString &sName,
00113 bool bIncludeDerived )
00114 {
00115 m_sClass = sClass;
00116 m_sName = sName;
00117 m_bIncludeDerived = bIncludeDerived;
00118 }
00119 };
00120
00121 typedef QPtrList < ContainerClass > Classes;
00122
00124
00125 class CDSObject
00126 {
00127 public:
00128 short m_nUpdateId;
00129
00130 ObjectTypes m_eType;
00131
00132
00133
00134 QString m_sId;
00135 QString m_sParentId;
00136 QString m_sTitle;
00137 QString m_sClass;
00138 bool m_bRestricted;
00139 bool m_bSearchable;
00140
00141
00142
00143 QString m_sCreator;
00144 QString m_sWriteStatus;
00145
00146
00147
00148 Classes m_SearchClass;
00149 Classes m_CreateClass;
00150
00151
00152
00153 Properties m_properties;
00154 CDSObjects m_children;
00155 long m_nChildCount;
00156
00157 Resources m_resources;
00158
00159
00160 public:
00161
00162 CDSObject( const QString sId = "-1",
00163 const QString sTitle = "",
00164 const QString sParentId = "-1" );
00165 virtual ~CDSObject();
00166
00167 Property *AddProperty( Property *pProp );
00168 CDSObject *AddChild ( CDSObject *pChild );
00169
00170 ContainerClass *AddSearchClass( ContainerClass *pClass );
00171 ContainerClass *AddCreateClass( ContainerClass *pClass );
00172
00173 void SetPropValue( QString sName, QString sValue );
00174 QString GetPropValue( QString sName );
00175
00176 QString toXml ();
00177 void toXml ( QTextStream &os );
00178
00179 long GetChildCount();
00180 void SetChildCount( long nCount );
00181
00182 Resource *AddResource( QString sProtocol, QString sURI );
00183
00184 public:
00185
00186 static CDSObject *CreateItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00187 static CDSObject *CreateContainer ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00188 static CDSObject *CreateAudioItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00189 static CDSObject *CreateMusicTrack ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00190 static CDSObject *CreateAudioBroadcast ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00191 static CDSObject *CreateAudioBook ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00192 static CDSObject *CreateVideoItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00193 static CDSObject *CreateMovie ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00194 static CDSObject *CreateVideoBroadcast ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00195 static CDSObject *CreateMusicVideoClip ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00196 static CDSObject *CreateImageItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00197 static CDSObject *CreatePhoto ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00198 static CDSObject *CreatePlaylistItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00199 static CDSObject *CreateTextItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00200 static CDSObject *CreateAlbum ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00201 static CDSObject *CreateMusicAlbum ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00202 static CDSObject *CreatePhotoAlbum ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00203 static CDSObject *CreateGenre ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00204 static CDSObject *CreateMusicGenre ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00205 static CDSObject *CreateMovieGenre ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00206 static CDSObject *CreatePlaylistContainer( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00207 static CDSObject *CreatePerson ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00208 static CDSObject *CreateMusicArtist ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00209 static CDSObject *CreateStorageSystem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00210 static CDSObject *CreateStorageVolume ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00211 static CDSObject *CreateStorageFolder ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject = NULL );
00212
00213 };
00214
00215 #endif