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-2007 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 00030 class MPtiUserDictionary 00031 { 00032 public: 00039 virtual TInt Id() const = 0; 00040 00047 virtual TInt Size() const = 0; 00048 00055 virtual TInt32 CoreUID() const = 0; 00056 00064 virtual TBool IsDefault() const = 0; 00065 00072 virtual TPtrC FileName() const = 0; 00073 00082 virtual TInt SpaceLeft() const = 0; 00083 00091 virtual TBool UpdateFlag() const = 0; 00092 00100 virtual void SetUpdateFlag(TBool aFlag) = 0; 00101 }; 00102 00103 00104 class CPtiUserDictionary : public CBase, public MPtiUserDictionary 00105 { 00106 public: 00107 IMPORT_C static CPtiUserDictionary* NewL(TInt aMaxSize); 00108 IMPORT_C static CPtiUserDictionary* NewL(TDesC& aFileName, TInt aMaxSize); 00109 IMPORT_C virtual ~CPtiUserDictionary(); 00110 00111 IMPORT_C virtual TInt OpenL(TDesC& aFileName, TInt aMaxSize); 00112 IMPORT_C virtual TInt WriteL(TDesC& aFileName); 00113 IMPORT_C virtual TInt WriteL(); 00114 inline void SetFileName(TDesC& aFileName); 00115 inline TInt Id() const; 00116 inline void SetId(TInt aId); 00117 inline TInt Size() const; 00118 inline TInt32 CoreUID() const; 00119 inline void SetCoreUID(TInt32 aUid); 00120 inline virtual TPtr8 Data(); 00121 inline TBool IsDefault() const; 00122 inline void SetDefault(TBool aValue); 00123 inline TPtrC FileName() const; 00124 inline TBool UpdateFlag() const; 00125 inline void SetUpdateFlag(TBool aFlag); 00126 inline TInt SymbolClass() const; 00127 inline void SetSymbolClass(TInt aSymbolClass); 00128 IMPORT_C virtual TInt SpaceLeft() const; 00129 IMPORT_C virtual void SetDataL(TAny* aData, TInt aLength); 00130 00131 protected: 00132 IMPORT_C CPtiUserDictionary(); 00133 00134 private: 00135 void ConstructL(TInt aMaxSize); 00136 void ConstructL(TDesC& aFileName, TInt aMaxSize); 00137 00138 protected: 00139 TFileName iFileName; 00140 HBufC8* iData; 00141 TInt iId; 00142 TInt32 iCoreUID; 00143 TBool iDefault; 00144 TBool iUpdateFlag; 00145 TInt iSymbolClass; 00146 TUint32 iChecksum; // Holds checksum of lastest version that was saved to disk. 00147 }; 00148 00149 #include "PtiUserDictionary.inl" 00150 00151 #endif 00152 00153 // End of file