|
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 File handler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "RPhCltResourceFile.h" |
|
22 #include "ConeResLoader.h" |
|
23 #include "PhCltClientServer.h" |
|
24 |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 // Panic category |
|
29 _LIT( KPhCltResourceFilePanic, "PhCltRes" ); |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // RPhCltResourceFile::RPhCltResourceFile |
|
38 // C++ default constructor can NOT contain any code, that |
|
39 // might leave. |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 EXPORT_C RPhCltResourceFile::RPhCltResourceFile() |
|
43 : iLoader( NULL ) |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // RPhCltResourceFile::OpenL |
|
50 // |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 EXPORT_C void RPhCltResourceFile::OpenL( CCoeEnv& aEnv ) |
|
54 { |
|
55 // Must not be called if already loaded. |
|
56 __ASSERT_ALWAYS( |
|
57 !iLoader, |
|
58 User::Panic( KPhCltResourceFilePanic, KErrNone ) ); |
|
59 |
|
60 TFileName* tmpFileName = |
|
61 new ( ELeave ) TFileName; |
|
62 CleanupStack::PushL( tmpFileName ); |
|
63 tmpFileName->Append( KPhCltServerZDrive ); |
|
64 tmpFileName->Append( KDC_RESOURCE_FILES_DIR ); |
|
65 tmpFileName->Append( KPhCltResourceFileNameAndPath ); |
|
66 tmpFileName->ZeroTerminate(); |
|
67 |
|
68 // Load resource file |
|
69 RConeResourceLoader* loader = |
|
70 new ( ELeave ) RConeResourceLoader( aEnv ); |
|
71 CleanupStack::PushL( loader ); |
|
72 loader->OpenL( *tmpFileName ); |
|
73 CleanupStack::Pop( loader ); |
|
74 |
|
75 // Completed, store loader. |
|
76 iLoader = loader; |
|
77 |
|
78 CleanupStack::PopAndDestroy( tmpFileName ); |
|
79 } |
|
80 |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // RPhCltResourceFile::Close |
|
84 // |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C void RPhCltResourceFile::Close() |
|
88 { |
|
89 if ( iLoader ) |
|
90 { |
|
91 iLoader->Close(); |
|
92 delete iLoader; |
|
93 iLoader = NULL; |
|
94 } |
|
95 } |
|
96 |
|
97 |
|
98 // End of File |