upnpmediaserver/contentdirectoryservice/src/upnpresourcesbean.cpp
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /** @file
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies  this distribution, and is available 
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Element table data handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "upnpresourcesbean.h"
       
    21 #include "upnpcontentdirectoryglobals.h"
       
    22 #include <upnpelement.h>
       
    23 #include "upnpcdutils.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CUpnpResourcesBean::CUpnpResourcesBean
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 CUpnpResourcesBean::CUpnpResourcesBean()
       
    34 {
       
    35 
       
    36 }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CUpnpResourcesBean::ConstructL
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CUpnpResourcesBean::ConstructL()
       
    44 {
       
    45 
       
    46 }
       
    47 // -----------------------------------------------------------------------------
       
    48 // CUpnpResourcesBean::NewLC
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CUpnpResourcesBean* CUpnpResourcesBean::NewLC()
       
    53 {
       
    54     CUpnpResourcesBean* self = new( ELeave ) CUpnpResourcesBean;
       
    55     CleanupStack::PushL( self );
       
    56     self->ConstructL();
       
    57     return self;
       
    58 }
       
    59 // -----------------------------------------------------------------------------
       
    60 // CUpnpResourcesBean::NewLC
       
    61 // Two-phased constructor.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CUpnpResourcesBean* CUpnpResourcesBean::NewLC(const RDbRowSet& aRowSet)
       
    65 {
       
    66     CUpnpResourcesBean* self = NewLC();
       
    67     self->SetL(aRowSet);
       
    68     return self;
       
    69 }    
       
    70 // -----------------------------------------------------------------------------
       
    71 // CUpnpResourcesBean::NewL
       
    72 // Two-phased constructor.
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 CUpnpResourcesBean* CUpnpResourcesBean::NewL(const RDbRowSet& aRowSet)
       
    76 {
       
    77     CUpnpResourcesBean* self = NewLC(aRowSet);
       
    78     CleanupStack::Pop();
       
    79     return self;
       
    80 }
       
    81 // -----------------------------------------------------------------------------
       
    82 // CUpnpResourcesBean::~CUpnpResourcesBean
       
    83 // Destructor
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 CUpnpResourcesBean::~CUpnpResourcesBean()
       
    87 {
       
    88     delete iPath;
       
    89 }
       
    90 // -----------------------------------------------------------------------------
       
    91 // CUpnpResourcesBean::SetL
       
    92 // (other items were commented in a header).
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CUpnpResourcesBean::SetL(const RDbRowSet& aRowSet)
       
    96 {
       
    97     // get cols ids
       
    98     CDbColSet* colSet = aRowSet.ColSetL();
       
    99     CleanupStack::PushL(colSet);
       
   100     const TInt idColNo          =    colSet->ColNo( KRscIdColName       );
       
   101     const TInt pathColNo        =    colSet->ColNo( KRscPathColName     );
       
   102     const TInt isReadonlyColNo  =    colSet->ColNo( KRscReadonlyColName );
       
   103     const TInt isThumbnailColNo  =   colSet->ColNo( KRscThumbnailColName );
       
   104     const TInt idObjColNo       =    colSet->ColNo( KRscIdObjColName );
       
   105     
       
   106     CleanupStack::PopAndDestroy(colSet);
       
   107     
       
   108     // for each column call setter
       
   109     if( idColNo != KDbNullColNo )
       
   110     {
       
   111         SetId(aRowSet.ColInt64(idColNo));
       
   112     }
       
   113     if( pathColNo != KDbNullColNo )
       
   114     {
       
   115         SetPathL(aRowSet.ColDes(pathColNo));
       
   116     }
       
   117     if( isReadonlyColNo != KDbNullColNo )
       
   118     {
       
   119         SetIsReadonly(aRowSet.ColUint8(isReadonlyColNo));
       
   120     }
       
   121     if( isThumbnailColNo != KDbNullColNo )
       
   122     {
       
   123         SetIsThumbnail(aRowSet.ColUint8(isThumbnailColNo));
       
   124     }
       
   125     if( idObjColNo != KDbNullColNo )
       
   126     {
       
   127         SetObjectId(aRowSet.ColInt(idObjColNo));
       
   128     }
       
   129 }
       
   130 // -----------------------------------------------------------------------------
       
   131 // CUpnpResourcesBean::SetPathL
       
   132 // (other items were commented in a header).
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 void CUpnpResourcesBean::SetPathL(const TDesC& aPath)
       
   136 {
       
   137     delete iPath;
       
   138     iPath = NULL;
       
   139     iPath = aPath.AllocL();
       
   140 }
       
   141 // -----------------------------------------------------------------------------
       
   142 // CUpnpResourcesBean::SetPathL
       
   143 // (other items were commented in a header).
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 void CUpnpResourcesBean::SetPathL(const TDesC8& aPath)
       
   147 {
       
   148 	delete iPath;
       
   149 	iPath = NULL;
       
   150 	iPath = UpnpCdUtils::Des8ToDesL(aPath);
       
   151 }
       
   152 
       
   153 
       
   154 //  End of File