wmdrm/wmdrmengine/wmdrmserver/server/src/enumeratordata.cpp
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2007 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:  WMDRM Server implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ezlib.h>
       
    20 #include <e32math.h>
       
    21 #include <symmetric.h>
       
    22 #include <bacntf.h>
       
    23 
       
    24 #include "enumeratordata.h"
       
    25 #include "slotenumeratorcache.h"
       
    26 #include "wmdrmserver.h"
       
    27 #include "wmdrmdb.h"
       
    28 
       
    29 #define _LOGGING_FILE L"wmdrmserver.txt"
       
    30 
       
    31 #include "flogger.h"
       
    32 #include "logfn.h"
       
    33 
       
    34 CEnumeratorData* CEnumeratorData::NewL(
       
    35     CWmDrmServer* aServer,
       
    36     const TDesC8& aStore,
       
    37     const TDesC8& aNamespace,
       
    38     const TDesC8& aHashKey )
       
    39     {
       
    40     CEnumeratorData* self = new (ELeave) CEnumeratorData();
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aServer, aStore, aNamespace, aHashKey );
       
    43     CleanupStack::Pop( self );
       
    44     return self;
       
    45     }
       
    46 
       
    47 void CEnumeratorData::ConstructL(
       
    48     CWmDrmServer* aServer,
       
    49     const TDesC8& aStore,
       
    50     const TDesC8& aNamespace,
       
    51     const TDesC8& aHashKey )
       
    52     {
       
    53     LOGFN( "CEnumeratorData::ConstructL" );
       
    54     iServer = aServer;
       
    55     iStore.Copy( aStore );
       
    56     iNamespace.Copy( aNamespace );
       
    57     iHashKey.Copy( aHashKey );
       
    58     iServer->Db()->EnumerateDataL( iStore, iNamespace, iHashKey, iEntries );
       
    59     }
       
    60 
       
    61 CEnumeratorData::CEnumeratorData():
       
    62     iReferences( 0 )
       
    63     {
       
    64     LOGFN( "CEnumeratorData::CEnumeratorData" );
       
    65     }
       
    66 
       
    67 CEnumeratorData::~CEnumeratorData()
       
    68     {
       
    69     LOGFN( "CEnumeratorData::~CEnumeratorData" );
       
    70     iEntries.ResetAndDestroy();
       
    71     iEntries.Close();
       
    72     }
       
    73 
       
    74 void CEnumeratorData::Close()
       
    75     {
       
    76     LOGFN( "CEnumeratorData::Close" );
       
    77     iServer->EnumeratorCache()->Release( this );
       
    78     }