~ubuntu-branches/ubuntu/raring/sunpinyin/raring

« back to all changes in this revision

Viewing changes to src/ime-core/imi_uiobjects.h

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.3) (1.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120330153155-qgls77sogzgtg9zp
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 
 * 
 
3
 *
4
4
 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
5
 
 * 
 
5
 *
6
6
 * The contents of this file are subject to the terms of either the GNU Lesser
7
7
 * General Public License Version 2.1 only ("LGPL") or the Common Development and
8
8
 * Distribution License ("CDDL")(collectively, the "License"). You may not use this
9
9
 * file except in compliance with the License. You can obtain a copy of the CDDL at
10
10
 * http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
11
 
 * http://www.opensource.org/licenses/lgpl-license.php. See the License for the 
 
11
 * http://www.opensource.org/licenses/lgpl-license.php. See the License for the
12
12
 * specific language governing permissions and limitations under the License. When
13
13
 * distributing the software, include this License Header Notice in each file and
14
14
 * include the full text of the License in the License file as well as the
15
15
 * following notice:
16
 
 * 
 
16
 *
17
17
 * NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
18
18
 * (CDDL)
19
19
 * For Covered Software in this distribution, this License shall be governed by the
21
21
 * Any litigation relating to this License shall be subject to the jurisdiction of
22
22
 * the Federal Courts of the Northern District of California and the state courts
23
23
 * of the State of California, with venue lying in Santa Clara County, California.
24
 
 * 
 
24
 *
25
25
 * Contributor(s):
26
 
 * 
 
26
 *
27
27
 * If you wish your version of this file to be governed by only the CDDL or only
28
28
 * the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
29
29
 * include this software in this distribution under the [CDDL or LGPL Version 2.1]
32
32
 * Version 2.1, or to extend the choice of license to its licensees as provided
33
33
 * above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
34
34
 * Version 2 license, then the option applies only if the new code is made subject
35
 
 * to such option by the copyright holder. 
 
35
 * to such option by the copyright holder.
36
36
 */
37
37
 
38
38
#ifndef SUNPINYIN_UI_OBJECTS_H
42
42
 
43
43
#include <vector>
44
44
#include <string>
 
45
#include <map>
45
46
 
46
47
#include "imi_context.h"
47
48
 
72
73
    typedef std::vector<int>    CCharTypeVec;
73
74
 
74
75
public:
75
 
    virtual
76
 
    ~IPreeditString()                                       = 0;
 
76
    virtual ~IPreeditString() = 0;
77
77
 
78
78
    /*@{*/
79
79
    /** Following functions are used for CIMIWinHandler to retrieve Preedit data. */
80
 
    virtual int                 size() const                        = 0;
81
 
    virtual const TWCHAR*       string() const                      = 0;
82
 
    virtual int                 charTypeSize() const                = 0;
83
 
    virtual int                 charTypeAt(int idx) const           = 0;
84
 
    virtual int                 caret() const                       = 0;
85
 
    virtual int                 candi_start() const                 = 0;
 
80
    virtual int                 size() const = 0;
 
81
    virtual const TWCHAR*       string() const = 0;
 
82
    virtual int                 charTypeSize() const = 0;
 
83
    virtual int                 charTypeAt(int idx) const = 0;
 
84
    virtual int                 caret() const = 0;
 
85
    virtual int                 candi_start() const = 0;
86
86
    /*@}*/
87
87
 
88
88
public:
89
89
    /*@{*/
90
90
    /**
91
 
    * Following functions are used for CIMIView to set Preedit data, should not
92
 
    * be used by CIMIWinHandler.
93
 
    */
94
 
    virtual void                clear()             = 0;
95
 
    virtual wstring&            getString()         = 0;
96
 
    virtual CCharTypeVec&       getCharTypeVec()    = 0;
 
91
     * Following functions are used for CIMIView to set Preedit data, should not
 
92
     * be used by CIMIWinHandler.
 
93
     */
 
94
    virtual void                clear() = 0;
 
95
    virtual wstring&            getString() = 0;
 
96
    virtual CCharTypeVec&       getCharTypeVec() = 0;
97
97
    virtual void                setCaret(int caret) = 0;
98
 
    virtual void                setCandiStart(int s)= 0;
 
98
    virtual void                setCandiStart(int s) = 0;
99
99
    /*@}*/
100
100
};
101
101
 
103
103
public:
104
104
    CPreEditString();
105
105
 
106
 
    virtual
107
 
    ~CPreEditString();
 
106
    virtual ~CPreEditString();
108
107
 
109
108
    /*@{*/
110
109
    virtual int                 size() const;
124
123
    /*@}*/
125
124
 
126
125
protected:
127
 
    wstring             m_wstr;
128
 
    int                 m_caret;
129
 
    int                 m_candi_start;
130
 
    CCharTypeVec        m_charTypes;
 
126
    wstring m_wstr;
 
127
    int m_caret;
 
128
    int m_candi_start;
 
129
    CCharTypeVec m_charTypes;
131
130
};
132
131
 
133
132
 
140
139
        BEST_WORD,
141
140
        USER_SELECTED_WORD,
142
141
        BEST_TAIL,
 
142
        PLUGIN_TAIL,
143
143
        OTHER_BEST_TAIL
144
144
    };
145
145
 
146
 
    typedef IPreeditString::CCharTypeVec        CCharTypeVec;
 
146
    typedef IPreeditString::CCharTypeVec CCharTypeVec;
147
147
    typedef std::vector< CCharTypeVec >         CCharTypeVecs;
148
148
    typedef std::vector< wstring >              CCandiStrings;
149
149
    typedef std::vector<int>                    CCandiTypeVec;
150
150
 
151
151
public:
152
 
    virtual
153
 
    ~ICandidateList()                                           = 0;
 
152
    virtual ~ICandidateList() = 0;
154
153
 
155
154
    /*@{*/
156
155
    /** Following functions are used for CIMIWinHandler to retrieve Candidate data. */
157
 
    virtual int                 size() const                            = 0;
158
 
    virtual int                 total() const                           = 0;
159
 
    virtual int                 first() const                           = 0;
160
 
 
161
 
    virtual int                 candiType(unsigned int item) const      = 0;
162
 
    virtual int                 candiSize(unsigned int item) const      = 0;
163
 
    virtual const TWCHAR*       candiString(unsigned int item) const    = 0;
164
 
 
165
 
    virtual int                 candiCharTypeSizeAt(unsigned int item) const                = 0;
166
 
    virtual int                 candiCharTypeAt(unsigned int item, unsigned int idx) const  = 0;
 
156
    virtual int                 size() const = 0;
 
157
    virtual int                 total() const = 0;
 
158
    virtual int                 first() const = 0;
 
159
 
 
160
    virtual int                 candiType(unsigned int item) const = 0;
 
161
    virtual int                 candiSize(unsigned int item) const = 0;
 
162
    virtual const TWCHAR*       candiString(unsigned int item) const = 0;
 
163
 
 
164
    virtual int                 candiCharTypeSizeAt(unsigned int item) const =
 
165
        0;
 
166
    virtual int                 candiCharTypeAt(unsigned int item,
 
167
                                                unsigned int idx) const = 0;
167
168
    /*@}*/
168
169
 
169
170
public:
170
171
    /*@{*/
171
172
    /**
172
 
    * Following functions are used for CIMIView to set Candidate List data, should not
173
 
    * be used by CIMIWinHandler.
174
 
    */
175
 
    virtual void                clear()                    = 0;
176
 
    virtual void                setTotal(int total)        = 0;
177
 
    virtual void                setFirst(int first)        = 0;
178
 
 
179
 
    virtual void                reserve(int count)         = 0;
180
 
    virtual CCandiStrings &     getCandiStrings()          = 0;
181
 
    virtual CCandiTypeVec &     getCandiTypeVec()          = 0;
182
 
    virtual CCharTypeVecs &     getCharTypeVecs()          = 0;
 
173
     * Following functions are used for CIMIView to set Candidate List data, should not
 
174
     * be used by CIMIWinHandler.
 
175
     */
 
176
    virtual void                clear() = 0;
 
177
    virtual void                setTotal(int total) = 0;
 
178
    virtual void                setFirst(int first) = 0;
 
179
    virtual void                setSize(int count) = 0;
 
180
 
 
181
    virtual void shrinkList() = 0;
 
182
    virtual void pushBackCandidate(wstring wstr, int type,
 
183
                                   int userIdx = -1) = 0;
 
184
    virtual void insertCandidate(wstring wstr, int type, int rank,
 
185
                                 int userIdx = -1) = 0;
 
186
    virtual void insertCandidateNoDedup(wstring wstr, int type, int rank,
 
187
                                        int userIdx = -1) = 0;
 
188
 
 
189
    virtual CCandiStrings &     getCandiStrings() = 0;
 
190
    virtual CCandiTypeVec &     getCandiTypeVec() = 0;
 
191
    virtual CCharTypeVecs &     getCharTypeVecs() = 0;
183
192
    /*@}*/
184
193
};
185
194
 
187
196
public:
188
197
    CCandidateList();
189
198
 
190
 
    virtual
191
 
    ~CCandidateList();
 
199
    virtual ~CCandidateList();
192
200
 
193
201
    /*@{*/
194
202
    virtual int                 size() const;
200
208
    virtual const TWCHAR*       candiString(unsigned int item) const;
201
209
 
202
210
    virtual int                 candiCharTypeSizeAt(unsigned int item) const;
203
 
    virtual int                 candiCharTypeAt(unsigned int item, unsigned int idx) const;
 
211
    virtual int                 candiCharTypeAt(unsigned int item,
 
212
                                                unsigned int idx) const;
204
213
    /*@}*/
205
214
 
206
215
    /*@{*/
207
216
    virtual void                clear();
208
217
    virtual void                setTotal(int total);
209
218
    virtual void                setFirst(int first);
210
 
    virtual void                reserve(int count);
 
219
    virtual void                setSize(int size);
 
220
 
 
221
    virtual void shrinkList();
 
222
    virtual void pushBackCandidate(wstring wstr, int type, int userIdx = -1);
 
223
    virtual void insertCandidate(wstring wstr, int type, int rank,
 
224
                                 int userIdx = -1);
 
225
    virtual void insertCandidateNoDedup(wstring wstr, int type, int rank,
 
226
                                        int userIdx = -1);
 
227
 
211
228
    virtual CCandiStrings &     getCandiStrings();
212
229
    virtual CCandiTypeVec &     getCandiTypeVec();
213
230
    virtual CCharTypeVecs &     getCharTypeVecs();
214
231
    /*@}*/
215
232
 
 
233
    int getUserIndex(int idx) { return m_candiUserIndex[idx]; }
 
234
 
216
235
protected:
217
 
    int                 m_total;
218
 
    int                 m_first;
219
 
    CCandiStrings       m_candiStrings;
220
 
    CCandiTypeVec       m_candiTypes;
221
 
    CCharTypeVecs       m_candiCharTypeVecs;
 
236
    int m_total;
 
237
    int m_first;
 
238
    int m_size;
 
239
    CCandiStrings m_candiStrings;
 
240
    CCandiTypeVec m_candiTypes;
 
241
    std::vector<int> m_candiUserIndex;
 
242
    CCharTypeVecs m_candiCharTypeVecs;
222
243
 
 
244
    std::map<wstring, int> m_candiStringsIndex;
223
245
};
224
246
 
225
247
#endif