upnpsharing/upnpcontentserver/src/upnpsharingrequest.cpp
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 0 7f85d04be362
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    13 *
    13 *
    14 * Description:      CUpnpSharingRequest class implementation
    14 * Description:      CUpnpSharingRequest class implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 // INCLUDE FILES
    18 // INCLUDE FILES
    25 #include "upnpsharingrequest.h"
    19 #include "upnpsharingrequest.h"
    26 #include "upnpcontentserverdefs.h"
    20 #include "upnpcontentserverdefs.h"
    27 
    21 
    28 const TInt KDefaultItemCount = 2^32; //4294967296
       
    29 
    22 
    30 using namespace UpnpContentServer;
    23 using namespace UpnpContentServer;
    31 
    24 
    32 // ============================ MEMBER FUNCTIONS =============================
    25 // ============================ MEMBER FUNCTIONS =============================
    33 
    26 
    36 // C++ default constructor can NOT contain any code, that
    29 // C++ default constructor can NOT contain any code, that
    37 // might leave.
    30 // might leave.
    38 // --------------------------------------------------------------------------
    31 // --------------------------------------------------------------------------
    39 //
    32 //
    40 
    33 
    41 CUpnpSharingRequest::CUpnpSharingRequest( TInt aKind )
    34 CUpnpSharingRequest::CUpnpSharingRequest( 
       
    35     TUpnpMediaType aMediaType, 
       
    36     TInt aSharingType ) :
       
    37     iMediaType( aMediaType ),
       
    38     iSharingType( aSharingType )
    42     {
    39     {
    43     iKind = aKind;
    40     // empty
    44     iItemCount = KDefaultItemCount;
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------
       
    48 // CUpnpSharingRequest::ConstructL
       
    49 // Symbian 2nd phase constructor can leave.
       
    50 // --------------------------------------------------------------------------
       
    51 //
       
    52 void CUpnpSharingRequest::ConstructL( const RArray<TInt>& aArr, 
       
    53                                       CDesCArray* aIdArray,
       
    54                                       CDesCArray* aNameArray )
       
    55     {
       
    56     for ( TInt i(0); i<aArr.Count();i++ )
       
    57         {
       
    58         iSelections.AppendL( aArr[ i ] );
       
    59         }
       
    60     iObjectIds = aIdArray; // transfer ownership
       
    61     iObjectNames = aNameArray;
       
    62     }
    41     }
    63 
    42 
    64 // --------------------------------------------------------------------------
    43 // --------------------------------------------------------------------------
    65 // CUpnpSharingRequest::NewL
    44 // CUpnpSharingRequest::NewL
    66 // Two-phased constructor.
    45 // Two-phased constructor.
    67 // --------------------------------------------------------------------------
    46 // --------------------------------------------------------------------------
    68 //
    47 //
    69 CUpnpSharingRequest* CUpnpSharingRequest::NewL(
    48 CUpnpSharingRequest* CUpnpSharingRequest::NewL( 
    70     TInt aKind,
    49     TUpnpMediaType aMediaType, 
    71     const RArray<TInt>& aArr,
    50     TInt aSharingType )
    72     CDesCArray* aIdArray,
       
    73     CDesCArray* aNameArray )
       
    74     {
    51     {
    75     CUpnpSharingRequest* self = new (ELeave) CUpnpSharingRequest( aKind );
    52     CUpnpSharingRequest* self = 
       
    53         new (ELeave) CUpnpSharingRequest( aMediaType, aSharingType );
    76     CleanupStack::PushL( self );
    54     CleanupStack::PushL( self );
    77     self->ConstructL( aArr,
    55     self->ConstructL();
    78                       aIdArray,
       
    79                       aNameArray );
       
    80     CleanupStack::Pop( self );
    56     CleanupStack::Pop( self );
    81     return self;
    57     return self;
    82     }
    58     }
    83 
    59 
    84 // --------------------------------------------------------------------------
    60 // --------------------------------------------------------------------------
    85 // CUpnpSharingRequest::NewL
    61 // CUpnpSharingRequest::SetSharingRequestInfoL
       
    62 // Sets sharing request information arrays
       
    63 // --------------------------------------------------------------------------
       
    64 // 
       
    65 void CUpnpSharingRequest::SetSharingRequestInfo( 
       
    66     RArray<TFileName>* aShareArr,
       
    67     RArray<TFileName>* aUnshareArr,
       
    68     CDesCArray* aClfIds )
       
    69     {
       
    70     // take ownership of the arrays
       
    71     iShareArr = aShareArr;
       
    72     iUnshareArr = aUnshareArr;
       
    73     iClfIds = aClfIds;
       
    74     }
       
    75 
       
    76 // --------------------------------------------------------------------------
       
    77 // CUpnpSharingRequest::~CUpnpSharingRequest
    86 // Destructor
    78 // Destructor
    87 // --------------------------------------------------------------------------
    79 // --------------------------------------------------------------------------
    88 // 
    80 // 
    89 CUpnpSharingRequest::~CUpnpSharingRequest()
    81 CUpnpSharingRequest::~CUpnpSharingRequest()
    90     {
    82     {
    91     iSelections.Close();
    83     // Destructor
    92     delete iObjectIds;
    84     if ( iShareArr )
       
    85         {
       
    86         iShareArr->Close();
       
    87         delete iShareArr;
       
    88         }
       
    89     if ( iUnshareArr )
       
    90         {
       
    91         iUnshareArr->Close();
       
    92         delete iUnshareArr;
       
    93         }
       
    94     if ( iClfIds )
       
    95         {
       
    96         delete iClfIds;
       
    97         }
    93     }
    98     }
    94 
    99 
    95 
   100 
    96 //  End of File
   101 //  End of File