zoukankan      html  css  js  c++  java
  • Abiword中字符操作

    Abiword中字符操作

    一、关于不同字符的宏定义

    typedef gunichar        UT_UCS4Char;
    typedef guint16      UT_UCS2Char;
    typedef UT_UCS4Char  UT_UCSChar; /* Unicode */

    typedef guint32 gunichar;
    typedef guint16 gunichar2;

    AbiWord is now fully converted to using 32-bit Unicode internally

    在Abiword内部完全转换成32-bit Unicode 表示。

    二、针对UT_UCS*Char 的常用函数,参考:afutilxput_string.cpp

    UT_UCS4_strcmp 比较两个字符串

    UT_UCS4_strlen   取字符串的长度

    UT_UCS4_strcpy  复制字符串

    UT_UCS4_strcpy_char       从char到UT_UCS4Char的复制

    UT_UCS4_strcpy_to_char  从UT_UCS4Char到char的复制

    对UT_UCS2Char有对应的操作

    三、编码转换

    AP_Win32App::s_fromWinLocaleToUTF8,将本地编码转换成UTF-8

    AP_Win32App::s_fromUTF8ToWinLocale,将UTF-8转换成本地编码

    AP_Win32App::s_fromUCS4ToWinLocale

    AP_Win32App::s_fromWinLocaleToUCS4

    四、Abiword对字符类型的封装

    1、UT_String,UT_String, a simple wrapper for zero terminated 'char' strings.对char类型的封装。

    ////////////////////////////////////////////////////////////////////////
    //  8-bit string
    //  String is built of 8-bit units (bytes)
    //  Encoding could be any single-byte or multi-byte encoding
    ////////////////////////////////////////////////////////////////////////

    2、UT_UTF8String,UT_UTF8String, a simple wrapper for zero terminated 'UTF-8' strings.UTF-8编码的字符封装

    ////////////////////////////////////////////////////////////////////////
    //  UTF-8 string: encoding is *always* UTF-8
    ////////////////////////////////////////////////////////////////////////

    3、UT_UCS4String,UT_UCS4String, a simple wrapper for zero terminated 'UCS4' strings.USC4字符的封装

     ////////////////////////////////////////////////////////////////////////
    //  UCS-4 string
    //  String is built of 32-bit units (longs)
    //  NOTE: Ambiguity between UCS-2 and UTF-16 above makes no difference
    //  NOTE:  in the case of UCS-4 and UTF-32 since they really are
    //  NOTE:  identical
    ////////////////////////////////////////////////////////////////////////

     四、MSDN Generic-Text Mappings

           MSDN中"Generic-Text Routine Mappings."标题下有完整的宏列表。

  • 相关阅读:
    Windows Phone 7 立体旋转动画的实现
    jQuery 表格Table插件汇总
    SNS社交类网站照片头像裁剪源码
    VS无法启动调试
    SQL Server中获取第一天、最后一天
    jQuery技巧总结
    IT人士应当知道的10个行业小内幕
    巧用SQL server临时表
    将Html文档整理为规范XML文档
    16个Javascript的Web UI库、框架及工具包
  • 原文地址:https://www.cnblogs.com/songtzu/p/3539777.html
Copyright © 2011-2022 走看看