00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013 #include <QTextStream>
00014 #include <QTextCodec>
00015 #include <QUrl>
00016
00017 #include "upnpcds.h"
00018
00019 inline QString GetBool( bool bVal ) { return( (bVal) ? "1" : "0" ); }
00020
00023
00024
00025
00028
00029 CDSObject::CDSObject( const QString sId,
00030 const QString sTitle,
00031 const QString sParentId )
00032 : m_nUpdateId(1), m_eType(OT_Container),
00033 m_sId(HTTPRequest::Encode(sId)),
00034 m_sParentId(HTTPRequest::Encode(sParentId)),
00035 m_sTitle(HTTPRequest::Encode(sTitle)),
00036 m_bRestricted(true), m_bSearchable(false),
00037 m_sWriteStatus("PROTECTED"), m_nChildCount(-1)
00038 {
00039 }
00040
00042
00044
00045 CDSObject::~CDSObject()
00046 {
00047 while (!m_resources.empty())
00048 {
00049 delete m_resources.back();
00050 m_resources.pop_back();
00051 }
00052
00053 while (!m_children.empty())
00054 {
00055 delete m_children.back();
00056 m_children.pop_back();
00057 }
00058
00059 Properties::iterator it = m_properties.begin();
00060 for (; it != m_properties.end(); ++it)
00061 delete *it;
00062 m_properties.clear();
00063 }
00064
00066
00068
00069 Property *CDSObject::AddProperty( Property *pProp )
00070 {
00071 if (pProp)
00072 {
00073 Properties::iterator it = m_properties.find(pProp->m_sName);
00074 if (it != m_properties.end())
00075 {
00076 delete *it;
00077 m_properties.erase(it);
00078 }
00079 m_properties[pProp->m_sName] = pProp;
00080 }
00081
00082 return pProp;
00083 }
00084
00086
00088
00089 Property *CDSObject::GetProperty( QString sName )
00090 {
00091 Properties::iterator it = m_properties.find(sName);
00092 if (it != m_properties.end() && *it)
00093 return (*it);
00094
00095 return 0;
00096 }
00097
00099
00101
00102 void CDSObject::SetPropValue( QString sName, QString sValue )
00103 {
00104 Properties::iterator it = m_properties.find(sName);
00105 if (it != m_properties.end() && *it)
00106 {
00107 (*it)->m_sValue = HTTPRequest::Encode(sValue);
00108 }
00109 }
00110
00112
00114
00115 QString CDSObject::GetPropValue(const QString &sName) const
00116 {
00117 Properties::const_iterator it = m_properties.find(sName);
00118
00119 if (it != m_properties.end() && *it)
00120 return QUrl::fromPercentEncoding((*it)->m_sValue.toUtf8());
00121
00122 return "";
00123 }
00124
00126
00128
00129 CDSObject *CDSObject::AddChild( CDSObject *pChild )
00130 {
00131 if (pChild)
00132 {
00133 pChild->m_sParentId = m_sId;
00134 m_children.append( pChild );
00135 }
00136
00137 return( pChild );
00138 }
00139
00141
00143
00144 long CDSObject::GetChildCount(void) const
00145 {
00146 long nCount = m_children.count();
00147 if ( nCount == 0)
00148 return( m_nChildCount );
00149
00150 return( nCount );
00151 }
00152
00154
00156
00157 Resource *CDSObject::AddResource( QString sProtocol, QString sURI )
00158 {
00159 Resource *pRes = new Resource( sProtocol, sURI );
00160
00161 m_resources.append( pRes );
00162
00163 return( pRes );
00164 }
00165
00167
00169
00170 void CDSObject::SetChildCount( long nCount )
00171 {
00172 m_nChildCount = nCount;
00173 }
00174
00176
00178
00179 QString CDSObject::toXml( FilterMap &filter ) const
00180 {
00181 QString sXML;
00182 QTextStream os( &sXML, QIODevice::WriteOnly );
00183 os.setCodec(QTextCodec::codecForName("UTF-8"));
00184 toXml(os, filter);
00185 os << flush;
00186 return( sXML );
00187 }
00188
00190
00192
00193 void CDSObject::toXml(QTextStream &os, FilterMap &filter) const
00194 {
00195 QString sEndTag = "";
00196 bool bFilter = true;
00197
00198 if (filter.indexOf( "*" ) != -1)
00199 bFilter = false;
00200
00201 switch( m_eType )
00202 {
00203 case OT_Container:
00204 {
00205 os << "<container id=\"" << m_sId << "\" parentID=\"" << m_sParentId
00206 << "\" childCount=\"" << GetChildCount() << "\" restricted=\"" << GetBool( m_bRestricted )
00207 << "\" searchable=\"" << GetBool( m_bSearchable ) << "\" >";
00208
00209 sEndTag = "</container>";
00210
00211 break;
00212 }
00213 case OT_Item:
00214 {
00215 os << "<item id=\"" << m_sId << "\" parentID=\"" << m_sParentId
00216 << "\" restricted=\"" << GetBool( m_bRestricted ) << "\" >";
00217
00218 sEndTag = "</item>";
00219
00220 break;
00221 }
00222 default: break;
00223 }
00224
00225 os << "<dc:title>" << m_sTitle << "</dc:title>";
00226 os << "<upnp:class>" << m_sClass << "</upnp:class>";
00227
00228
00229
00230
00231
00232 Properties::const_iterator it = m_properties.begin();
00233 for (; it != m_properties.end(); ++it)
00234 {
00235 const Property *pProp = *it;
00236
00237 if (pProp->m_bRequired || (pProp->m_sValue.length() > 0))
00238 {
00239 QString sName;
00240
00241 if (pProp->m_sNameSpace.length() > 0)
00242 sName = pProp->m_sNameSpace + ':' + pProp->m_sName;
00243 else
00244 sName = pProp->m_sName;
00245
00246 if (pProp->m_bRequired || !bFilter
00247 || ( filter.indexOf( sName ) != -1))
00248 {
00249 os << "<" << sName;
00250
00251 NameValues::const_iterator nit = pProp->m_lstAttributes.begin();
00252 for (; nit != pProp->m_lstAttributes.end(); ++ nit)
00253 os << " " <<(*nit).sName << "=\"" << (*nit).sValue << "\"";
00254
00255 os << ">";
00256 os << pProp->m_sValue;
00257 os << "</" << sName << ">";
00258 }
00259 }
00260 }
00261
00262
00263
00264
00265
00266 Resources::const_iterator rit = m_resources.begin();
00267 for (; rit != m_resources.end(); ++rit)
00268 {
00269 os << "<res protocolInfo=\"" << (*rit)->m_sProtocolInfo << "\" ";
00270
00271 NameValues::const_iterator nit = (*rit)->m_lstAttributes.begin();
00272 for (; nit != (*rit)->m_lstAttributes.end(); ++ nit)
00273 os << (*nit).sName << "=\"" << (*nit).sValue << "\" ";
00274
00275 os << ">" << (*rit)->m_sURI;
00276 os << "</res>\r\n";
00277 }
00278
00279
00280
00281
00282
00283 CDSObjects::const_iterator cit = m_children.begin();
00284 for (; cit != m_children.end(); ++cit)
00285 (*cit)->toXml(os, filter);
00286
00287
00288
00289
00290
00291 os << sEndTag;
00292 os << flush;
00293 }
00294
00295
00297
00299
00300 CDSObject *CDSObject::CreateItem( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00301 {
00302 if (pObject == NULL)
00303 {
00304 pObject = new CDSObject( sId, sTitle, sParentId );
00305 pObject->m_sClass = "object.item";
00306 }
00307
00308 pObject->m_eType = OT_Item;
00309
00310 pObject->AddProperty( new Property( "refID" ) );
00311
00312 return( pObject );
00313 }
00314
00316
00317 CDSObject *CDSObject::CreateContainer( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00318 {
00319 if (pObject == NULL)
00320 {
00321 pObject = new CDSObject( sId, sTitle, sParentId );
00322 pObject->m_sClass = "object.container";
00323 }
00324
00325 pObject->m_eType = OT_Container;
00326
00327 pObject->AddProperty( new Property( "childCount" ));
00328 pObject->AddProperty( new Property( "createClass" ));
00329 pObject->AddProperty( new Property( "searchClass" ));
00330 pObject->AddProperty( new Property( "searchable" ));
00331
00332 return( pObject );
00333 }
00334
00336
00337 CDSObject *CDSObject::CreateAudioItem( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00338 {
00339 if (pObject == NULL)
00340 {
00341 pObject = new CDSObject( sId, sTitle, sParentId );
00342 pObject->m_sClass = "object.item.audioItem";
00343 }
00344
00345 CreateItem( sId, sTitle, sParentId, pObject );
00346
00347 pObject->AddProperty( new Property( "genre" , "upnp" ));
00348 pObject->AddProperty( new Property( "description" , "dc" ));
00349 pObject->AddProperty( new Property( "longDescription" , "upnp" ));
00350 pObject->AddProperty( new Property( "publisher" , "dc" ));
00351 pObject->AddProperty( new Property( "language" , "dc" ));
00352 pObject->AddProperty( new Property( "relation" , "dc" ));
00353 pObject->AddProperty( new Property( "rights" , "dc" ));
00354
00355 return( pObject );
00356 }
00357
00359
00360 CDSObject *CDSObject::CreateMusicTrack( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00361 {
00362 if (pObject == NULL)
00363 {
00364 pObject = new CDSObject( sId, sTitle, sParentId );
00365 pObject->m_sClass = "object.item.audioItem.musicTrack";
00366 }
00367
00368 CreateAudioItem( sId, sTitle, sParentId, pObject );
00369
00370 pObject->AddProperty( new Property( "artist" , "upnp" ));
00371 pObject->AddProperty( new Property( "album" , "upnp" ));
00372 pObject->AddProperty( new Property( "originalTrackNumber" , "upnp" ));
00373 pObject->AddProperty( new Property( "playlist" , "upnp" ));
00374 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00375 pObject->AddProperty( new Property( "contributor" , "dc" ));
00376 pObject->AddProperty( new Property( "date" , "dc" ));
00377
00378 pObject->AddProperty( new Property( "albumArtURI" , "upnp" ));
00379
00380 return( pObject );
00381 }
00382
00384
00385 CDSObject *CDSObject::CreateAudioBroadcast( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00386 {
00387 if (pObject == NULL)
00388 {
00389 pObject = new CDSObject( sId, sTitle, sParentId );
00390 pObject->m_sClass = "object.item.audioItem.audioBroadcast";
00391 }
00392
00393 CreateAudioItem( sId, sTitle, sParentId, pObject );
00394
00395 pObject->AddProperty( new Property( "region" , "upnp" ));
00396 pObject->AddProperty( new Property( "radioCallSign" , "upnp" ));
00397 pObject->AddProperty( new Property( "radioStationID" , "upnp" ));
00398 pObject->AddProperty( new Property( "radioBand" , "upnp" ));
00399 pObject->AddProperty( new Property( "channelNr" , "upnp" ));
00400
00401 return( pObject );
00402 }
00403
00405
00406 CDSObject *CDSObject::CreateAudioBook( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00407 {
00408 if (pObject == NULL)
00409 {
00410 pObject = new CDSObject( sId, sTitle, sParentId );
00411 pObject->m_sClass = "object.item.audioItem.audioBook";
00412 }
00413
00414 CreateAudioItem( sId, sTitle, sParentId, pObject );
00415
00416 pObject->AddProperty( new Property( "storageMedium", "upnp" ));
00417 pObject->AddProperty( new Property( "producer" , "upnp" ));
00418 pObject->AddProperty( new Property( "contributor" , "dc" ));
00419 pObject->AddProperty( new Property( "date" , "dc" ));
00420
00421 return( pObject );
00422 }
00423
00425
00426 CDSObject *CDSObject::CreateVideoItem( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00427 {
00428 if (pObject == NULL)
00429 {
00430 pObject = new CDSObject( sId, sTitle, sParentId );
00431 pObject->m_sClass = "object.item.videoItem";
00432 }
00433
00434 CreateItem( sId, sTitle, sParentId, pObject );
00435
00436 pObject->AddProperty( new Property( "genre" , "upnp" ));
00437 pObject->AddProperty( new Property( "longDescription", "upnp" ));
00438 pObject->AddProperty( new Property( "producer" , "upnp" ));
00439 pObject->AddProperty( new Property( "rating" , "upnp" ));
00440 pObject->AddProperty( new Property( "actor" , "upnp" ));
00441 pObject->AddProperty( new Property( "director" , "upnp" ));
00442 pObject->AddProperty( new Property( "description" , "dc" ));
00443 pObject->AddProperty( new Property( "publisher" , "dc" ));
00444 pObject->AddProperty( new Property( "language" , "dc" ));
00445 pObject->AddProperty( new Property( "relation" , "dc" ));
00446
00447
00448
00449 pObject->AddProperty( new Property( "creator" , "dc" ));
00450 pObject->AddProperty( new Property( "artist" , "upnp" ));
00451 pObject->AddProperty( new Property( "album" , "upnp" ));
00452 pObject->AddProperty( new Property( "date" , "dc" ));
00453
00454 pObject->AddProperty( new Property( "albumArtURI" , "upnp" ));
00455
00456 return( pObject );
00457 }
00458
00460
00461 CDSObject *CDSObject::CreateMovie( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00462 {
00463 if (pObject == NULL)
00464 {
00465 pObject = new CDSObject( sId, sTitle, sParentId );
00466 pObject->m_sClass = "object.item.videoItem.movie";
00467 }
00468
00469 CreateVideoItem( sId, sTitle, sParentId, pObject );
00470
00471 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00472 pObject->AddProperty( new Property( "DVDRegionCode" , "upnp" ));
00473 pObject->AddProperty( new Property( "channelName" , "upnp" ));
00474 pObject->AddProperty( new Property( "scheduledStartTime", "upnp" ));
00475 pObject->AddProperty( new Property( "scheduledEndTime" , "upnp" ));
00476
00477 return( pObject );
00478 }
00479
00481
00482 CDSObject *CDSObject::CreateVideoBroadcast( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00483 {
00484 if (pObject == NULL)
00485 {
00486 pObject = new CDSObject( sId, sTitle, sParentId );
00487 pObject->m_sClass = "object.item.videoItem.videoBroadcast";
00488 }
00489
00490 CreateVideoItem( sId, sTitle, sParentId, pObject );
00491
00492 pObject->AddProperty( new Property( "icon" , "upnp" ));
00493 pObject->AddProperty( new Property( "region" , "upnp" ));
00494 pObject->AddProperty( new Property( "channelNr", "upnp" ));
00495
00496 return( pObject );
00497 }
00498
00500
00501 CDSObject *CDSObject::CreateMusicVideoClip( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00502 {
00503 if (pObject == NULL)
00504 {
00505 pObject = new CDSObject( sId, sTitle, sParentId );
00506 pObject->m_sClass = "object.item.videoItem.musicVideoClip";
00507 }
00508
00509 CreateVideoItem( sId, sTitle, sParentId, pObject );
00510
00511 pObject->AddProperty( new Property( "artist" , "upnp" ));
00512 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00513 pObject->AddProperty( new Property( "album" , "upnp" ));
00514 pObject->AddProperty( new Property( "scheduledStartTime", "upnp" ));
00515 pObject->AddProperty( new Property( "scheduledStopTime" , "upnp" ));
00516 pObject->AddProperty( new Property( "director" , "upnp" ));
00517 pObject->AddProperty( new Property( "contributor" , "dc" ));
00518 pObject->AddProperty( new Property( "date" , "dc" ));
00519
00520 return( pObject );
00521 }
00522
00524
00525 CDSObject *CDSObject::CreateImageItem( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00526 {
00527 if (pObject == NULL)
00528 {
00529 pObject = new CDSObject( sId, sTitle, sParentId );
00530 pObject->m_sClass = "object.item.imageItem";
00531 }
00532
00533 CreateItem( sId, sTitle, sParentId, pObject );
00534
00535 pObject->AddProperty( new Property( "longDescription", "upnp" ));
00536 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00537 pObject->AddProperty( new Property( "rating" , "upnp" ));
00538 pObject->AddProperty( new Property( "description" , "dc" ));
00539 pObject->AddProperty( new Property( "publisher" , "dc" ));
00540 pObject->AddProperty( new Property( "date" , "dc" ));
00541 pObject->AddProperty( new Property( "rights" , "dc" ));
00542
00543 return( pObject );
00544 }
00545
00547
00548 CDSObject *CDSObject::CreatePhoto( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00549 {
00550 if (pObject == NULL)
00551 {
00552 pObject = new CDSObject( sId, sTitle, sParentId );
00553 pObject->m_sClass = "object.item.imageItem.photo";
00554 }
00555
00556 CreateImageItem( sId, sTitle, sParentId, pObject );
00557
00558 pObject->AddProperty( new Property( "album", "upnp" ));
00559
00560 return( pObject );
00561 }
00562
00564
00565 CDSObject *CDSObject::CreatePlaylistItem ( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00566 {
00567 if (pObject == NULL)
00568 {
00569 pObject = new CDSObject( sId, sTitle, sParentId );
00570 pObject->m_sClass = "object.item.playlistItem";
00571 }
00572
00573 CreateItem( sId, sTitle, sParentId, pObject );
00574
00575 pObject->AddProperty( new Property( "artist" , "upnp" ));
00576 pObject->AddProperty( new Property( "genre" , "upnp" ));
00577 pObject->AddProperty( new Property( "longDescription", "upnp" ));
00578 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00579 pObject->AddProperty( new Property( "description" , "dc" ));
00580 pObject->AddProperty( new Property( "date" , "dc" ));
00581 pObject->AddProperty( new Property( "language" , "dc" ));
00582
00583 return( pObject );
00584 }
00585
00587
00588 CDSObject *CDSObject::CreateTextItem( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00589 {
00590 if (pObject == NULL)
00591 {
00592 pObject = new CDSObject( sId, sTitle, sParentId );
00593 pObject->m_sClass = "object.item.textItem";
00594 }
00595
00596 CreateItem( sId, sTitle, sParentId, pObject );
00597
00598 pObject->AddProperty( new Property( "author" , "upnp" ));
00599 pObject->AddProperty( new Property( "protection" , "upnp" ));
00600 pObject->AddProperty( new Property( "longDescription", "upnp" ));
00601 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00602 pObject->AddProperty( new Property( "rating" , "upnp" ));
00603 pObject->AddProperty( new Property( "description" , "dc" ));
00604 pObject->AddProperty( new Property( "publisher" , "dc" ));
00605 pObject->AddProperty( new Property( "contributor" , "dc" ));
00606 pObject->AddProperty( new Property( "date" , "dc" ));
00607 pObject->AddProperty( new Property( "relation" , "dc" ));
00608 pObject->AddProperty( new Property( "language" , "dc" ));
00609 pObject->AddProperty( new Property( "rights" , "dc" ));
00610
00611 return( pObject );
00612 }
00613
00615
00616 CDSObject *CDSObject::CreateAlbum( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00617 {
00618 if (pObject == NULL)
00619 {
00620 pObject = new CDSObject( sId, sTitle, sParentId );
00621 pObject->m_sClass = "object.container.album";
00622 }
00623
00624 CreateContainer( sId, sTitle, sParentId, pObject );
00625
00626 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00627 pObject->AddProperty( new Property( "longDescription", "dc" ));
00628 pObject->AddProperty( new Property( "description" , "dc" ));
00629 pObject->AddProperty( new Property( "publisher" , "dc" ));
00630 pObject->AddProperty( new Property( "contributor" , "dc" ));
00631 pObject->AddProperty( new Property( "date" , "dc" ));
00632 pObject->AddProperty( new Property( "relation" , "dc" ));
00633 pObject->AddProperty( new Property( "rights" , "dc" ));
00634
00635 return( pObject );
00636 }
00637
00639
00640 CDSObject *CDSObject::CreateMusicAlbum( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00641 {
00642 if (pObject == NULL)
00643 {
00644 pObject = new CDSObject( sId, sTitle, sParentId );
00645 pObject->m_sClass = "object.container.album.musicAlbum";
00646 }
00647
00648 CreateAlbum( sId, sTitle, sParentId, pObject );
00649
00650 pObject->AddProperty( new Property( "artist" , "upnp" ));
00651 pObject->AddProperty( new Property( "genre" , "upnp" ));
00652 pObject->AddProperty( new Property( "producer" , "upnp" ));
00653 pObject->AddProperty( new Property( "albumArtURI", "upnp" ));
00654 pObject->AddProperty( new Property( "toc" , "upnp" ));
00655 return( pObject );
00656 }
00657
00659
00660 CDSObject *CDSObject::CreatePhotoAlbum( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00661 {
00662 if (pObject == NULL)
00663 {
00664 pObject = new CDSObject( sId, sTitle, sParentId );
00665 pObject->m_sClass = "object.container.album.photoAlbum";
00666 }
00667
00668 CreateAlbum( sId, sTitle, sParentId, pObject );
00669
00670 return( pObject );
00671 }
00672
00674
00675 CDSObject *CDSObject::CreateGenre( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00676 {
00677 if (pObject == NULL)
00678 {
00679 pObject = new CDSObject( sId, sTitle, sParentId );
00680 pObject->m_sClass = "object.container.genre";
00681 }
00682
00683 CreateContainer( sId, sTitle, sParentId, pObject );
00684
00685 pObject->AddProperty( new Property( "longDescription", "upnp" ));
00686 pObject->AddProperty( new Property( "description" , "dc" ));
00687
00688 return( pObject );
00689 }
00690
00692
00693 CDSObject *CDSObject::CreateMusicGenre( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00694 {
00695 if (pObject == NULL)
00696 {
00697 pObject = new CDSObject( sId, sTitle, sParentId );
00698 pObject->m_sClass = "object.container.genre.musicGenre";
00699 }
00700
00701 CreateGenre( sId, sTitle, sParentId, pObject );
00702
00703 return( pObject );
00704 }
00705
00707
00708 CDSObject *CDSObject::CreateMovieGenre( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00709 {
00710 if (pObject == NULL)
00711 {
00712 pObject = new CDSObject( sId, sTitle, sParentId );
00713 pObject->m_sClass = "object.container.genre.movieGenre";
00714 }
00715
00716 CreateGenre( sId, sTitle, sParentId, pObject );
00717
00718 return( pObject );
00719 }
00720
00722
00723 CDSObject *CDSObject::CreatePlaylistContainer( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00724 {
00725 if (pObject == NULL)
00726 {
00727 pObject = new CDSObject( sId, sTitle, sParentId );
00728 pObject->m_sClass = "object.container.playlistContainer";
00729 }
00730
00731 CreateContainer( sId, sTitle, sParentId, pObject );
00732
00733 pObject->AddProperty( new Property( "artist" , "upnp" ));
00734 pObject->AddProperty( new Property( "genre" , "upnp" ));
00735 pObject->AddProperty( new Property( "longDescription", "upnp" ));
00736 pObject->AddProperty( new Property( "producer" , "upnp" ));
00737 pObject->AddProperty( new Property( "storageMedium" , "upnp" ));
00738 pObject->AddProperty( new Property( "description" , "dc" ));
00739 pObject->AddProperty( new Property( "contributor" , "dc" ));
00740 pObject->AddProperty( new Property( "date" , "dc" ));
00741 pObject->AddProperty( new Property( "language" , "dc" ));
00742 pObject->AddProperty( new Property( "rights" , "dc" ));
00743
00744 return( pObject );
00745 }
00746
00748
00749 CDSObject *CDSObject::CreatePerson( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00750 {
00751 if (pObject == NULL)
00752 {
00753 pObject = new CDSObject( sId, sTitle, sParentId );
00754 pObject->m_sClass = "object.container.person";
00755 }
00756
00757 CreateContainer( sId, sTitle, sParentId, pObject );
00758
00759 pObject->AddProperty( new Property( "language", "dc" ));
00760
00761 return( pObject );
00762 }
00763
00765
00766 CDSObject *CDSObject::CreateMusicArtist( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00767 {
00768 if (pObject == NULL)
00769 {
00770 pObject = new CDSObject( sId, sTitle, sParentId );
00771 pObject->m_sClass = "object.container.person.musicArtist";
00772 }
00773
00774 CreatePerson( sId, sTitle, sParentId, pObject );
00775
00776 pObject->AddProperty( new Property( "genre" , "upnp" ));
00777 pObject->AddProperty( new Property( "artistDiscographyURI", "upnp" ));
00778
00779 return( pObject );
00780 }
00781
00783
00784 CDSObject *CDSObject::CreateStorageSystem( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00785 {
00786 if (pObject == NULL)
00787 {
00788 pObject = new CDSObject( sId, sTitle, sParentId );
00789 pObject->m_sClass = "object.container.storageSystem";
00790 }
00791
00792 CreateContainer( sId, sTitle, sParentId, pObject );
00793
00794 pObject->AddProperty( new Property( "storageTotal" , "upnp", true ));
00795 pObject->AddProperty( new Property( "storageUsed" , "upnp", true ));
00796 pObject->AddProperty( new Property( "storageFree" , "upnp", true ));
00797 pObject->AddProperty( new Property( "storageMaxPartition", "upnp", true ));
00798 pObject->AddProperty( new Property( "storageMedium" , "upnp", true ));
00799
00800 return( pObject );
00801 }
00802
00804
00805 CDSObject *CDSObject::CreateStorageVolume( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00806 {
00807 if (pObject == NULL)
00808 {
00809 pObject = new CDSObject( sId, sTitle, sParentId );
00810 pObject->m_sClass = "object.container.storageVolume";
00811 }
00812
00813 CreateContainer( sId, sTitle, sParentId, pObject );
00814
00815 pObject->AddProperty( new Property( "storageTotal" , "upnp", true ));
00816 pObject->AddProperty( new Property( "storageUsed" , "upnp", true ));
00817 pObject->AddProperty( new Property( "storageFree" , "upnp", true ));
00818 pObject->AddProperty( new Property( "storageMedium", "upnp", true ));
00819
00820 return( pObject );
00821 }
00822
00824
00825 CDSObject *CDSObject::CreateStorageFolder( QString sId, QString sTitle, QString sParentId, CDSObject *pObject )
00826 {
00827 if (pObject == NULL)
00828 {
00829 pObject = new CDSObject( sId, sTitle, sParentId );
00830 pObject->m_sClass = "object.container.storageFolder";
00831 }
00832
00833 CreateContainer( sId, sTitle, sParentId, pObject );
00834
00835 pObject->AddProperty( new Property( "storageUsed", "upnp", true ));
00836
00837 return( pObject );
00838 }