当前位置: 首页 > news >正文

sunpinyin online的简单例子

#include <stdio.h>
#include <sunpinyin.h>class WinHandler : public CIMIWinHandler {void enableDeferedUpdate(CIMIView* view, int waitTime) {}void disableDeferedUpdate() {}void doneDeferedUpdate() {}/** commit a string, normally the converted result */void commit(const TWCHAR* wstr) {}/** when a key is not processed */void throwBackKey(unsigned keycode,unsigned keyvalue,unsigned modifier) {}/** Update window's preedit area. */void updatePreedit(const IPreeditString* ppd) {}/** Update window's candidates area. */void updateCandidates(const ICandidateList* pcl) {for (int i = 0; i < pcl->size(); i++) {const TWCHAR* p = pcl->candiString(i);char  s[64] = "";WCSTOMBS(s, p, sizeof(s));printf("%s\n", s);}}/** Update status area. */void updateStatus(int key, int value) {}
} windowHandler;int main () {CSunpinyinSessionFactory& fac = CSunpinyinSessionFactory::getFactory();fac.setPinyinScheme(CSunpinyinSessionFactory::QUANPIN);CIMIView* view = fac.createSession();view->getIC()->setCharsetLevel(3);view->attachWinHandler(&windowHandler);view->onKeyEvent(CKeyEvent('c', 'c', 0));return 0;
}

从fcitx-sunpinyin的源码里扒出来的。apt source fcitx-sunpinyin下载它的源码。

编译需要安装fcitx-libs-dev

835行。

 

http://www.jsqmd.com/news/26948/

相关文章:

  • 程序员修炼之道:从小工到专家
  • microsoft edge webview离线安装包
  • 概率递推1
  • Revit Api打印当前项目的所有的可打印视图
  • 实验课收获2025.10.30
  • DW1000芯片帧组成解析
  • revit api测量距离
  • 《程序员修炼之道》第一章有感
  • 10月30日日记
  • 代码大全2阅读笔记(3)
  • rustdesk 下载Windows版
  • apue笔记-进程环境、进程控制、进程关系
  • 数字识别(非汉字版)
  • Rust 解析验证码:结合 Tesseract OCR 进行文本识别
  • UML图以及设计模式部分总结
  • Consul访问宿主机api项目失败 - binzi
  • 读《代码大全2》第一章有感
  • 10.30博客
  • 251030
  • FOC学习
  • 软件技术第二次作业
  • 前端三剑客——javascript流程控制与异常处理
  • 《代码大全2》-观后感-一本可以陪伴整个职业生涯的“案头书”
  • Android Tor浏览器缩略图取证技术解析
  • 串口打印彩色log
  • 洛必达法则
  • 2025平航杯
  • 第七天第四天7.4
  • Linux提权基础
  • 第七周第三天7.3