cocos2d-x节点(ccUTF8.h)API
来源:互联网 发布:mac svn客户端使用教程 编辑:程序博客网 时间:2024/05/18 02:48
本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-x节点(ccUTF8.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
UTF-16 转换为 UTF-8,统计写入/读取的字节数
///cocos2d-x-3.0alpha0/cocos2dx/support//UTF-16 转换为 UTF-8,统计 写入/读取 的字节数//// ccUTF8.h// cocos2dx//// Created by James Chen on 2/27/13.//#ifndef __cocos2dx__ccUTF8__#define __cocos2dx__ccUTF8__#include "platform/CCPlatformMacros.h"#include <vector>NS_CC_BEGINCC_DLL int cc_wcslen(const unsigned short* str);CC_DLL void cc_utf8_trim_ws(std::vector<unsigned short>* str);/** * 该字符是否是空白字符。 * * @param ch Unicode字符 * @returns 该字符是否是空白字符 * * @see http://en.wikipedia.org/wiki/Whitespace_character#Unicode * */CC_DLL bool isspace_unicode(unsigned short ch);/** * Returns 字符中的字符串的长度。 * * @param p 指向一个UTF-8编码字符串的开始 * @param max 检查字节的最大数量。如果\ P max是小于0,则该字符串被假定为null结尾的。如果最大的\ p为0,\ PP不会被检查,我的是%NULL。 * * @returns the length of the string in characters **/CC_DLL longcc_utf8_strlen (const char * p, int max);/** * 寻找不等于给定的字符的最后一个字符。 * * @param str the string to be searched. * @param c 要搜索的字符. * * @returns the index of the last character that is not \p c. //index最后一个字符不是 \p c * */CC_DLL unsigned int cc_utf8_find_last_not_char(std::vector<unsigned short> str, unsigned short c);CC_DLL std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* str);/** * Creates a utf8 string from a cstring. * * @param str_old pointer to the start of a C string. * * @returns the newly created utf8 string. * */CC_DLL unsigned short* cc_utf8_to_utf16(const char* str_old, int length = -1, int* rUtf16Size = NULL);/** * Convert a string from UTF-16 to UTF-8. The result will be null terminated. * * @param str a UTF-16 encoded string * @param len the maximum length of \p str to use. If \p len < 0, then the * string is null terminated. * @param items_read 读取到的本地存储的单词数,如果%NULL,那么%G_CONVERT_ERROR_PARTIAL_INPUT 将返回一个包含 \p str 的结尾字符,如果发生一个错误,无效的输入 index 储存在这里 * @param items_written 写入到本地的 byte数,or %NULL. * 这里存储的值不包括结尾的 null. * * @returns 个新分配的UTF-8字符串指针。这个值必须是 *用free()释放。如果发生错误,%将返回NULL。 **/CC_DLL char *cc_utf16_to_utf8 (const unsigned short *str, long len, long *items_read, long *items_written);NS_CC_END#endif /* defined(__cocos2dx__ccUTF8__) */
- cocos2d-x节点(ccUTF8.h)API
- cocos2d-x节点(cocos2d.h)API
- cocos2d-X 节点(CCNode.h)API
- cocos2d-X 节点(CCLayer.h)API
- cocos2d-X 节点(CCMenu.h)API
- cocos2d-X 节点(CCMenuItem.h)API
- cocos2d-X 节点(CCSprite.h)API
- cocos2d-X 节点(CCTexture2D.h)API
- cocos2d-X 节点(SpriteBatchNode.h.)API
- cocos2d-X 节点(CCSpriteFrame.h..)API
- cocos2d-X 节点(CCAnimationCache.h)API
- cocos2d-X 节点(CCCamera.h.)API
- cocos2d-X 节点(CCAction.h)API
- cocos2d-X 节点(CCActionManager.h)API
- cocos2d-X 节点(CCIMEDelegate.h)API
- cocos2d-X 节点(CCLabelAtlas.h)API
- cocos2d-X 节点(CCLabelBMFont.h)API
- cocos2d-X 节点(CCLabelTTF.h)API
- 【iOS 7】使用UIScreenEdgePanGestureRecognizer实现swipe to pop效果
- C++ 实现 算数表达式求值
- cocos2d-x节点(TransformUtils.h)API
- cocos2d-x节点(CCVertex.h)API
- cocos2d-x节点(ccUtils.h)API
- cocos2d-x节点(ccUTF8.h)API
- IDA 字符串解密脚本
- hdu 4771 Stealing Harry Potter's Precious
- UVa 10812 Beat the Spread! (陷阱)
- cocos2d-x节点(CCProfiling.h)API
- cocos2d-x节点(CCNotificationCenter.h)API
- shiro入门实例
- 总结C#保留小数位数
- C++的const引用