2 * Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0""
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Predective text input engine user dictionary
32 #ifndef _PTI_USER_DICTIONARY_H
33 #define _PTI_USER_DICTIONARY_H
39 * A base class for PtiEngine user dictionary implementations. Normally
40 * not needed by a client side application.
42 class MPtiUserDictionary
46 * Returns user dictionary id value.
49 * @return User dictionary id value.
51 virtual TInt Id() const = 0;
54 * Returns size of user dictionary.
57 * @return Size of user dictionary.
59 virtual TInt Size() const = 0;
62 * Returns Uid for core DLL.
65 * @return Uid value for core DLL.
67 virtual TInt32 CoreUID() const = 0;
70 * Returns a boolean value indicating whether this is the default user dictionary.
73 * @return ETrue if this user dictionary is default user dictionary.
76 virtual TBool IsDefault() const = 0;
79 * Reuturns user dictionary file name.
82 * @return User dictionary file name.
84 virtual TPtrC FileName() const = 0;
87 * Returns the amount of free space in user dictionary.
90 * @return The Amount of free space in dictionary.
91 * Negative value if the amount of free space
92 * value couldn't be found out.
94 virtual TInt SpaceLeft() const = 0;
97 * If this flag is set, PtiEngine framework calls
98 * WriteL before exiting.
101 * @return A boolean valua indicating status of the update flag.
103 virtual TBool UpdateFlag() const = 0;
106 * Set update flag to given value. If update flag is set, PtiEngine tries
107 * to save user dictionary when PtiEngine destructor is called.
110 * @param aFlag New status for the update flag.
112 virtual void SetUpdateFlag(TBool aFlag) = 0;
116 class CPtiUserDictionary : public CBase, public MPtiUserDictionary
119 IMPORT_C static CPtiUserDictionary* NewL(TInt aMaxSize);
120 IMPORT_C static CPtiUserDictionary* NewL(TDesC& aFileName, TInt aMaxSize);
121 IMPORT_C virtual ~CPtiUserDictionary();
123 IMPORT_C virtual TInt OpenL(TDesC& aFileName, TInt aMaxSize);
124 IMPORT_C virtual TInt WriteL(TDesC& aFileName);
125 IMPORT_C virtual TInt WriteL();
126 inline void SetFileName(TDesC& aFileName);
127 inline TInt Id() const;
128 inline void SetId(TInt aId);
129 inline TInt Size() const;
130 inline TInt32 CoreUID() const;
131 inline void SetCoreUID(TInt32 aUid);
132 inline virtual TPtr8 Data();
133 inline TBool IsDefault() const;
134 inline void SetDefault(TBool aValue);
135 inline TPtrC FileName() const;
136 inline TBool UpdateFlag() const;
137 inline void SetUpdateFlag(TBool aFlag);
138 inline TInt SymbolClass() const;
139 inline void SetSymbolClass(TInt aSymbolClass);
140 IMPORT_C virtual TInt SpaceLeft() const;
141 IMPORT_C virtual void SetDataL(TAny* aData, TInt aLength);
144 IMPORT_C CPtiUserDictionary();
147 void ConstructL(TInt aMaxSize);
148 void ConstructL(TDesC& aFileName, TInt aMaxSize);
158 TUint32 iChecksum; // Holds checksum of lastest version that was saved to disk.
161 #include "PtiUserDictionary.inl"