00001 /* 00002 * ============================================================================ 00003 * Name : StringLoader.h 00004 * Part of : Common Service / Common Engine 00005 * Interface : SDK, String Loader API 00006 * Description : String Loader API provides methods for loading resource 00007 * strings and formatting them. 00008 * Version : %version: ou1cfspd#14 % 00009 * 00010 * Copyright © 2002-2006 Nokia. All rights reserved. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia. All rights are reserved. Copying, including 00014 * reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia. This material also contains confidential 00017 * information which may not be disclosed 00018 * ============================================================================ 00019 */ 00020 #ifndef STRINGLOADER_H 00021 #define STRINGLOADER_H 00022 00023 // INCLUDE FILES 00024 #include <coemain.h> 00025 #include <biditext.h> 00026 00027 // CLASS DECLARATION 00028 00204 class StringLoader 00205 { 00206 public: 00207 00223 IMPORT_C static void Load( TDes& aDest, TInt aResourceId, 00224 CCoeEnv* aLoaderEnv = NULL ); 00225 00263 IMPORT_C static void Format( TDes& aDest, const TDesC& aSource, 00264 TInt aPosition, TInt aSubs ); 00265 00304 IMPORT_C static void Format( TDes& aDest, const TDesC& aSource, 00305 TInt aPosition, const TDesC& aSubs ); 00306 00320 IMPORT_C static HBufC* LoadL( TInt aResourceId, 00321 CCoeEnv* aLoaderEnv = NULL ); 00322 00342 IMPORT_C static HBufC* LoadL( TInt aResourceId, TInt aInt, 00343 CCoeEnv* aLoaderEnv = NULL ); 00344 00364 IMPORT_C static HBufC* LoadL( TInt aResourceId, 00365 const TDesC& aString, 00366 CCoeEnv* aLoaderEnv = NULL ); 00367 00390 IMPORT_C static HBufC* LoadL( TInt aResourceId, const TDesC& aString, 00391 TInt aInt, CCoeEnv* aLoaderEnv = NULL ); 00392 00413 IMPORT_C static HBufC* LoadL( TInt aResourceId, 00414 const CArrayFix<TInt>& aInts, 00415 CCoeEnv* aLoaderEnv = NULL ); 00416 00438 IMPORT_C static HBufC* LoadL( TInt aResourceId, 00439 const MDesCArray& aStrings, 00440 CCoeEnv* aLoaderEnv = NULL ); 00441 00465 IMPORT_C static HBufC* LoadL( TInt aResourceId, 00466 const MDesCArray& aStrings, 00467 const CArrayFix<TInt>& aInts, 00468 CCoeEnv* aLoaderEnv = NULL ); 00484 IMPORT_C static HBufC* LoadLC( TInt aResourceId, 00485 CCoeEnv* aLoaderEnv = NULL ); 00486 00507 IMPORT_C static HBufC* LoadLC( TInt aResourceId, TInt aInt, 00508 CCoeEnv* aLoaderEnv = NULL ); 00509 00530 IMPORT_C static HBufC* LoadLC( TInt aResourceId, 00531 const TDesC& aString, 00532 CCoeEnv* aLoaderEnv = NULL ); 00533 00557 IMPORT_C static HBufC* LoadLC( TInt aResourceId, const TDesC& aString, 00558 TInt aInt, CCoeEnv* aLoaderEnv = NULL ); 00559 00582 IMPORT_C static HBufC* LoadLC( TInt aResourceId, 00583 const CArrayFix<TInt>& aInts, 00584 CCoeEnv* aLoaderEnv = NULL ); 00585 00608 IMPORT_C static HBufC* LoadLC( TInt aResourceId, 00609 const MDesCArray& aStrings, 00610 CCoeEnv* aLoaderEnv = NULL ); 00611 00636 IMPORT_C static HBufC* LoadLC( TInt aResourceId, 00637 const MDesCArray& aStrings, 00638 const CArrayFix<TInt>& aInts, 00639 CCoeEnv* aLoaderEnv = NULL ); 00640 00641 private: 00642 00646 StringLoader(); 00647 00648 // Prohibit copy constructor 00649 StringLoader( const StringLoader& ); 00650 // Prohibit assigment operator 00651 StringLoader& operator= ( const StringLoader& ); 00652 00663 static HBufC* FormatStringL( 00664 const TDesC& aSource, 00665 const TDesC& aKey, 00666 const TDesC& aSubs ); 00667 00684 static HBufC* FormatStringL( 00685 const TDesC& aSource, 00686 const TDesC& aKey, 00687 const TDesC& aSubs, 00688 TBidiText::TDirectionality aDirectionality, 00689 TInt& aParamCount, 00690 TInt aSubCount); 00691 00701 static HBufC* FormatStringL( TDesC& aSource, 00702 const CArrayFix<TInt>& aInts, 00703 TInt aMax ); 00704 00717 static HBufC* FormatStringL( TDesC& aSource, 00718 const MDesCArray& aStrings, 00719 TInt aMax); 00733 static TInt Formater( 00734 TDes& aDest, 00735 const TDesC& aSource, 00736 const TDesC& aKey, 00737 const TDesC& aSubs, 00738 TBidiText::TDirectionality aDirectionality); 00739 00749 static void KeyStringFormater( TDes& aDest, const TText& aKey, 00750 TInt aPosition, const TDesC& aKeyString ); 00751 00756 static TBidiText::TDirectionality ResolveDirectionality( TDes& aText ); 00757 00766 static TInt GetParamCount( const TDesC& aText, TInt aIndex = -1); 00767 00777 static TInt GetSubStringCount( const TDesC& aText ); 00778 }; 00779 00780 // STRINGLOADER_H 00781 #endif 00782 00783 // End of File