资源简介
这是安卓底层的谷歌拼音输入法源码,基于Qt5.4.2,win7平台。结合开发Qt5虚拟键盘插件使用。
代码片段和文件信息
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License Version 2.0 (the “License“);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include
#include
#include
#include
#include “dictbuilder.h“
#include “dicttrie.h“
#include “mystdlib.h“
#include “ngram.h“
#include “searchutility.h“
#include “spellingtable.h“
#include “spellingtrie.h“
#include “splparser.h“
#include “utf16reader.h“
namespace ime_pinyin {
#ifdef ___BUILD_MODEL___
static const size_t kReadBufLen = 512;
static const size_t kSplTableHashLen = 2000;
// Compare a SingleCharItem first by Hanzis then by spelling ids then by
// frequencies.
int cmp_scis_hz_splid_freq(const void* p1 const void* p2) {
const SingleCharItem *s1 *s2;
s1 = static_cast(p1);
s2 = static_cast(p2);
if (s1->hz < s2->hz)
return -1;
if (s1->hz > s2->hz)
return 1;
if (s1->splid.half_splid < s2->splid.half_splid)
return -1;
if (s1->splid.half_splid > s2->splid.half_splid)
return 1;
if (s1->splid.full_splid < s2->splid.full_splid)
return -1;
if (s1->splid.full_splid > s2->splid.full_splid)
return 1;
if (s1->freq > s2->freq)
return -1;
if (s1->freq < s2->freq)
return 1;
return 0;
}
int cmp_scis_hz_splid(const void* p1 const void* p2) {
const SingleCharItem *s1 *s2;
s1 = static_cast(p1);
s2 = static_cast(p2);
if (s1->hz < s2->hz)
return -1;
if (s1->hz > s2->hz)
return 1;
if (s1->splid.half_splid < s2->splid.half_splid)
return -1;
if (s1->splid.half_splid > s2->splid.half_splid)
return 1;
if (s1->splid.full_splid < s2->splid.full_splid)
return -1;
if (s1->splid.full_splid > s2->splid.full_splid)
return 1;
return 0;
}
int cmp_lemma_entry_hzs(const void* p1 const void* p2) {
size_t size1 = utf16_strlen(((const LemmaEntry*)p1)->hanzi_str);
size_t size2 = utf16_strlen(((const LemmaEntry*)p2)->hanzi_str);
if (size1 < size2)
return -1;
else if (size1 > size2)
return 1;
return utf16_strcmp(((const LemmaEntry*)p1)->hanzi_str
((const LemmaEntry*)p2)->hanzi_str);
}
int compare_char16(const void* p1 const void* p2) {
if (*((const char16*)p1) < *((const char16*)p2))
return -1;
if (*((const char16*)p1) > *((const char16*)p2))
return 1;
return 0;
}
int compare_py(const void* p1 const void* p2) {
int ret = utf16_strcmp(((const LemmaEntry*)p1)->sp
- 上一篇:电子图书馆网站设计 课程设计
- 下一篇:史上最详细最全面的uboot启动过程分析
相关资源
- 基于qt的音乐播放器源代码
- qt写的俄罗斯方块完整代码
- QT 串口温湿度控制系统
- 监护仪界面LINUX代码
- Win7-64-Qt5.6.1开发环境和安装
- 基于QT实现俄罗斯方块游戏。代码只有
- Qt5_音乐播放器源码
- 基于QT的KTV点歌系统毕业论文
- Qt5音乐播放器
- QT做 的简单登录界面
- 纯QML编写的俄罗斯方块小游戏(2.0版
- Qt俄罗斯方块简洁易懂
- Qt编写的MP3播放器
- qt人事数据库管理系统
- qt写的波形显示和分析控件
- 仿谷歌浏览器的TabWidget
- Qt实现GUI的二进制文件读写操作源码分
- Qt+SDL录音并实时放音
- Windows版Qt串口终端显示通信
- 媒体播放器qt实现
- PCL1.8.1+Qt5.9.4测试程序
- Linux下使用Qt+V4L2测试UVC相机
- QT读取数据并绘制曲线
- QShareMemory.zip
- esp32 qt 源码
- Qt之QWizard向导界面
- QT实现UDP通信
- Qt 之实现 QQ系统表情窗口
- 简易五子棋qt实现
- QT实现抗锯齿圆形头像
评论
共有 条评论