epoc32/include/stringloader.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100 (2010-03-31)
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  String Loader API provides methods for loading resource
williamr@2
    15
*                strings and formatting them.
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
#ifndef STRINGLOADER_H
williamr@2
    20
#define STRINGLOADER_H
williamr@2
    21
williamr@2
    22
// INCLUDE FILES
williamr@2
    23
#include    <coemain.h>
williamr@2
    24
#include    <biditext.h>
williamr@2
    25
williamr@2
    26
// CLASS DECLARATION
williamr@2
    27
williamr@2
    28
/**
williamr@2
    29
* Class provides methods to load and format resource strings.
williamr@2
    30
* String Loader API provides an interface to load and format resource strings
williamr@2
    31
* that may contain parameter(s) (\%U for text or or \%N for numerical).
williamr@2
    32
* Resource strings are usually defined in an RSS file.
williamr@2
    33
*
williamr@2
    34
* The API consists of the StringLoader class. All methods are static, so there is
williamr@2
    35
* no need to explicitly allocate memory for the interface class.
williamr@2
    36
* The implementation needs a CCoeEnv instance to access for example the
williamr@2
    37
* resource files.
williamr@2
    38
*
williamr@2
    39
*
williamr@2
    40
* Usage:
williamr@2
    41
*
williamr@2
    42
* Applications load and format resource strings from normal resources with
williamr@2
    43
* static methods of the StringLoader class. The loading is done with the LoadL
williamr@2
    44
* and LoadLC methods and with the Load method in situations where memory
williamr@2
    45
* allocation from the heap is not possible. Formatting is done automatically
williamr@2
    46
* after loading in the LoadL and LoadLC methods, but it can also be done
williamr@2
    47
* separately with the Format method in situations where memory allocation from
williamr@2
    48
* the heap is not possible. For reading the resource strings with the Load,
williamr@2
    49
* LoadL and LoadLC methods, the user should provide a pointer to CCoeEnv for
williamr@2
    50
* efficiency reasons. If the pointer is not provided, the implementation uses
williamr@2
    51
* the CCoeEnv::Static method internally to get it.
williamr@2
    52
*
williamr@2
    53
* Different size displays can handle different length strings. To take full
williamr@2
    54
* advantage of this fact, StringLoader supports resource strings with multiple
williamr@2
    55
* options for string separated by 0x0001 character. Each such string can
williamr@2
    56
* contain same or different sub string keys (\%U and \%N). StringLoader returns
williamr@2
    57
* all strings, it is responsibility of the caller to parse the result and
williamr@2
    58
* choose the proper string to display.
williamr@2
    59
*
williamr@2
    60
* Setting the maximum sub string length may be done in the text resources. Sub
williamr@2
    61
* string maximum lengths can be localized separately for every language.
williamr@2
    62
* The maximum sub string length is of the format: \%U[NN]
williamr@2
    63
* where NN is a number [01..99]. Please note that NN must always consist of two
williamr@2
    64
* characters, i.e. if the sub string maximum length is eight characters, the
williamr@2
    65
* value to be used is 08, not plain 8. If the number of characters exceeds the
williamr@2
    66
* maximum length, the sub string is cut to fit and the last character is
williamr@2
    67
* replaced with an ellipsis character.
williamr@2
    68
*
williamr@2
    69
* The following examples describe the usage of the String Loader API.
williamr@2
    70
*
williamr@2
    71
* Usage when one TInt is added:
williamr@2
    72
*
williamr@2
    73
* @code
williamr@2
    74
*  // In .loc -file
williamr@2
    75
*  // #define text_example "You have %N undone tasks."
williamr@2
    76
*
williamr@2
    77
*  // In .rss -file
williamr@2
    78
*  // RESOURCE TBUF r_text_example { buf = text_example; }
williamr@2
    79
*
williamr@2
    80
*  // (In the .cpp -file)
williamr@2
    81
*  #include <stringloader.h>
williamr@2
    82
*
williamr@2
    83
*  // Get CCoeEnv instance
williamr@2
    84
*  CEikonEnv* iEikonEnv = CEikonEnv::Static();
williamr@2
    85
*
williamr@2
    86
*  TInt number( 324 );
williamr@2
    87
*
williamr@2
    88
*  // Method reads a resource string with memory allocation
williamr@2
    89
*  // and replaces all %N-strings in it with a replacement TInt.
williamr@2
    90
*  // The heap descriptor must be destroyed when it is no longer needed.
williamr@2
    91
*  // iEikonEnv is needed for loading the resource string.
williamr@2
    92
*  HBufC* stringholder = StringLoader::LoadL( R_TEXT_EXAMPLE, number, iEikonEnv );
williamr@2
    93
*
williamr@2
    94
*  // The 'number' is added to the resource string. The result is
williamr@2
    95
*  // that stringholder points to a heap descriptor containing string:
williamr@2
    96
*  // "You have 324 undone tasks."
williamr@2
    97
*
williamr@2
    98
*  // Delete the heap descriptor
williamr@2
    99
*  delete stringholder;
williamr@2
   100
* @endcode
williamr@2
   101
*
williamr@2
   102
*
williamr@2
   103
* Usage when several strings are added:
williamr@2
   104
*
williamr@2
   105
* Index can be included to parameters. Several parameters can have same index,
williamr@2
   106
* if same replacement is needed multiple times.
williamr@2
   107
*
williamr@2
   108
* @code
williamr@2
   109
*  // In .loc -file
williamr@2
   110
*  // #define text_example "I'm %2U%1U %3U%0U fine."
williamr@2
   111
*
williamr@2
   112
*  // In .rss -file
williamr@2
   113
*  // RESOURCE TBUF r_text_example { buf = text_example; }
williamr@2
   114
*
williamr@2
   115
*  // In the .cpp -file
williamr@2
   116
*  #include <stringloader.h>
williamr@2
   117
*
williamr@2
   118
*  // Get CCoeEnv instance
williamr@2
   119
*  CEikonEnv* iEikonEnv = CEikonEnv::Static();
williamr@2
   120
*
williamr@2
   121
*  CDesCArrayFlat* strings = new CDesCArrayFlat( 4 );
williamr@2
   122
*  CleanupStack::PushL( strings );
williamr@2
   123
*
williamr@2
   124
*  strings->AppendL( _L("orking") ); //First string
williamr@2
   125
*
williamr@2
   126
*  strings->AppendL( _L("ll") ); //Second string
williamr@2
   127
*
williamr@2
   128
*  strings->AppendL( _L("sti") ); //Third string
williamr@2
   129
*
williamr@2
   130
*  strings->AppendL( _L("w") ); //Fourth string
williamr@2
   131
*
williamr@2
   132
*  // Method reads a resource string with memory allocation and replaces
williamr@2
   133
*  // the %(index)U strings in it with replacement strings from an array.
williamr@2
   134
*  // The heap descriptor must be destroyed when it is no longer needed.
williamr@2
   135
*  // iEikonEnv is needed for loading the resource string.
williamr@2
   136
*  HBufC* stringholder = StringLoader::LoadL( R_TEXT_EXAMPLE, *strings, iEikonEnv );
williamr@2
   137
*
williamr@2
   138
*  // Four strings are added to the resource string. The result is
williamr@2
   139
*  // that stringholder points to a heap descriptor containing string:
williamr@2
   140
*  // "I'm still working fine."
williamr@2
   141
*
williamr@2
   142
*  // Pop and delete strings array
williamr@2
   143
*  CleanupStack::PopAndDestroy();
williamr@2
   144
*
williamr@2
   145
*  // Delete the heap descriptor
williamr@2
   146
*  delete stringholder;
williamr@2
   147
* @endcode
williamr@2
   148
*
williamr@2
   149
*
williamr@2
   150
* Usage with scalable UI support:
williamr@2
   151
*
williamr@2
   152
* @code
williamr@2
   153
*  // In .loc -file
williamr@2
   154
*  // #define TEXT_EXAMPLE "You have missed %N messages from %U."<0x0001>"Missed %N msgs from %U."<0x0001>"Missed %N msgs."
williamr@2
   155
*
williamr@2
   156
*  // In .rss -file
williamr@2
   157
*  // RESOURCE TBUF R_TEXT_EXAMPLE { buf = TEXT_EXAMPLE; }
williamr@2
   158
*
williamr@2
   159
*  // In the .cpp -file
williamr@2
   160
*  #include <stringloader.h>
williamr@2
   161
*
williamr@2
   162
*  // Get CCoeEnv instance
williamr@2
   163
*  CEikonEnv* iEikonEnv = CEikonEnv::Static();
williamr@2
   164
*
williamr@2
   165
*  TInt number( 12 );
williamr@2
   166
*  _LIT(name, "John Doe");
williamr@2
   167
*
williamr@2
   168
*  // Method reads a resource string with memory allocation,
williamr@2
   169
*  // replaces all %N strings in it with a replacement TInt and
williamr@2
   170
*  // all %U strings in it with a replacement string.
williamr@2
   171
*  // The heap descriptor must be destroyed  when it is no longer needed.
williamr@2
   172
*  // iEikonEnv is needed for loading the resource string.
williamr@2
   173
*  HBufC* stringholder = StringLoader::LoadL( R_TEXT_EXAMPLE, name, number, iEikonEnv );
williamr@2
   174
*
williamr@2
   175
*  // The number and name are added to the resource string. The result is
williamr@2
   176
*  // that stringholder points to a heap descriptor containing string:
williamr@2
   177
*  // "You have missed 12 messages from John Doe.\001Missed 12 msgs from John
williamr@2
   178
*  // Doe.\001Missed 12 msgs."
williamr@2
   179
*
williamr@2
   180
*  // Delete the heap descriptor
williamr@2
   181
*  delete stringholder;
williamr@2
   182
* @endcode
williamr@2
   183
*
williamr@2
   184
*
williamr@2
   185
* Error handling:
williamr@2
   186
*
williamr@2
   187
* The leave mechanism of the Symbian OS environment is used to handle memory
williamr@2
   188
* exhaustion. The panic mechanism is used to handle programming errors while
williamr@2
   189
* debugging. RStringLoader panics for seven different reasons. The panic 
williamr@2
   190
* category is named STRINGLOADER. The panic codes are:
williamr@2
   191
*
williamr@2
   192
* - ETooFewArguments        = 0 (Unsolved parameters in resource string.)
williamr@2
   193
* - ETooManyArguments       = 1 (Already solved all parameters in  resource string.)
williamr@2
   194
* - EKeyStringNotFound      = 2 (The key string wasn't found in formatting.)
williamr@2
   195
* - EInvalidIndex           = 3 (Invalid index in Format-method)
williamr@2
   196
* - EDescriptorTooSmall     = 4 (Too small destination descriptor.)
williamr@2
   197
* - ECCoeEnvNotInitialized  = 5 (CCoeEnv is not initialized)
williamr@2
   198
* - EInvalidSubstitute      = 6 (Substituted string contains KSubStringSeparator)
williamr@2
   199
*
williamr@2
   200
* @lib commonengine.lib
williamr@2
   201
* @since S60 2.0
williamr@2
   202
*/
williamr@2
   203
class StringLoader
williamr@2
   204
    {
williamr@2
   205
    public:
williamr@2
   206
williamr@2
   207
        /**
williamr@2
   208
        * Load( TDes&, TInt ) reads a resource string without memory
williamr@2
   209
        * allocation. The loaded string is stored in the destination TDes&.
williamr@2
   210
        * Because this method doesn't allocate memory the destination 
williamr@2
   211
        * descriptor must be long enough.
williamr@2
   212
        *
williamr@2
   213
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   214
        * @param aDest Reference to the descriptor where the resource string
williamr@2
   215
        *              is loaded.
williamr@2
   216
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   217
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   218
        *
williamr@2
   219
        * @panic ECCoeEnvNotInitialized Parameter aLoaderEnv is NULL and 
williamr@2
   220
        *                               CCoeEnv::Static returned NULL.
williamr@2
   221
        */
williamr@2
   222
        IMPORT_C static void Load( TDes& aDest, TInt aResourceId,
williamr@2
   223
                                   CCoeEnv* aLoaderEnv = NULL );
williamr@2
   224
williamr@2
   225
        /**
williamr@2
   226
        * Format( TDes&, TDesC&, TInt, TInt ) formats a resource string without
williamr@2
   227
        * memory allocation. The formatted string is stored in the destination
williamr@2
   228
        * TDes&. Because this method doesn't allocate memory the destination 
williamr@2
   229
        * descriptor must be long enough. In aPosition -1 means that there is
williamr@2
   230
        * no index in the key string and all \%N-strings in the original string 
williamr@2
   231
        * are replaced with aSubs. In debug builds the Symbian OS panic 
williamr@2
   232
        * mechanism is used to notify programming errors.
williamr@2
   233
        *
williamr@2
   234
        * @param aDest Reference to the descriptor where the resource string
williamr@2
   235
        *              is formatted.
williamr@2
   236
        * @param aSource Reference to the original string.
williamr@2
   237
        * @param aPosition The index of the key string.
williamr@2
   238
        * @param aSubs The replacing TInt.
williamr@2
   239
        *
williamr@2
   240
        * @panic EInvalidIndex In debug build if the index of the key string 
williamr@2
   241
        *                      is invalid.
williamr@2
   242
        * @panic EDescriptorTooSmall In debug build if the length of the 
williamr@2
   243
        *                            destination descriptor is to small.
williamr@2
   244
        * @panic EKeyStringNotFound In debug build if the key string 'N' wasn't
williamr@2
   245
        *                           found, aDest is empty.
williamr@2
   246
        *
williamr@2
   247
        * One small sample describing the usage of the method.
williamr@2
   248
        * @code
williamr@2
   249
        * // Load example string "%0N %1N" defined in rss- and loc-files.
williamr@2
   250
        * // %0N stands for area code and %1N for phone number.
williamr@2
   251
        * HBufC* telFormat = StringLoader::LoadLC( R_TEL_FORMAT, iEikonEnv );
williamr@2
   252
        *
williamr@2
   253
        * // The replacing number.
williamr@2
   254
        * TInt areaCode(123);
williamr@2
   255
        *
williamr@2
   256
        * StringLoader::Format( destBuf, telFormat, 
williamr@2
   257
        *                       0, // %0N stands for area code
williamr@2
   258
        *                       areaCode );
williamr@2
   259
        *
williamr@2
   260
        * // After returning destBuf contains string "123 %1N".
williamr@2
   261
        */
williamr@2
   262
        IMPORT_C static void Format( TDes& aDest, const TDesC& aSource,
williamr@2
   263
                                   TInt aPosition, TInt aSubs );
williamr@2
   264
williamr@2
   265
        /**
williamr@2
   266
        * Format( TDes&, TDesC&, TInt, TDesC& ) formats a resource string
williamr@2
   267
        * without memory allocation. The formatted string is stored in the
williamr@2
   268
        * destination TDes&. Because this method doesn't allocate memory the 
williamr@2
   269
        * destination descriptor must be long enough. In aPosition -1 means 
williamr@2
   270
        * that there is no index in the key string and all \%U-strings in the
williamr@2
   271
        * original string are replaced with aSubs. In debug builds the 
williamr@2
   272
        * Symbian OS panic mechanism is used to notify programming errors.
williamr@2
   273
        *
williamr@2
   274
        * @param aDest Reference to the descriptor where the resource string
williamr@2
   275
        *              is formatted.
williamr@2
   276
        * @param aSource Reference to the original string.
williamr@2
   277
        * @param aPosition The index of the key string.
williamr@2
   278
        * @param aSubs Reference to the replacing string.
williamr@2
   279
        *       
williamr@2
   280
        * @panic EInvalidIndex In debug build if the index of the key string 
williamr@2
   281
        *                      is invalid.
williamr@2
   282
        * @panic EDescriptorTooSmall In debug build if the length of the 
williamr@2
   283
        *                            destination descriptor is to small.
williamr@2
   284
        * @panic EKeyStringNotFound In debug build if the key string 'U' wasn't
williamr@2
   285
        *                           found, aDest is empty.
williamr@2
   286
        *
williamr@2
   287
        * One small sample describing the usage of the method.
williamr@2
   288
        * @code
williamr@2
   289
        * // Load example string "%0U %1U" defined in rss- and loc-files.
williamr@2
   290
        * // %0U stands for weekday string and %1U for date string.
williamr@2
   291
        * HBufC* timeFormat = StringLoader::LoadLC( R_TIME_FORMAT, iEikonEnv );
williamr@2
   292
        *
williamr@2
   293
        * // The replacing string.
williamr@2
   294
        * _LIT(dateString, "02/10/2006");
williamr@2
   295
        *
williamr@2
   296
        * StringLoader::Format( destBuf, timeFormat, 
williamr@2
   297
        *                       1, // %1U stands for date string
williamr@2
   298
        *                       dateString );
williamr@2
   299
        *
williamr@2
   300
        * // After returning destBuf contains string "%0U 02/10/2006".
williamr@2
   301
        * @endcode
williamr@2
   302
        */
williamr@2
   303
        IMPORT_C static void Format( TDes& aDest, const TDesC& aSource,
williamr@2
   304
                                   TInt aPosition, const TDesC& aSubs );
williamr@2
   305
williamr@2
   306
        /**
williamr@2
   307
        * LoadL( TInt ) reads a resource string with memory allocation. 
williamr@2
   308
        *
williamr@2
   309
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   310
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   311
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   312
        * @return Pointer to a heap descriptor containing the resource
williamr@2
   313
        *         string. The calling program must destroy the heap descriptor
williamr@2
   314
        *         when it is no longer needed.
williamr@2
   315
        *
williamr@2
   316
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   317
        *                         CCoeEnv::Static returned NULL.
williamr@2
   318
        */
williamr@2
   319
        IMPORT_C static HBufC* LoadL( TInt aResourceId,
williamr@2
   320
                                      CCoeEnv* aLoaderEnv = NULL );
williamr@2
   321
williamr@2
   322
        /**
williamr@2
   323
        * LoadL( TInt, TInt ) reads a resource string with memory
williamr@2
   324
        * allocation and replaces all \%N strings in it with a replacement
williamr@2
   325
        * TInt. In debug builds the Symbian OS panic mechanism is used to 
williamr@2
   326
        * notify programming errors.
williamr@2
   327
        * 
williamr@2
   328
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   329
        * @param aInt The replacing TInt.
williamr@2
   330
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   331
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   332
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   333
        *         resource string. The calling program must destroy the heap 
williamr@2
   334
        *         descriptor when it is no longer needed.
williamr@2
   335
        *
williamr@2
   336
        * @panic EKeyStringNotFound In debug build if the key string 'N' wasn't
williamr@2
   337
        *                           found in formatting.
williamr@2
   338
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   339
        *                         CCoeEnv::Static returned NULL.
williamr@2
   340
        */
williamr@2
   341
        IMPORT_C static HBufC* LoadL( TInt aResourceId, TInt aInt,
williamr@2
   342
                                      CCoeEnv* aLoaderEnv = NULL );
williamr@2
   343
williamr@2
   344
        /**
williamr@2
   345
        * LoadL( TInt, const TDesC& ) reads a resource string with memory
williamr@2
   346
        * allocation and replaces all \%U-strings in it with a replacement
williamr@2
   347
        * string. In debug builds the Symbian OS panic mechanism is used to 
williamr@2
   348
        * notify programming errors.
williamr@2
   349
        *
williamr@2
   350
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   351
        * @param aString Reference to the replacing string.
williamr@2
   352
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   353
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   354
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   355
        *         resource string. The calling program must destroy the heap 
williamr@2
   356
        *         descriptor when it is no longer needed.
williamr@2
   357
        *
williamr@2
   358
        * @panic EKeyStringNotFound In debug build if the key string 'U' wasn't
williamr@2
   359
        *                           found in formatting.
williamr@2
   360
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   361
        *                         CCoeEnv::Static returned NULL.
williamr@2
   362
        */
williamr@2
   363
        IMPORT_C static HBufC* LoadL( TInt aResourceId,
williamr@2
   364
                                    const TDesC& aString,
williamr@2
   365
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   366
williamr@2
   367
        /**
williamr@2
   368
        * LoadL( TInt, const TDesC&, TInt ) reads a resource string
williamr@2
   369
        * with memory allocation, replaces all \%N-strings in it with
williamr@2
   370
        * a replacement TInt and all \%U-strings in it with a replacement
williamr@2
   371
        * string. In debug builds the Symbian OS panic mechanism is used to 
williamr@2
   372
        * notify programming errors.
williamr@2
   373
        *
williamr@2
   374
        * @param aResourceId The numeric ID of the resource string to be
williamr@2
   375
        *                    read.
williamr@2
   376
        * @param aString Reference to the replacing string.
williamr@2
   377
        * @param aInt The replacing TInt.
williamr@2
   378
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   379
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   380
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   381
        *         resource string. The calling program must destroy the heap
williamr@2
   382
        *         descriptor when it is no longer needed.
williamr@2
   383
        *
williamr@2
   384
        * @panic EKeyStringNotFound In debug build if the key string 'N' or 'U'
williamr@2
   385
        *                           wasn't found in formatting.
williamr@2
   386
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   387
        *                         CCoeEnv::Static returned NULL.
williamr@2
   388
        */
williamr@2
   389
        IMPORT_C static HBufC* LoadL( TInt aResourceId, const TDesC& aString,
williamr@2
   390
                                    TInt aInt, CCoeEnv* aLoaderEnv = NULL );
williamr@2
   391
williamr@2
   392
        /**
williamr@2
   393
        * LoadL( TInt, const CArrayFix<TInt>& ) reads a resource string with
williamr@2
   394
        * memory allocation and replaces the \%(index)N-strings in it with
williamr@2
   395
        * replacement TInts from an array. In debug builds the Symbian OS 
williamr@2
   396
        * panic mechanism is used to notify programming errors.
williamr@2
   397
        *
williamr@2
   398
        * @param aResourceId The numeric ID of the resource string to be
williamr@2
   399
        *                    read.
williamr@2
   400
        * @param aInts Reference to the array including the replacing TInts.
williamr@2
   401
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   402
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   403
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   404
        *         resource string. The calling program must destroy the heap
williamr@2
   405
        *         descriptor when it is no longer needed.
williamr@2
   406
        *
williamr@2
   407
        * @panic ETooManyArguments In debug build if too many replacing 
williamr@2
   408
        *                          elements in aInts array.
williamr@2
   409
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   410
        *                         CCoeEnv::Static returned NULL.
williamr@2
   411
        */
williamr@2
   412
        IMPORT_C static HBufC* LoadL( TInt aResourceId,
williamr@2
   413
                                    const CArrayFix<TInt>& aInts,
williamr@2
   414
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   415
williamr@2
   416
        /**
williamr@2
   417
        * LoadL( TInt, const MDesCArray& ) reads a resource string with
williamr@2
   418
        * memory allocation and replaces the \%(index)U-strings in it with
williamr@2
   419
        * replacement strings from an array. In debug builds the Symbian OS 
williamr@2
   420
        * panic mechanism is used to notify programming errors.
williamr@2
   421
        *
williamr@2
   422
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   423
        * @param aStrings Reference to the array  including pointers to the
williamr@2
   424
        *                 replacing strings.
williamr@2
   425
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   426
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   427
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   428
        *         resource string. The calling program must destroy the heap
williamr@2
   429
        *         descriptor when it is no longer needed.        
williamr@2
   430
        *        
williamr@2
   431
        * @panic ETooManyArguments In debug build if too many replacing 
williamr@2
   432
        *                          elements in aStrings 
williamr@2
   433
        *                          array.
williamr@2
   434
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   435
        *                         CCoeEnv::Static returned NULL.
williamr@2
   436
        */
williamr@2
   437
        IMPORT_C static HBufC* LoadL( TInt aResourceId,
williamr@2
   438
                                    const MDesCArray& aStrings,
williamr@2
   439
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   440
williamr@2
   441
        /**
williamr@2
   442
        * LoadL( TInt, const MDesCArray&, const CArrayFix<TInt>& ) reads a
williamr@2
   443
        * resource string with memory allocation and replaces the
williamr@2
   444
        * \%(index)U-strings in it with replacement strings from an array and
williamr@2
   445
        * the \%(index)N-strings in it with replacement TInts from another
williamr@2
   446
        * array. In debug builds the Symbian OS panic mechanism is used to 
williamr@2
   447
        * notify programming errors.
williamr@2
   448
        *
williamr@2
   449
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   450
        * @param aStrings Reference to the array including pointers to the
williamr@2
   451
        *                 replacing strings.
williamr@2
   452
        * @param aInts Reference to the array including the replacing TInts.
williamr@2
   453
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   454
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   455
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   456
        *         resource string. The calling program must destroy the heap
williamr@2
   457
        *         descriptor when it is no longer needed.        
williamr@2
   458
        *        
williamr@2
   459
        * @panic ETooManyArguments In debug build if too many replacing 
williamr@2
   460
        *                          elements in aStrings and/or aInts arrays.
williamr@2
   461
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   462
        *                         CCoeEnv::Static returned NULL.
williamr@2
   463
        */
williamr@2
   464
        IMPORT_C static HBufC* LoadL( TInt aResourceId,
williamr@2
   465
                                    const MDesCArray& aStrings,
williamr@2
   466
                                    const CArrayFix<TInt>& aInts,
williamr@2
   467
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   468
        /**
williamr@2
   469
        * LoadLC( TInt ) reads a resource string with memory allocation and
williamr@2
   470
        * pushes the string onto the cleanup stack.
williamr@2
   471
        *
williamr@2
   472
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   473
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   474
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   475
        * @return Pointer to a heap descriptor containing the resource
williamr@2
   476
        *         string. This pointer is in the cleanup stack. The calling 
williamr@2
   477
        *         program should pop and destroy the heap descriptor when it is
williamr@2
   478
        *         no longer needed.
williamr@2
   479
        *        
williamr@2
   480
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   481
        *                         CCoeEnv::Static returned NULL.
williamr@2
   482
        */
williamr@2
   483
        IMPORT_C static HBufC* LoadLC( TInt aResourceId,
williamr@2
   484
                                        CCoeEnv* aLoaderEnv = NULL );
williamr@2
   485
williamr@2
   486
        /**
williamr@2
   487
        * LoadLC( TInt, TInt ) reads a resource string with memory
williamr@2
   488
        * allocation, replaces all \%N-strings in it with a replacement
williamr@2
   489
        * TInt and pushes the string onto the cleanup stack. In debug builds
williamr@2
   490
        * the Symbian OS panic mechanism is used to notify programming errors.
williamr@2
   491
        *
williamr@2
   492
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   493
        * @param aInt the replacing TInt.
williamr@2
   494
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   495
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   496
        * @return pointer to a heap descriptor containing the formatted
williamr@2
   497
        *         resource string. This pointer is in the cleanup stack. 
williamr@2
   498
        *         The calling program should pop and destroy the heap 
williamr@2
   499
        *         descriptor when it is no longer needed.
williamr@2
   500
        *
williamr@2
   501
        * @panic EKeyStringNotFound In debug build if the key string 'N' wasn't
williamr@2
   502
        *                           found in formatting.
williamr@2
   503
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   504
        *                         CCoeEnv::Static returned NULL.
williamr@2
   505
        */
williamr@2
   506
        IMPORT_C static HBufC* LoadLC( TInt aResourceId, TInt aInt,
williamr@2
   507
                                        CCoeEnv* aLoaderEnv = NULL );
williamr@2
   508
williamr@2
   509
        /**
williamr@2
   510
        * LoadLC( TInt, const TDesC& ) reads a resource string with memory
williamr@2
   511
        * allocation, replaces all \%U-strings in it with a replacement
williamr@2
   512
        * string and pushes the string onto the cleanup stack. In debug builds
williamr@2
   513
        * the Symbian OS panic mechanism is used to notify programming errors.
williamr@2
   514
        *
williamr@2
   515
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   516
        * @param aString Reference to the replacing string.
williamr@2
   517
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   518
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   519
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   520
        *         resource string. This pointer is in the cleanup stack.
williamr@2
   521
        *         The calling program should pop and destroy the heap 
williamr@2
   522
        *         descriptor when it is no longer needed.
williamr@2
   523
        *
williamr@2
   524
        * @panic EKeyStringNotFound In debug build if the key string 'U' wasn't
williamr@2
   525
        *                           found in formatting.
williamr@2
   526
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   527
        *                         CCoeEnv::Static returned NULL.
williamr@2
   528
        */
williamr@2
   529
        IMPORT_C static HBufC* LoadLC( TInt aResourceId,
williamr@2
   530
                                    const TDesC& aString,
williamr@2
   531
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   532
williamr@2
   533
        /**
williamr@2
   534
        * LoadLC( TInt, const TDesC&, TInt ) reads a resource string
williamr@2
   535
        * with memory allocation, replaces all \%N-strings in it with
williamr@2
   536
        * a replacement TInt and the first \%U-strings in it with a replacement
williamr@2
   537
        * string and pushes the string onto the cleanup stack. In debug builds
williamr@2
   538
        * the Symbian OS panic mechanism is used to notify programming errors.
williamr@2
   539
        *
williamr@2
   540
        * @param aResourceId The numeric ID of the resource string to be
williamr@2
   541
        *                    read.
williamr@2
   542
        * @param aString Reference to the replacing string.
williamr@2
   543
        * @param aInt The replacing TInt.
williamr@2
   544
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   545
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   546
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   547
        *         resource string. This pointer is in the cleanup stack.
williamr@2
   548
        *         The calling program should pop and destroy the heap 
williamr@2
   549
        *         descriptor when it is no longer needed.
williamr@2
   550
        *
williamr@2
   551
        * @panic EKeyStringNotFound In debug build if the key string 'N' or 'U'
williamr@2
   552
        *                           wasn't found in formatting.
williamr@2
   553
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   554
        *                         CCoeEnv::Static returned NULL.
williamr@2
   555
        */
williamr@2
   556
        IMPORT_C static HBufC* LoadLC( TInt aResourceId, const TDesC& aString,
williamr@2
   557
                                    TInt aInt, CCoeEnv* aLoaderEnv = NULL );
williamr@2
   558
williamr@2
   559
        /**
williamr@2
   560
        * LoadLC( TInt, const CArrayFix<TInt>& ) reads a resource string with
williamr@2
   561
        * memory allocation, replaces the \%(index)N-strings in it with
williamr@2
   562
        * replacement TInts from an array and pushes the string onto the
williamr@2
   563
        * cleanup stack. In debug builds the Symbian OS panic mechanism is 
williamr@2
   564
        * used to notify programming errors.
williamr@2
   565
        *
williamr@2
   566
        * @param aResourceId The numeric ID of the resource string to be
williamr@2
   567
        *                    read.
williamr@2
   568
        * @param aInts Reference to the array including the replacing TInts.
williamr@2
   569
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   570
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   571
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   572
        *         resource string. This pointer is in the cleanup stack.
williamr@2
   573
        *         The calling program should pop and destroy the heap 
williamr@2
   574
        *         descriptor when it is no longer needed.
williamr@2
   575
        *
williamr@2
   576
        * @panic ETooManyArguments In debug build if too many replacing 
williamr@2
   577
        *                          elements in aInts array.
williamr@2
   578
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   579
        *                         CCoeEnv::Static returned NULL.
williamr@2
   580
        */
williamr@2
   581
        IMPORT_C static HBufC* LoadLC( TInt aResourceId,
williamr@2
   582
                                    const CArrayFix<TInt>& aInts,
williamr@2
   583
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   584
williamr@2
   585
        /**
williamr@2
   586
        * LoadLC( TInt, const MDesCArray& ) reads a resource string with
williamr@2
   587
        * memory allocation, replaces the \%(index)U-strings in it with
williamr@2
   588
        * replacement strings from an array and pushes the string onto the
williamr@2
   589
        * cleanup stack. In debug builds the Symbian OS panic mechanism is 
williamr@2
   590
        * used to notify programming errors.
williamr@2
   591
        *
williamr@2
   592
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   593
        * @param aStrings Reference to the array  including pointers to the
williamr@2
   594
        *                 replacing strings.
williamr@2
   595
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   596
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   597
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   598
        *         resource string. This pointer is in the cleanup stack.
williamr@2
   599
        *         The calling program should pop and destroy the heap 
williamr@2
   600
        *         descriptor when it is no longer needed.
williamr@2
   601
        *
williamr@2
   602
        * @panic ETooManyArguments In debug build if too many replacing 
williamr@2
   603
        *                          elements in aStrings array.
williamr@2
   604
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   605
        *                         CCoeEnv::Static returned NULL.
williamr@2
   606
        */
williamr@2
   607
        IMPORT_C static HBufC* LoadLC( TInt aResourceId,
williamr@2
   608
                                    const MDesCArray& aStrings,
williamr@2
   609
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   610
williamr@2
   611
        /**
williamr@2
   612
        * LoadLC( TInt, const MDesCArray&, const CArrayFix<TInt>& ) reads a
williamr@2
   613
        * resource string with memory allocation, replaces the
williamr@2
   614
        * \%(index)U-strings in it with replacement strings from an array and
williamr@2
   615
        * the \%(index)N-strings in it with replacement TInts from another
williamr@2
   616
        * array and pushes the string onto the cleanup stack. In debug builds
williamr@2
   617
        * the Symbian OS panic mechanism is used to notify programming errors.
williamr@2
   618
        *
williamr@2
   619
        * @param aResourceId The numeric ID of the resource string to be read.
williamr@2
   620
        * @param aStrings Reference to the array including pointers to the
williamr@2
   621
        *                 replacing strings.
williamr@2
   622
        * @param aInts Reference to the array including the replacing TInts.
williamr@2
   623
        * @param aLoaderEnv Pointer to the control environment. If user doesn't
williamr@2
   624
        *                   give this, CCoeEnv::Static is called to get it.
williamr@2
   625
        * @return Pointer to a heap descriptor containing the formatted
williamr@2
   626
        *         resource string. This pointer is in the cleanup stack.
williamr@2
   627
        *         The calling program should pop and destroy the heap 
williamr@2
   628
        *         descriptor when it is no longer needed.
williamr@2
   629
        *        
williamr@2
   630
        * @panic ETooManyArguments In debug build if too many replacing 
williamr@2
   631
        *                          elements in aStrings and/or aInts arrays.
williamr@2
   632
        * @leave KErrNotSupported Parameter aLoaderEnv is NULL and 
williamr@2
   633
        *                         CCoeEnv::Static returned NULL.
williamr@2
   634
        */
williamr@2
   635
        IMPORT_C static HBufC* LoadLC( TInt aResourceId,
williamr@2
   636
                                    const MDesCArray& aStrings,
williamr@2
   637
                                    const CArrayFix<TInt>& aInts,
williamr@2
   638
                                    CCoeEnv* aLoaderEnv = NULL );
williamr@2
   639
williamr@2
   640
    private:
williamr@2
   641
williamr@2
   642
        /**
williamr@2
   643
        * C++ default constructor.
williamr@2
   644
        */
williamr@2
   645
        StringLoader();
williamr@2
   646
williamr@2
   647
        // Prohibit copy constructor
williamr@2
   648
        StringLoader( const StringLoader& );
williamr@2
   649
        // Prohibit assigment operator
williamr@2
   650
        StringLoader& operator= ( const StringLoader& );
williamr@2
   651
williamr@2
   652
        /**
williamr@2
   653
		* FormatStringL( const TDesC&, const TDesC&, const TDesC& ) finds the
williamr@2
   654
        * keystring from the source string and replaces it with the
williamr@2
   655
        * replacement string.
williamr@2
   656
        *
williamr@2
   657
        * @param aSource Reference to the source string.
williamr@2
   658
        * @param aKey Reference to the keystring.
williamr@2
   659
        * @param aSubs Reference to the replacing string.
williamr@2
   660
        * @param aDir directionality of the source text
williamr@2
   661
        * @param aFound ETrue if there were any strongly directional 
williamr@2
   662
        *               characters and EFalse if there were none
williamr@2
   663
        * @return Pointer to a heap descriptor containing the formated string.
williamr@2
   664
        */
williamr@2
   665
        static HBufC* FormatStringL(
williamr@2
   666
            const TDesC& aSource,
williamr@2
   667
            const TDesC& aKey,
williamr@2
   668
            const TDesC& aSubs,
williamr@2
   669
            TBidiText::TDirectionality aDir
williamr@2
   670
            );
williamr@2
   671
williamr@2
   672
        /**
williamr@2
   673
		* FormatStringL( const TDesC&, const TDesC&, const TDesC& ) finds the
williamr@2
   674
        * keystring from the source string and replaces it with the
williamr@2
   675
        * replacement string.
williamr@2
   676
        *
williamr@2
   677
        * @param aSource Reference to the source string.
williamr@2
   678
        * @param aKey Reference to the keystring.
williamr@2
   679
        * @param aSubs Reference to the replacing string.
williamr@2
   680
        * @param aDirectionality directionality of the source text
williamr@2
   681
        * @param aParamCount Keeps track of remaining parameters.
williamr@2
   682
        *        Value KUnknownCount denotes that count is not known yet.
williamr@2
   683
        *        Value may be updated by this method to reflect change in count.
williamr@2
   684
        * @param aSubCount Number of '|' separated substrings.
williamr@2
   685
        *        Value KUnknownCount denotes that count is not known yet.
williamr@2
   686
        * @return Pointer to a heap descriptor containing the formated string.
williamr@2
   687
        */
williamr@2
   688
        static HBufC* FormatStringL(
williamr@2
   689
            const TDesC& aSource,
williamr@2
   690
            const TDesC& aKey,
williamr@2
   691
            const TDesC& aSubs,
williamr@2
   692
            TBidiText::TDirectionality aDirectionality,
williamr@2
   693
            TInt& aParamCount,
williamr@2
   694
            TInt aSubCount 
williamr@2
   695
            );
williamr@2
   696
williamr@2
   697
        /**
williamr@2
   698
		* FormatStringL( HbufC*, const CArrayFix<TInt>&, TInt ) finds the
williamr@2
   699
        * \%(index)N-keystrings from the source string and replaces it with the
williamr@2
   700
        * replacement TInts.
williamr@2
   701
        * @param aSource Reference to the source string.
williamr@2
   702
        * @param aInts Reference to the array  containing the replacing TInts.
williamr@2
   703
        * @param aMax Maximum number of key strings in the resource string.
williamr@2
   704
        * @return Pointer to a heap descriptor containing the formated string.
williamr@2
   705
        */
williamr@2
   706
        static HBufC* FormatStringL( TDesC& aSource,
williamr@2
   707
                                   const CArrayFix<TInt>& aInts,
williamr@2
   708
                                   TInt aMax, 
williamr@2
   709
                                   TBidiText::TDirectionality aDir 
williamr@2
   710
                                   );
williamr@2
   711
williamr@2
   712
        /**
williamr@2
   713
		* FormatStringL( HbufC*, const MDesCArray&, TInt ) finds the
williamr@2
   714
        * \%(index)U-keystrings from the source string and replaces it with the
williamr@2
   715
        * replacement strings.
williamr@2
   716
        *
williamr@2
   717
        * @param aSource Reference to the source string.
williamr@2
   718
        * @param aStrings Reference to the array containing pointers to the
williamr@2
   719
        *                 replacing strings.
williamr@2
   720
        * @param aMax Maximum number of key strings in the resource string.
williamr@2
   721
        * @return Pointer to a heap descriptor containing the formated
williamr@2
   722
        *         string.
williamr@2
   723
        */
williamr@2
   724
        static HBufC* FormatStringL( TDesC& aSource,
williamr@2
   725
                                   const MDesCArray& aStrings,
williamr@2
   726
                                   TInt aMax,
williamr@2
   727
                                   TBidiText::TDirectionality aDir
williamr@2
   728
                                   );
williamr@2
   729
        /**
williamr@2
   730
		* Formater( TDes&, const TDesC&, const TDesC&, const TDesC& ) finds
williamr@2
   731
        * the keystring from the source string and replaces it with the
williamr@2
   732
        * replacement string. The formated string is stored in the destination
williamr@2
   733
        * descriptor.
williamr@2
   734
        *
williamr@2
   735
        * @param aDest Reference to the destination descriptor.
williamr@2
   736
        * @param aSource Reference to the source string.
williamr@2
   737
        * @param aKey Reference to the keystring.
williamr@2
   738
        * @param aSubs Reference to the replacing string.
williamr@2
   739
        * @param aDirectionality directionality of the main text
williamr@2
   740
        * @return Number of keystrings replaced.
williamr@2
   741
        */
williamr@2
   742
        static TInt Formater(
williamr@2
   743
            TDes& aDest,
williamr@2
   744
            const TDesC& aSource,
williamr@2
   745
            const TDesC& aKey,
williamr@2
   746
            const TDesC& aSubs,
williamr@2
   747
            TBidiText::TDirectionality aDirectionality
williamr@2
   748
            );
williamr@2
   749
williamr@2
   750
        /**
williamr@2
   751
		* KeyStringFormater( TDes&, const TText&, TInt, const TDesC& ) formats
williamr@2
   752
        * the keystring from given parameters.
williamr@2
   753
        *
williamr@2
   754
        * @param aDest Reference to the destination descriptor.
williamr@2
   755
        * @param aKey Reference to the key letter.
williamr@2
   756
        * @param aPosition index of the key string.
williamr@2
   757
        * @param aKeyString Reference to the keystring.
williamr@2
   758
        */
williamr@2
   759
        static void KeyStringFormater( TDes& aDest, const TText& aKey,
williamr@2
   760
                                        TInt aPosition, const TDesC& aKeyString );
williamr@2
   761
        
williamr@2
   762
        /**
williamr@2
   763
        * Resolves directionality of the given source text.
williamr@2
   764
        * Place-holder strings are removed so that they don't affect the result.
williamr@2
   765
        */
williamr@2
   766
        static TBidiText::TDirectionality ResolveDirectionality( TDes& aText, TBool* aFound );
williamr@2
   767
williamr@2
   768
        /**
williamr@2
   769
        * Counts the number of parameters in the text.
williamr@2
   770
        * Needed for correct memory allocations.
williamr@2
   771
        *
williamr@2
   772
        * @param aText  Source text
williamr@2
   773
        * @param aIndex Index to count. If index is invalid, counts all indexes.
williamr@2
   774
        * @return       Parameter count
williamr@2
   775
        */
williamr@2
   776
        static TInt GetParamCount( const TDesC& aText, TInt aIndex = -1);
williamr@2
   777
williamr@2
   778
        /**
williamr@2
   779
        * Counts the number of substrings (separated by '|'s) in the text.
williamr@2
   780
        * If no '|' is found, but aText length is greater than zero, return 1.
williamr@2
   781
        * If aText length is zero, return zero.
williamr@2
   782
        * Needed for correct memory allocations.
williamr@2
   783
        *
williamr@2
   784
        * @param aText  Source text
williamr@2
   785
        * @return       Substring count
williamr@2
   786
        */
williamr@2
   787
        static TInt GetSubStringCount( const TDesC& aText );
williamr@2
   788
        
williamr@2
   789
        /**
williamr@2
   790
        * Resolves directionality of the given source text.
williamr@2
   791
        * Uses ResolveDirectionality().
williamr@2
   792
        */
williamr@2
   793
        static TBidiText::TDirectionality DirectionalityL( const TDesC& aText, TBool* aFound );
williamr@2
   794
        
williamr@2
   795
        /**
williamr@2
   796
        * Resolves sub strings. Uses ResolveSubStringL()
williamr@2
   797
        */
williamr@2
   798
        static HBufC* ResolveSubStringDirsL( TDes& aText, TInt aCount, TBool* aMarker );
williamr@2
   799
        
williamr@2
   800
        /**
williamr@2
   801
        * Resolves sub string and directionality of the sub string.
williamr@2
   802
        * Adds no dir marker if directionality of the string not found.
williamr@2
   803
        *        
williamr@2
   804
        * @param aText  Source text. After returnig returned sub string 
williamr@2
   805
        *               removed from aText.
williamr@2
   806
        * @param aMarker After returning ETrue if no dir marker added, otherwise EFalse.
williamr@2
   807
        * @return       Substring
williamr@2
   808
        */
williamr@2
   809
        static HBufC* ResolveSubStringL( TDes& aText, TBool* aMarker );
williamr@2
   810
        
williamr@2
   811
        /**
williamr@2
   812
        * Removes no dir markers from source text.
williamr@2
   813
        *
williamr@2
   814
        * @param aText Source text.
williamr@2
   815
        */
williamr@2
   816
        static void RemoveNoDirMarkers( TDes& aText );
williamr@2
   817
    
williamr@2
   818
        /**
williamr@2
   819
        * Used by exported Format methods.
williamr@2
   820
        */                             
williamr@2
   821
        static void FormatL( TDes& aDest, const TDesC& aSource,
williamr@2
   822
                             const TDesC& aKeybuf, const TDesC& aSubs );
williamr@2
   823
    };
williamr@2
   824
williamr@2
   825
#endif      // STRINGLOADER_H
williamr@2
   826
williamr@2
   827
// End of File