⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utfconverter.h

📁 这个是symbian下的一个蛮庞大的3D游戏源代码!对于学习3D开发的人有很大的帮助!
💻 H
字号:
#ifndef _LANG_UTFCONVERTER_H
#define _LANG_UTFCONVERTER_H


#include <lang/Converter.h>


namespace lang
{


/**
 * Unicode UTF-data encoding/decoding helper class.
 * Supported encoding schemes are ASCII-7, UTF-8, UTF-16BE,
 * UTF-16LE, UTF-32BE, UTF-32LE.
 *
 * 
 * @ingroup lang
 */
class UTFConverter :
	public Converter
{
public:
	/** Encoding/decoding scheme. */
	enum EncodingType
	{
		/** Unsupported/unknown encoding. */
		ENCODING_UNKNOWN,
		/** US/ASCII */
		ENCODING_ASCII7,
		/** UTF-8 */
		ENCODING_UTF8,
		/** UTF-16, platform endian */
		ENCODING_UTF16,
		/** UTF-16 Big Endian */
		ENCODING_UTF16BE,
		/** UTF-16 Little Endian */
		ENCODING_UTF16LE,
		/** UTF-32, platform endian */
		ENCODING_UTF32,
		/** UTF-32 Big Endian */
		ENCODING_UTF32BE,
		/** UTF-32 Little Endian */
		ENCODING_UTF32LE
	};
	
	/** 
	 * Creates an UTF-encoding converter with specified encoding.
	 */
	explicit UTFConverter( EncodingType encoding );

	/** 
	 * Decodes bytes to single Unicode code point. 
	 * Ignores invalid input byte sequences.
	 *
	 * @param src Ptr to the source data.
	 * @param srcend Ptr to the end of source data.
	 * @param srcbytes [out] Receives number of bytes decoded.
	 * @param dst [out] Receives decoded Unicode code point (if byte sequence was not malformed).
	 * @return false if decoded byte sequence was malformed.
	 */
	bool	decode( const void* src, const void* srcend, int* srcbytes, int* dst ) const;

	/** 
	 * Encodes single Unicode code point to bytes. 
	 *
	 * @param dst Destination buffer which receives encoded byte sequence.
	 * @param dstend End of the destination buffer.
	 * @param dstbytes [out] Receives number of bytes encoded.
	 * @param src Unicode code point to encode.
	 * @return false if the code point couldn't be encoded.
	 */
	bool	encode( void* dst, void* dstend, int* dstbytes, int src ) const;

private:
	EncodingType	m_type;
};


} // lang


#endif // _LANG_UTFCONVERTER_H


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -