00001 /* 00002 * ============================================================================ 00003 * Name : PtiUserDictionary.h 00004 * Part of : PtiEngine 00005 * Description: Predective text input engine user dictionary 00006 * class definition. 00007 * Version: 00008 * 00009 * Copyright © 2003 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * ============================================================================ 00019 */ 00020 #ifndef _PTI_USER_DICTIONARY_H 00021 #define _PTI_USER_DICTIONARY_H 00022 00023 // INCLUDES 00024 #include <e32base.h> 00025 00026 class MPtiUserDictionary 00027 { 00028 public: 00034 virtual TInt Id() const = 0; 00035 00041 virtual TInt Size() const = 0; 00042 00048 virtual TInt32 CoreUID() const = 0; 00049 00055 virtual TBool IsDefault() const = 0; 00056 00062 virtual TPtrC FileName() const = 0; 00063 00071 virtual TInt SpaceLeft() const = 0; 00072 00078 virtual TBool UpdateFlag() const = 0; 00079 00086 virtual void SetUpdateFlag(TBool aFlag) = 0; 00087 }; 00088 00089 00090 class CPtiUserDictionary : public CBase, public MPtiUserDictionary 00091 { 00092 public: 00093 IMPORT_C static CPtiUserDictionary* NewL(TInt aMaxSize); 00094 IMPORT_C static CPtiUserDictionary* NewL(TDesC& aFileName, TInt aMaxSize); 00095 IMPORT_C virtual ~CPtiUserDictionary(); 00096 00097 IMPORT_C virtual TInt OpenL(TDesC& aFileName, TInt aMaxSize); 00098 IMPORT_C virtual TInt WriteL(TDesC& aFileName); 00099 IMPORT_C virtual TInt WriteL(); 00100 inline void SetFileName(TDesC& aFileName); 00101 inline TInt Id() const; 00102 inline void SetId(TInt aId); 00103 inline TInt Size() const; 00104 inline TInt32 CoreUID() const; 00105 inline void SetCoreUID(TInt32 aUid); 00106 inline virtual TPtr8 Data(); 00107 inline TBool IsDefault() const; 00108 inline void SetDefault(TBool aValue); 00109 inline TPtrC FileName() const; 00110 inline TBool UpdateFlag() const; 00111 inline void SetUpdateFlag(TBool aFlag); 00112 inline TInt SymbolClass() const; 00113 inline void SetSymbolClass(TInt aSymbolClass); 00114 IMPORT_C virtual TInt SpaceLeft() const; 00115 IMPORT_C virtual void SetDataL(TAny* aData, TInt aLength); 00116 00117 protected: 00118 IMPORT_C CPtiUserDictionary(); 00119 00120 private: 00121 void ConstructL(TInt aMaxSize); 00122 void ConstructL(TDesC& aFileName, TInt aMaxSize); 00123 00124 protected: 00125 TFileName iFileName; 00126 HBufC8* iData; 00127 TInt iId; 00128 TInt32 iCoreUID; 00129 TBool iDefault; 00130 TBool iUpdateFlag; 00131 TInt iSymbolClass; 00132 TUint32 iChecksum; // Holds checksum of lastest version that was saved to disk. 00133 }; 00134 00135 #include "PtiUserDictionary.inl" 00136 00137 #endif 00138 00139 // End of file