imsrv_plat/ximp_core_feature_plugin_api/tsrc/tsrcutils/testcaseutils/prfwtestcontextwrappermgr.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 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:  Testing context wrapper
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32std.h>
       
    21 
       
    22 #include <ximpclient.h>
       
    23 #include <ximpbase.h>
       
    24 #include "prfwtestcontextwrappermgr.h"
       
    25 #include "prfwtestcontextwrapper.h"
       
    26 #include <ximpcontext.h>
       
    27 #include "prfwteststatuseventlistener.h"
       
    28 #include "prfwtestmessenger.h"
       
    29 #include "prfwtestmessaging.h"
       
    30 
       
    31 // ======== LOCAL FUNCTIONS ========
       
    32 
       
    33 // ======== MEMBER FUNCTIONS ========
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // ?description_if_needed
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CXIMPTestContextWrapperMgr::CXIMPTestContextWrapperMgr() 
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // ?description_if_needed
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 void CXIMPTestContextWrapperMgr::ConstructL()
       
    48     {
       
    49     // TODO
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // ?description_if_needed
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CXIMPTestContextWrapperMgr* CXIMPTestContextWrapperMgr::NewL()
       
    57     {
       
    58     CXIMPTestContextWrapperMgr* self = new( ELeave ) CXIMPTestContextWrapperMgr();
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62     return self;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // ?description_if_needed
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 CXIMPTestContextWrapperMgr::~CXIMPTestContextWrapperMgr()
       
    70     {
       
    71     iWrappers.Close();
       
    72     iPrClients.Close();
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // ?description_if_needed
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 EXPORT_C void CXIMPTestContextWrapperMgr::CreateWrapperL( TInt aClientIndex /* = KErrNotFound */ )
       
    80     {
       
    81     // make sure we've the client
       
    82     MXIMPClient* client = NULL;
       
    83 
       
    84     if ( aClientIndex == KErrNotFound )
       
    85         {
       
    86         if( iPrClients.Count() == 0 )
       
    87             {
       
    88             // make a new one
       
    89             client = MXIMPClient::NewClientL();
       
    90             iPrClients.AppendL( client );
       
    91             }
       
    92         else
       
    93             {
       
    94             client = iPrClients[ 0 ];
       
    95             }
       
    96         }
       
    97     else
       
    98         {
       
    99         // if the index was bad, everything will blow. it's up to the client to instruct
       
   100         // us correctly
       
   101         client = iWrappers[ aClientIndex ]->GetClient();
       
   102         }
       
   103 
       
   104     CXIMPTestContextWrapper* tmp = CXIMPTestContextWrapper::NewL( iIndex, client );
       
   105     iWrappers.AppendL( tmp );
       
   106 
       
   107     iIndex++;
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // ?description_if_needed
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C CXIMPTestContextWrapper* CXIMPTestContextWrapperMgr::GetWrapperL( TInt aIndex )
       
   115     {
       
   116     return iWrappers[ aIndex ];
       
   117     }
       
   118 
       
   119 EXPORT_C TInt CXIMPTestContextWrapperMgr::WrapperCount() const
       
   120     {
       
   121     return iWrappers.Count();
       
   122     } 
       
   123 
       
   124 // End of file