author | jjkang |
Fri, 11 Jun 2010 15:22:09 +0800 | |
changeset 2 | 806186ab5e14 |
parent 1 | 0a7b44b10206 |
permissions | -rw-r--r-- |
1
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
2 |
// All rights reserved. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
3 |
// This component and the accompanying materials are made available |
2 | 4 |
// under the terms of the License "Eclipse Public License v1.0" |
1
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
2 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
7 |
// |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
8 |
// Initial Contributors: |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
9 |
// Nokia Corporation - initial contribution. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
10 |
// |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
11 |
// Contributors: |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
12 |
// |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
13 |
// Description: |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
14 |
// |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
15 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
16 |
#include <e32std.h> |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
17 |
#include "stringpoolimplementation.h" |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
18 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
19 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
20 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
21 |
EXPORT_C void RStringBase::Close() |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
22 |
/** Closes a string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
23 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
24 |
You must close every string you open. In other words, every call to RStringBase::Copy(), |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
25 |
RStringPool::OpenStringL() and RStringPool::OpenFStringL() must be matched |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
26 |
by a close. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
27 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
28 |
Strings created through RStringPool::String() or RStringPool::StringF() with |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
29 |
an integer argument need not be closed (but closing is harmless). |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
30 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
31 |
Strings created through RStringPool::String() or RStringPool::StringF() with |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
32 |
a StringToken or StringTokenF argument must not be closed, as they're just |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
33 |
changing the external representation. */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
34 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
35 |
if (iVal) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
36 |
//harmless for empty strings |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
37 |
iPool.iImplementation->Close(RStringTokenEither(iVal)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
38 |
// invalidate the string if it's a dinamic one otherwise do nothing |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
39 |
if(!StringUtils::IsTableEntry(this->iVal)) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
40 |
iVal=0U; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
41 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
42 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
43 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
44 |
EXPORT_C RStringBase RStringBase::Copy() |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
45 |
/** Copies a string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
46 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
47 |
Both the original and the copy string must be separately closed. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
48 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
49 |
@return The string base. */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
50 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
51 |
if (iVal) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
52 |
iPool.iImplementation->IncrementCount(RStringTokenEither(iVal)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
53 |
return *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
54 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
55 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
56 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
57 |
/** Returns the content of the string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
58 |
*/ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
59 |
EXPORT_C const TDesC8& RStringBase::DesC() const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
60 |
/** Gets the content of the string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
61 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
62 |
@return Descriptor containing the content of the string. */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
63 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
64 |
// check for empty string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
65 |
if (iVal == 0) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
66 |
return KNullDesC8(); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
67 |
if (StringUtils::IsTableEntry(iVal)) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
68 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
69 |
TInt index = StringUtils::TableIndex(iVal); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
70 |
TInt tableUid= StringUtils::TableUid(iVal); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
71 |
return iPool.iImplementation->TableLookup(index, tableUid); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
72 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
73 |
else |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
74 |
return *StringUtils::NodePtr(iVal)->iDes; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
75 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
76 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
77 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
78 |
EXPORT_C TInt RStringBase::Index(const TStringTable& aTable) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
79 |
/** Gets the enumeration value corresponding to this string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
80 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
81 |
@param aTable String table to look in |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
82 |
@return The string's enumeration value, or -1 if there is no such value |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
83 |
@panic EStringTableNotFound If the table supplied is not found. This panic is raised in debug builds only, in release mode the behaviour is undefined*/ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
84 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
85 |
//return an error for empty strings(i.e. with iVal=0 ) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
86 |
if(!this->iVal) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
87 |
return KErrNotFound; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
88 |
TInt tableId=iPool.iImplementation->TableUid(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
89 |
__ASSERT_DEBUG(tableId!=KErrNotFound,StringPoolPanic::Panic(StringPoolPanic::EStringTableNotFound)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
90 |
// First check the iVal is part of the same table |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
91 |
if (StringUtils::IsTableEntry(iVal)) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
92 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
93 |
if (tableId==StringUtils::TableUid(iVal)) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
94 |
return StringUtils::TableIndex(iVal); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
95 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
96 |
// Then check if the iVal is in the reverse duplicate list |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
97 |
TInt index=iPool.iImplementation->FindTableIndexFromFirstVal(iVal, tableId); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
98 |
return index; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
99 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
100 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
101 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
102 |
EXPORT_C const TStringTable* RStringBase::OriginalTableRef() const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
103 |
/** Gets the table (if any) that first added the current string to the pool. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
104 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
105 |
Note there multiple tables can contain the same string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
106 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
107 |
@return The table or NULL if the string was created dynamically (not from |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
108 |
a table) */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
109 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
110 |
if(StringUtils::IsTableEntry(iVal)) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
111 |
return &iPool.iImplementation->TableRef(iVal); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
112 |
else |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
113 |
return NULL; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
114 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
115 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
116 |
/** Implementation of RStringPool class*/ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
117 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
118 |
EXPORT_C void RStringPool::OpenL() |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
119 |
/** Creates an initialised string pool with no pre-loaded string tables. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
120 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
121 |
@leave KErrNoMemory Not enough memory to open the pool */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
122 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
123 |
iImplementation = new (ELeave) CStringPoolImplementation; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
124 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
125 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
126 |
EXPORT_C void RStringPool::OpenL(const TStringTable& aTable,MStringPoolCloseCallBack& aCallBack) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
127 |
/** Creates an initialised string pool with a pre-loaded string table, and a string-pool-closing |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
128 |
callback. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
129 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
130 |
@param aTable The pre-loaded string table. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
131 |
@param aCallBack Callback interface that is called when the string pool closes |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
132 |
@leave KErrNoMemory Not enough memory to open the pool */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
133 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
134 |
if (!iImplementation) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
135 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
136 |
iImplementation = new (ELeave) CStringPoolImplementation; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
137 |
CleanupClosePushL(*this); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
138 |
iImplementation->AddTableL(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
139 |
iImplementation->AddCallBackL(aCallBack); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
140 |
CleanupStack::Pop(); //this |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
141 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
142 |
else |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
143 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
144 |
iImplementation->AddTableL(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
145 |
iImplementation->AddCallBackL(aCallBack); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
146 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
147 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
148 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
149 |
EXPORT_C void RStringPool::OpenL(const TStringTable& aTable) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
150 |
/** Creates an initialised string pool with a pre-loaded string table. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
151 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
152 |
@param aTable The pre-loaded string table. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
153 |
@leave KErrNoMemory Not enough memory to open the pool */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
154 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
155 |
if (!iImplementation) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
156 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
157 |
iImplementation = new (ELeave) CStringPoolImplementation; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
158 |
CleanupClosePushL(*this); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
159 |
iImplementation->AddTableL(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
160 |
CleanupStack::Pop(); //this |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
161 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
162 |
else |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
163 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
164 |
iImplementation->AddTableL(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
165 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
166 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
167 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
168 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
169 |
EXPORT_C void RStringPool::Close() |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
170 |
/** Closes the string pool table. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
171 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
172 |
This invalidates all other handles to the table. */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
173 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
174 |
delete iImplementation; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
175 |
iImplementation = NULL; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
176 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
177 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
178 |
EXPORT_C RStringF RStringPool::OpenFStringL(const TDesC8& aString) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
179 |
/** Creates an RStringF using the current string pool. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
180 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
181 |
The string is opened as case-insensitive. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
182 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
183 |
@param aString The value of the string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
184 |
@leave KErrNoMemory Not enough memory to open the string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
185 |
@return Initialised RStringF object */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
186 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
187 |
RStringTokenEither newString = iImplementation->OpenL(aString, ETrue); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
188 |
RStringF r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
189 |
r.iPool = *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
190 |
r.iVal = newString.iVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
191 |
return r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
192 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
193 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
194 |
EXPORT_C RString RStringPool::OpenStringL(const TDesC8& aString) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
195 |
/** Creates an RString using the current string pool. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
196 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
197 |
The string is opened as case-sensitive. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
198 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
199 |
@param aString The value of the string. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
200 |
@leave KErrNoMemory Not enough memory to open the string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
201 |
@return Initialised RString object */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
202 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
203 |
RStringTokenEither newString = iImplementation->OpenL(aString, EFalse); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
204 |
RString r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
205 |
r.iPool = *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
206 |
r.iVal = newString.iVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
207 |
return r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
208 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
209 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
210 |
EXPORT_C RString RStringPool::String(RStringToken aString) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
211 |
/** Creates an RString from the supplied RStringToken. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
212 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
213 |
@param aString The string token |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
214 |
@return Initialised RString object */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
215 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
216 |
RString r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
217 |
r.iPool = *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
218 |
r.iVal = aString.iVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
219 |
return r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
220 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
221 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
222 |
EXPORT_C RString RStringPool::String(TInt aIndex,const TStringTable& aTable) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
223 |
/** Gets a case-sensitive string specified by a string table enumeration value. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
224 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
225 |
aIndex is interpreted as an offset into the handle's pre-loaded string table. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
226 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
227 |
@param aIndex The string table enumeration value |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
228 |
@param aTable The string table from which to read the string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
229 |
@return Initialised RString object |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
230 |
@panic EStringTableNotFound If the table supplied is not found. This panic is raised in debug builds only, in release mode the behaviour is undefined*/ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
231 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
232 |
__ASSERT_DEBUG(aTable.iCaseSensitive==1,StringPoolPanic::Panic(StringPoolPanic::ECreatingStringWithWrongCase)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
233 |
if(aIndex <(TInt)aTable.iCount) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
234 |
{//the index is in valid range the index |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
235 |
RString r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
236 |
r.iPool = *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
237 |
TInt16 tableUid = iImplementation->TableUid(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
238 |
__ASSERT_DEBUG(tableUid!=KErrNotFound,StringPoolPanic::Panic(StringPoolPanic::EStringTableNotFound)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
239 |
r.iVal = StringUtils::ValFromIndex(aIndex, tableUid); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
240 |
TInt originalVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
241 |
if (KErrNotFound!=(originalVal=iImplementation->FindFirstValFromDuplicate(r.iVal))) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
242 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
243 |
r.iVal=originalVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
244 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
245 |
return r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
246 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
247 |
else // the index is out of range |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
248 |
return RString(); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
249 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
250 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
251 |
EXPORT_C RStringF RStringPool::StringF(RStringTokenF aString) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
252 |
/** Creates a RStringF from the supplied RStringToken. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
253 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
254 |
@param aString The value of the string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
255 |
@return Initialised RStringF object */ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
256 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
257 |
RStringF r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
258 |
r.iPool = *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
259 |
r.iVal = aString.iVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
260 |
return r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
261 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
262 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
263 |
EXPORT_C RStringF RStringPool::StringF(TInt aIndex,const TStringTable& aTable) const |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
264 |
/** Gets a case-insensitive string specified by a string table enumeration value. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
265 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
266 |
Creates an RStringF from a string table enumeration value. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
267 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
268 |
aIndex is interpreted as an offset into the handle's pre-loaded string table. |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
269 |
|
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
270 |
@param aIndex The string table enumeration value |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
271 |
@param aTable The string table from which to read the string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
272 |
@return Initialised RStringF object |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
273 |
@panic EStringTableNotFound If the table supplied is not found. This panic is raised in debug builds only, in release mode the behaviour is undefined*/ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
274 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
275 |
__ASSERT_DEBUG(aTable.iCaseSensitive==0,StringPoolPanic::Panic(StringPoolPanic::ECreatingStringWithWrongCase)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
276 |
if(aIndex <(TInt)aTable.iCount) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
277 |
{//the index is in valid range the index |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
278 |
RStringF r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
279 |
r.iPool = *this; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
280 |
TInt16 tableUid = iImplementation->TableUid(aTable); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
281 |
__ASSERT_DEBUG(tableUid!=KErrNotFound,StringPoolPanic::Panic(StringPoolPanic::EStringTableNotFound)); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
282 |
r.iVal = StringUtils::ValFromIndexF(aIndex, tableUid); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
283 |
TInt originalVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
284 |
if (KErrNotFound!=(originalVal=iImplementation->FindFirstValFromDuplicate(r.iVal))) |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
285 |
{ |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
286 |
r.iVal=originalVal; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
287 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
288 |
return r; |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
289 |
} |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
290 |
else // the index is out of range so return an empty string |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
291 |
return RStringF(); |
0a7b44b10206
Catch up of Symbian tools for @1627812
Pat Downey <patrick.downey@nokia.com>
parents:
diff
changeset
|
292 |
} |