williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2003-2007 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@4
|
5 |
* under the terms of "Eclipse Public License v1.0""
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.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: Predective text input engine user dictionary
|
williamr@2
|
15 |
* class definition.
|
williamr@2
|
16 |
*
|
williamr@2
|
17 |
*/
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
|
williamr@2
|
25 |
|
williamr@2
|
26 |
|
williamr@2
|
27 |
|
williamr@2
|
28 |
|
williamr@2
|
29 |
|
williamr@2
|
30 |
|
williamr@2
|
31 |
|
williamr@2
|
32 |
#ifndef _PTI_USER_DICTIONARY_H
|
williamr@2
|
33 |
#define _PTI_USER_DICTIONARY_H
|
williamr@2
|
34 |
|
williamr@2
|
35 |
// INCLUDES
|
williamr@2
|
36 |
#include <e32base.h>
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
* A base class for PtiEngine user dictionary implementations. Normally
|
williamr@2
|
40 |
* not needed by a client side application.
|
williamr@2
|
41 |
*/
|
williamr@2
|
42 |
class MPtiUserDictionary
|
williamr@2
|
43 |
{
|
williamr@2
|
44 |
public:
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* Returns user dictionary id value.
|
williamr@2
|
47 |
*
|
williamr@2
|
48 |
* @since S60 V2.6
|
williamr@2
|
49 |
* @return User dictionary id value.
|
williamr@2
|
50 |
*/
|
williamr@2
|
51 |
virtual TInt Id() const = 0;
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
* Returns size of user dictionary.
|
williamr@2
|
55 |
*
|
williamr@2
|
56 |
* @since S60 V2.6
|
williamr@2
|
57 |
* @return Size of user dictionary.
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
virtual TInt Size() const = 0;
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
* Returns Uid for core DLL.
|
williamr@2
|
63 |
*
|
williamr@2
|
64 |
* @since S60 V2.6
|
williamr@2
|
65 |
* @return Uid value for core DLL.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
virtual TInt32 CoreUID() const = 0;
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* Returns a boolean value indicating whether this is the default user dictionary.
|
williamr@2
|
71 |
*
|
williamr@2
|
72 |
* @since S60 V2.6
|
williamr@2
|
73 |
* @return ETrue if this user dictionary is default user dictionary.
|
williamr@2
|
74 |
* EFalse if not.
|
williamr@2
|
75 |
*/
|
williamr@2
|
76 |
virtual TBool IsDefault() const = 0;
|
williamr@2
|
77 |
|
williamr@2
|
78 |
/**
|
williamr@2
|
79 |
* Reuturns user dictionary file name.
|
williamr@2
|
80 |
*
|
williamr@2
|
81 |
* @since S60 V2.6
|
williamr@2
|
82 |
* @return User dictionary file name.
|
williamr@2
|
83 |
*/
|
williamr@2
|
84 |
virtual TPtrC FileName() const = 0;
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/**
|
williamr@2
|
87 |
* Returns the amount of free space in user dictionary.
|
williamr@2
|
88 |
*
|
williamr@2
|
89 |
* @since S60 V2.6
|
williamr@2
|
90 |
* @return The Amount of free space in dictionary.
|
williamr@2
|
91 |
* Negative value if the amount of free space
|
williamr@2
|
92 |
* value couldn't be found out.
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
virtual TInt SpaceLeft() const = 0;
|
williamr@2
|
95 |
|
williamr@2
|
96 |
/**
|
williamr@2
|
97 |
* If this flag is set, PtiEngine framework calls
|
williamr@2
|
98 |
* WriteL before exiting.
|
williamr@2
|
99 |
*
|
williamr@2
|
100 |
* @since S60 V2.6
|
williamr@2
|
101 |
* @return A boolean valua indicating status of the update flag.
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
virtual TBool UpdateFlag() const = 0;
|
williamr@2
|
104 |
|
williamr@2
|
105 |
/**
|
williamr@2
|
106 |
* Set update flag to given value. If update flag is set, PtiEngine tries
|
williamr@2
|
107 |
* to save user dictionary when PtiEngine destructor is called.
|
williamr@2
|
108 |
*
|
williamr@2
|
109 |
* @since S60 V2.6
|
williamr@2
|
110 |
* @param aFlag New status for the update flag.
|
williamr@2
|
111 |
*/
|
williamr@2
|
112 |
virtual void SetUpdateFlag(TBool aFlag) = 0;
|
williamr@2
|
113 |
};
|
williamr@2
|
114 |
|
williamr@2
|
115 |
|
williamr@2
|
116 |
class CPtiUserDictionary : public CBase, public MPtiUserDictionary
|
williamr@2
|
117 |
{
|
williamr@2
|
118 |
public:
|
williamr@2
|
119 |
IMPORT_C static CPtiUserDictionary* NewL(TInt aMaxSize);
|
williamr@2
|
120 |
IMPORT_C static CPtiUserDictionary* NewL(TDesC& aFileName, TInt aMaxSize);
|
williamr@2
|
121 |
IMPORT_C virtual ~CPtiUserDictionary();
|
williamr@2
|
122 |
|
williamr@2
|
123 |
IMPORT_C virtual TInt OpenL(TDesC& aFileName, TInt aMaxSize);
|
williamr@2
|
124 |
IMPORT_C virtual TInt WriteL(TDesC& aFileName);
|
williamr@2
|
125 |
IMPORT_C virtual TInt WriteL();
|
williamr@2
|
126 |
inline void SetFileName(TDesC& aFileName);
|
williamr@2
|
127 |
inline TInt Id() const;
|
williamr@2
|
128 |
inline void SetId(TInt aId);
|
williamr@2
|
129 |
inline TInt Size() const;
|
williamr@2
|
130 |
inline TInt32 CoreUID() const;
|
williamr@2
|
131 |
inline void SetCoreUID(TInt32 aUid);
|
williamr@2
|
132 |
inline virtual TPtr8 Data();
|
williamr@2
|
133 |
inline TBool IsDefault() const;
|
williamr@2
|
134 |
inline void SetDefault(TBool aValue);
|
williamr@2
|
135 |
inline TPtrC FileName() const;
|
williamr@2
|
136 |
inline TBool UpdateFlag() const;
|
williamr@2
|
137 |
inline void SetUpdateFlag(TBool aFlag);
|
williamr@2
|
138 |
inline TInt SymbolClass() const;
|
williamr@2
|
139 |
inline void SetSymbolClass(TInt aSymbolClass);
|
williamr@2
|
140 |
IMPORT_C virtual TInt SpaceLeft() const;
|
williamr@2
|
141 |
IMPORT_C virtual void SetDataL(TAny* aData, TInt aLength);
|
williamr@2
|
142 |
|
williamr@2
|
143 |
protected:
|
williamr@2
|
144 |
IMPORT_C CPtiUserDictionary();
|
williamr@2
|
145 |
|
williamr@2
|
146 |
private:
|
williamr@2
|
147 |
void ConstructL(TInt aMaxSize);
|
williamr@2
|
148 |
void ConstructL(TDesC& aFileName, TInt aMaxSize);
|
williamr@2
|
149 |
|
williamr@2
|
150 |
protected:
|
williamr@2
|
151 |
TFileName iFileName;
|
williamr@2
|
152 |
HBufC8* iData;
|
williamr@2
|
153 |
TInt iId;
|
williamr@2
|
154 |
TInt32 iCoreUID;
|
williamr@2
|
155 |
TBool iDefault;
|
williamr@2
|
156 |
TBool iUpdateFlag;
|
williamr@2
|
157 |
TInt iSymbolClass;
|
williamr@2
|
158 |
TUint32 iChecksum; // Holds checksum of lastest version that was saved to disk.
|
williamr@2
|
159 |
};
|
williamr@2
|
160 |
|
williamr@2
|
161 |
#include "PtiUserDictionary.inl"
|
williamr@2
|
162 |
|
williamr@2
|
163 |
#endif
|
williamr@2
|
164 |
|
williamr@2
|
165 |
// End of file
|