author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 3 | e1b950c65cb4 |
permissions | -rw-r--r-- |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
1 |
/* |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
3 |
* All rights reserved. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
3
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
3
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
8 |
* |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
11 |
* |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
12 |
* Contributors: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
13 |
* |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
14 |
* Description: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
15 |
* |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
16 |
*/ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
17 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
18 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
19 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
20 |
#ifndef TULSTRINGRESOURCEREADER_H |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
21 |
#define TULSTRINGRESOURCEREADER_H |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
22 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
23 |
#include <coemain.h> // RResourceReader |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
24 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
25 |
/** |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
26 |
CTulStringResourceReader reads strings from resource without CCoeEnv. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
27 |
If resource file given to the constructor is not found, the constructor leaves. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
28 |
This module is mainly for server usage, where there is the need to read resources, |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
29 |
but no CCoeEnv instance is present. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
30 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
31 |
Usage: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
32 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
33 |
@code |
4
837f303aceeb
Current Symbian^3 public API header files (from PDK 3.0.h)
William Roberts <williamr@symbian.org>
parents:
3
diff
changeset
|
34 |
#include <platform/stringresourcereader.h> |
2
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
35 |
#include <errorres.rsg> // Resource to be read header |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
36 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
37 |
TFileName myFileName( _L("z:\\resource\\errorres.rsc") ); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
38 |
CTulStringResourceReader* test = CTulStringResourceReader::NewL( myFileName ); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
39 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
40 |
TPtrC buf; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
41 |
buf.Set(test-> ReadResourceString(R_ERROR_RES_GENERAL)); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
42 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
43 |
// Note that buf will only be valid as long as CTulStringResourceReader |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
44 |
// instance is alive and no new string is read by the same instance. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
45 |
// If you need to read multiple strings, make copies. |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
46 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
47 |
delete test; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
48 |
@endcode |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
49 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
50 |
@publishedAll |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
51 |
@released |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
52 |
*/ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
53 |
class CTulStringResourceReader : public CBase |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
54 |
{ |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
55 |
public: // Constructors and destructor |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
56 |
IMPORT_C static CTulStringResourceReader* NewL(TFileName& aResFile); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
57 |
IMPORT_C static CTulStringResourceReader* NewLC(TFileName& aResFile); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
58 |
IMPORT_C static CTulStringResourceReader* NewL(TFileName& aResFile, RFs& aFs); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
59 |
IMPORT_C static CTulStringResourceReader* NewLC(TFileName& aResFile, RFs& aFs); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
60 |
~CTulStringResourceReader(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
61 |
public: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
62 |
IMPORT_C const TDesC& ReadResourceString( TInt aResourceId ); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
63 |
private: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
64 |
CTulStringResourceReader(); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
65 |
void ConstructL(TFileName& aResFile); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
66 |
void ConstructL(TFileName& aResFile, RFs& aFs); |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
67 |
private: |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
68 |
RResourceFile iResourceFile; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
69 |
HBufC* iResourceBuffer; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
70 |
RFs iFsSession; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
71 |
TPtrC iTruncatedTextPointer; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
72 |
TBool iFsConnected; // ETrue if connected to the file server, else EFalse |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
73 |
}; |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
74 |
|
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
75 |
#endif // TULSTRINGRESOURCEREADER_H |
2fe1408b6811
Final list of Symbian^2 public API header files
William Roberts <williamr@symbian.org>
parents:
diff
changeset
|
76 |