phoneclientserver/phoneserver/Src/Standard/CPhSrvResourceManager.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Resource Manager.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cphsrvresourcemanager.h" 
       
    22 #include "phcltclientserver.h" 
       
    23 #include <bautils.h>
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CPhSrvResourceManager::CPhSrvResourceManager
       
    30 // 
       
    31 // C++ constructor
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CPhSrvResourceManager::CPhSrvResourceManager( RFs& aFsSession )
       
    35 :   iFsSession(aFsSession)
       
    36     {
       
    37     }
       
    38 
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CPhSrvResourceManager::~CPhSrvResourceManager
       
    42 // 
       
    43 // C++ destructor
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CPhSrvResourceManager::~CPhSrvResourceManager()
       
    47     {
       
    48     iResourceFile.Close();
       
    49     }
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CPhSrvResourceManager::ConstructL
       
    54 // 
       
    55 // Symbian OS 2nd phase constructor
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 void CPhSrvResourceManager::ConstructL()
       
    59     {
       
    60     TFileName resourceFile( KPhCltServerZDrive );
       
    61     resourceFile.Append( KDC_RESOURCE_FILES_DIR );
       
    62     resourceFile.Append( KPhClientAndServerResourceFileName );
       
    63     resourceFile.Append( KPhClientAndServerResourceFileExtensionNoWild );
       
    64     resourceFile.ZeroTerminate();
       
    65 
       
    66     BaflUtils::NearestLanguageFile( iFsSession, resourceFile );
       
    67     iResourceFile.OpenL( iFsSession, resourceFile );
       
    68     iResourceFile.ConfirmSignatureL( KPhSrvMagicResourceFileSignature );
       
    69     }
       
    70 
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CPhSrvResourceManager::ReadResourceLC
       
    74 // 
       
    75 // Read resource text
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 HBufC* CPhSrvResourceManager::ReadResourceLC( TUint aResourceId )
       
    79     {
       
    80     HBufC8* resourceBuffer = iResourceFile.AllocReadLC( aResourceId );
       
    81 
       
    82     TResourceReader reader;
       
    83     reader.SetBuffer( resourceBuffer );
       
    84 
       
    85     HBufC* ret = reader.ReadHBufCL();
       
    86     CleanupStack::PopAndDestroy( resourceBuffer );
       
    87 
       
    88     CleanupStack::PushL( ret );
       
    89     return ret;
       
    90     }
       
    91 
       
    92 
       
    93 // End of File