亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? scim_pinyin.h

?? 嵌入式Linux上的拼音輸入法
?? H
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
 * between two pinyin keys.
 */
class PinyinKeyExactLessThan
	: public std::binary_function <PinyinKey, PinyinKey, bool>
{
public:
	bool operator () (PinyinKey lhs,
					  PinyinKey rhs) const {
		if (lhs.m_initial < rhs.m_initial)
			return true;
		else if (lhs.m_initial == rhs.m_initial) {
			if (lhs.m_final < rhs.m_final)
				return true;
			else if	(lhs.m_final == rhs.m_final &&
					 lhs.m_tone < rhs.m_tone)
				return true;
		}
		return false;
	}
};

/**
 * a binary functional class to do bitwise equal to comparison
 * between two pinyin keys.
 */
class PinyinKeyExactEqualTo
	: public std::binary_function <PinyinKey, PinyinKey, bool>
{
public:
	bool operator () (PinyinKey lhs,
					  PinyinKey rhs) const {
		if (lhs.m_initial == rhs.m_initial &&
			lhs.m_final == rhs.m_final &&
			lhs.m_tone == rhs.m_tone)
			return true;
		return false;
	}
};

/**
 * this class is for storing a key which is parsed from a string.
 */
struct PinyinParsedKey : public PinyinKey
{
	int m_pos;		/**< the position of this key in the whole string. */
	int m_length;	/**< the length of string used by this key. */

public:
	/**
	 * constructor
	 */
	PinyinParsedKey (int pos = 0,
					 int length = 0,
					 PinyinInitial initial = SCIM_PINYIN_ZeroInitial,
					 PinyinFinal final = SCIM_PINYIN_ZeroFinal,
					 PinyinTone tone = SCIM_PINYIN_ZeroTone)
		: PinyinKey (initial, final, tone), m_pos (pos), m_length (length) { }

	/**
	 * get the key's position in the whole string.
	 */
	int get_pos () const { return m_pos; }

	/**
	 * get length of the key string.
	 */
	int get_length () const { return m_length; }

	/**
	 * get the key's end position in the whole string.
	 */
	int get_end_pos () const { return m_pos + m_length; }
	
	/**
	 * set the key's position.
	 */
	void set_pos (int pos) { m_pos = pos; }

	/**
	 * set the key's length.
	 */
	void set_length (int length) { m_length = length; }
};

class CharFrequencyPairLessThanByChar {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs.first < rhs.first;
	}
	bool operator () (const CharFrequencyPair &lhs,
					  ucs4_t rhs) const {
		return lhs.first < rhs;
	}
	bool operator () (ucs4_t lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs < rhs.first;
	}
};

class CharFrequencyPairGreaterThanByChar {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs.first > rhs.first;
	}
	bool operator () (const CharFrequencyPair &lhs,
					  ucs4_t rhs) const {
		return lhs.first > rhs;
	}
	bool operator () (ucs4_t lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs > rhs.first;
	}
};

class CharFrequencyPairLessThanByFrequency {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs.second < rhs.second;
	}
	bool operator () (const CharFrequencyPair &lhs,
					  uint32 rhs) const {
		return lhs.second < rhs;
	}
	bool operator () (uint32 lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs < rhs.second;
	}
};

class CharFrequencyPairGreaterThanByFrequency {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs.second > rhs.second;
	}
	bool operator () (const CharFrequencyPair &lhs,
					  uint32 rhs) const {
		return lhs.second > rhs;
	}
	bool operator () (uint32 lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs > rhs.second;
	}
};

class CharFrequencyPairLessThanByCharAndFrequency {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		if (lhs.first < rhs.first) return true;
		if (lhs.first > rhs.first) return false;
		return lhs.second < rhs.second;
	}
};

class CharFrequencyPairGreaterThanByCharAndFrequency {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		if (lhs.first > rhs.first) return true;
		if (lhs.first < rhs.first) return false;
		return lhs.second > rhs.second;
	}
};

class CharFrequencyPairEqualToByChar {
public:
	bool operator () (const CharFrequencyPair &lhs,
					  const CharFrequencyPair &rhs) const {
		return lhs.first == rhs.first;
	}
};

/**
 * A PinyinEntry has a pinyin key and a set of ucs4_t,
 * whose pronouncation are same as the key.
 */
class PinyinEntry
{
	PinyinKey m_key;
		/**< the pinyin key of this entry */

	std::vector <CharFrequencyPair> m_chars;
		/**< the vector to store the chars and their frequencies */

public:
	/**
	 * constructor
	 */
	PinyinEntry (PinyinKey key)
		: m_key (key) {}

	/**
	 * copy constructor
	 */
	PinyinEntry (const PinyinEntry &entry)
		: m_key (entry.m_key), m_chars (entry.m_chars) {}

	/**
	 * constructor.
	 * read this entry from a stream.
	 */
	PinyinEntry (const PinyinValidator &validator,
				 std::istream &is
		     /*bool binary = false*/) {
		/*if (binary) input_binary (validator, is);
		  else*/ input_text (validator, is);
	}

	/**
	 * copy operator.
	 */
	const PinyinEntry& operator = (const PinyinEntry &entry) {
		if (this != &entry) {
			m_key = entry.m_key;
			m_chars = entry.m_chars;
		}
		return *this;
	}

	/**
	 * set pinyin key of this entry.
	 */
	void set_key (PinyinKey key) {
		m_key = key;
	}

	/**
	 * get the pinyin key of this entry.
	 */
	PinyinKey get_key () const {
		return m_key;
	}

	/**
	 * check if this entry has the char.
	 */
	bool has_char (ucs4_t c) const {
		return std::binary_search (
						m_chars.begin (),
						m_chars.end (),
						c,
						CharFrequencyPairLessThanByChar ());
	}

	/**
	 * sort all chars. 
	 */
	void sort () {
		std::sort (m_chars.begin(), m_chars.end());
	}

	/**
	 * clear this entry.
	 */
	void clear () {
		std::vector <CharFrequencyPair> ().swap (m_chars);
	}

	/**
	 * return entry size (number of chars).
	 */
	size_t size () const {
		return m_chars.size();
	}

	/**
	 * insert a char into this entry.
	 */
	void insert (const CharFrequencyPair &ch) {
		std::vector<CharFrequencyPair>::iterator i =
			std::lower_bound (
						m_chars.begin (),
						m_chars.end (),
						ch.first,
						CharFrequencyPairLessThanByChar ());

		if (i != m_chars.end () && i->first == ch.first) {
				if (ch.second > i->second)
					i->second = ch.second;
		} else {
			m_chars.insert (i, ch);
		}
	}

	/**
	 * erase a char from this entry.
	 */
	void erase (ucs4_t c) {
		std::vector<CharFrequencyPair>::iterator i =
			std::lower_bound (
						m_chars.begin (),
						m_chars.end (),
						c,
						CharFrequencyPairLessThanByChar ());

		if (i != m_chars.end() && i->first == c) m_chars.erase (i);
	}

	/**
	 * get the char at position index.
	 */
	ucs4_t get_char_by_index (unsigned int index) const {
		return m_chars [index].first;
	}

	/**
	 * get the char with its frequency.
	 */
	const CharFrequencyPair & get_char_with_frequency_by_index (unsigned int index) const {
		return m_chars [index];
	}

	int get_all_chars (std::vector<ucs4_t> &vec) const {
		for (std::vector<CharFrequencyPair>::const_iterator i = m_chars.begin ();
				i != m_chars.end (); ++ i)
			vec.push_back (i->first);
		return vec.size ();
	}

	int get_all_chars_with_frequencies (std::vector<CharFrequencyPair> &vec) const {
		for (std::vector<CharFrequencyPair>::const_iterator i = m_chars.begin ();
				i != m_chars.end (); ++ i)
			vec.push_back (*i);
		return vec.size ();
	}

	uint32 get_char_frequency (ucs4_t ch) const {
		std::vector<CharFrequencyPair>::const_iterator i =
			std::lower_bound (
						m_chars.begin (),
						m_chars.end (),
						ch,
						CharFrequencyPairLessThanByChar ());

		if (i != m_chars.end() && i->first == ch)
			return i->second;

		return 0;
	}

	void set_char_frequency (ucs4_t ch, uint32 freq) {
		std::vector<CharFrequencyPair>::iterator i =
			std::lower_bound (
						m_chars.begin (),
						m_chars.end (),
						ch,
						CharFrequencyPairLessThanByChar ());

		if (i != m_chars.end() && i->first == ch)
			i->second = freq;
	}

	void refresh_char_frequency (ucs4_t ch, uint32 shift) {
		std::vector<CharFrequencyPair>::iterator i =
			std::lower_bound (
						m_chars.begin (),
						m_chars.end (),
						ch,
						CharFrequencyPairLessThanByChar ());

		if (i != m_chars.end() && i->first == ch) {
			uint32 delta = (SCIM_MAX_CHAR_FREQUENCY - i->second);
			if (delta) {
				delta >>= shift;
				if (!delta) ++ delta;
				i->second = i->second + delta;
			}
		}
	}

	/**
	 * @sa get_key
	 */
	operator PinyinKey () const {
		return m_key;
	}

	/**
	 * output the content of this entry to ostream in text format.
	 */
	std::ostream& output_text (std::ostream &os) const;

	/**
	 * read the content of this entry from istream in text format.
	 */
	std::istream& input_text (const PinyinValidator &validator, std::istream &is);
	
	/**
	 * output in binary format.
	std::ostream& output_binary (std::ostream &os) const;
	 */

	/**
	 * input in binary format.
	std::istream& input_binary (const PinyinValidator &validator, std::istream &is);
	 */
};

/**
 * a table to store all of the Hanzi characters and its pinyin keys.
 */
class PinyinTable
{
	/*
#if defined (HAVE_HASH_MAP)
	typedef std::hash_multimap<ucs4_t,PinyinKey, std::hash <unsigned long> > ReversePinyinMap;
#elif defined (HAVE_EXT_HASH_MAP)
	typedef __gnu_cxx::hash_multimap<ucs4_t,PinyinKey, __gnu_cxx::hash <unsigned long> > ReversePinyinMap;
#else
	typedef std::multimap<ucs4_t, PinyinKey> ReversePinyinMap;
#endif

	typedef std::pair<ucs4_t,PinyinKey> ReversePinyinPair;
	*/
	typedef std::vector<PinyinEntry> PinyinEntryVector;

	/**
	 * the vector to store all of the pinyin entries.
	 */
	PinyinEntryVector m_table;

	/**
	 * the multimap to store reverse pinyin map.
	 *
	 * The reverse pinyin map is used to do Hanzi -> Pinyin mapping.
	ReversePinyinMap m_revmap;
	 */

	/**
	 * indicates that if the reverse map is OK.
	bool m_revmap_ok;
	 */

	/**
	 * less than function object of PinyinKey.
	 */
	PinyinKeyExactLessThan m_pinyin_key_less;

	/**
	 * equal to function object of PinyinKey.
	 */
	PinyinKeyExactEqualTo m_pinyin_key_equal;

	/**
	 * the validator to valdiate all of the pinyin keys.
	 */
	const PinyinValidator *m_validator;

public:
	/**
	 * constructor.
	 *
	 * @param custom the custom settings to construct less than and equal to 
	 *               function object of PinyinKey.
	 * @param validator the validator to validate all of the pinyin keys.
	 * @param tablefile the file name of pinyin table.
	 */
	PinyinTable (/*const PinyinCustomSettings &custom,*/
				 const PinyinValidator *validator,
				 const char *tablefile = NULL);

	PinyinTable (/*const PinyinCustomSettings &custom,*/
				 const PinyinValidator *validator,
				 std::istream &is);

	bool output (std::ostream &os, bool binary = false) const;
	bool input (std::istream &is);

	bool load_table (const char *tablefile);
	bool save_table (const char *tablefile, bool binary = false) const;
	/*
	void update_custom_settings (const PinyinCustomSettings &custom,
								 const PinyinValidator *validator);

	int get_all_chars (std::vector<ucs4_t> &vec) const;
	int get_all_chars_with_frequencies (std::vector<CharFrequencyPair> &vec) const;
	*/
	int find_chars (std::vector<ucs4_t> &vec, PinyinKey key) const;
	int find_chars_with_frequencies (std::vector<CharFrequencyPair> &vec, PinyinKey key) const;

	int find_keys (PinyinKeyVector &vec, ucs4_t code);

	int find_key_strings (std::vector<PinyinKeyVector> &vec, const WideString & str);

	void erase (ucs4_t hz, const char *key);
	void erase (ucs4_t hz, PinyinKey key);

	uint32 get_char_frequency (ucs4_t ch, PinyinKey key = PinyinKey ());

	void set_char_frequency (ucs4_t ch, uint32 freq, PinyinKey key = PinyinKey ());

	/**
	 * grow the char frequency by 1/(2^shift).
	 */
	void refresh (ucs4_t hz, uint32 shift = 31, PinyinKey key = PinyinKey ());

	void insert (ucs4_t hz, const char *key);
	void insert (ucs4_t hz, PinyinKey key);

	size_t size () const;

	size_t number_of_entry () const { return m_table.size (); }

	// clear this table
	void clear () {
		m_table.clear ();
		//		m_revmap.clear ();
		//m_revmap_ok = false;
	}

	bool has_key (const char *key) const;
	bool has_key (PinyinKey key) const;

private:
	/**
	 * sort all pinyin entries.
	 */
	void sort ();

	//	void create_reverse_map ();

	//void insert_to_reverse_map (ucs4_t code, PinyinKey key);
	//void erase_from_reverse_map (ucs4_t code, PinyinKey key);

	PinyinEntryVector::iterator find_exact_entry (PinyinKey key);

	void create_pinyin_key_vector_vector (std::vector<PinyinKeyVector> &vv,
										  PinyinKeyVector &key_buffer,
										  PinyinKeyVector *key_vectors,
										  int index,
										  int len);
};

inline std::ostream&
operator << (std::ostream& os, PinyinKey key)
{
	return key.output_text (os);
}

inline std::ostream&
operator << (std::ostream& os, const PinyinEntry &entry)
{
	return entry.output_text (os);
}

/**
 * @brief Write a wide char to ostream.
 *
 * The content written into the ostream will be converted into utf-8 encoding.
 *
 * @param os the stream to be written.
 * @param wc the wide char to be written to the stream.
 * @return the same stream object reference.
 */
std::ostream & utf8_write_wchar (std::ostream &os, ucs4_t wc);


#endif

/*
vi:ts=4:nowrap:ai
*/

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区调教| 欧美成人性战久久| 亚洲色图.com| 99久久99久久精品免费观看| 国产三级欧美三级日产三级99| 九九**精品视频免费播放| 欧美va亚洲va在线观看蝴蝶网| 久久国产精品99久久久久久老狼 | 成人污污视频在线观看| 国产欧美va欧美不卡在线| 成人中文字幕电影| 亚洲男女一区二区三区| 欧美日韩性生活| 免费观看日韩av| 久久久久久日产精品| 99精品久久久久久| 偷拍一区二区三区| 国产精品伦理一区二区| 色婷婷久久久亚洲一区二区三区| 午夜欧美视频在线观看| 26uuu精品一区二区三区四区在线| 国产成人午夜99999| 一区二区三区四区在线免费观看| 日韩一级片在线播放| 国产不卡视频在线播放| 亚洲免费观看高清完整版在线 | 不卡的av电影在线观看| 一区二区三区在线视频观看58| 日韩一级片在线观看| 成人一区在线观看| 午夜成人免费视频| 国产日韩精品久久久| 在线这里只有精品| 精品一区二区三区免费观看| 亚洲女性喷水在线观看一区| 日韩欧美在线1卡| 一本久久综合亚洲鲁鲁五月天 | 久久久久久麻豆| 在线免费观看视频一区| 狠狠久久亚洲欧美| 性欧美疯狂xxxxbbbb| 国产精品毛片久久久久久| 欧美一区二区三区公司| 91亚洲精品久久久蜜桃网站| 久久国产生活片100| 亚洲精品午夜久久久| 久久久久久久久久久黄色| 欧美日韩中文字幕一区| 成人国产精品免费观看视频| 精品在线一区二区三区| 午夜激情综合网| 一区2区3区在线看| 国产精品区一区二区三| 久久综合国产精品| 欧美理论片在线| 91九色02白丝porn| 成人国产精品免费网站| 韩日欧美一区二区三区| 日本成人在线视频网站| 亚洲精品你懂的| 成人免费视频在线观看| 国产午夜精品在线观看| 精品国产欧美一区二区| 日韩欧美国产一区在线观看| 欧美久久久久久久久中文字幕| 91精彩视频在线| 色综合久久中文字幕综合网 | 一区二区成人在线| 国产精品每日更新在线播放网址| 国产亚洲一区字幕| 精品久久久久久久久久久久久久久久久| 欧美亚洲国产一区二区三区va | 色乱码一区二区三区88| eeuss鲁片一区二区三区在线观看| 国产成人综合在线| 国产精品自拍av| 国产精品一区二区久久精品爱涩| 欧美视频一区二区在线观看| 欧美日韩午夜精品| 欧美三级电影网站| 欧美日韩激情一区二区| 欧美精品自拍偷拍| 欧美日韩一二三| 91精品国产品国语在线不卡| 欧美一区二区三区啪啪| 91麻豆精品国产91久久久使用方法| 91精品在线免费| 欧美不卡一区二区三区四区| 2020国产精品久久精品美国| 国产午夜亚洲精品理论片色戒| 欧美国产综合色视频| 国产精品色一区二区三区| 国产精品超碰97尤物18| 亚洲三级小视频| 亚洲超碰精品一区二区| 秋霞午夜鲁丝一区二区老狼| 国产资源精品在线观看| 高清国产午夜精品久久久久久| 波多野结衣亚洲| 91福利精品视频| 91精品国产91久久久久久一区二区 | 婷婷综合久久一区二区三区| 日韩av一级片| 精品亚洲国产成人av制服丝袜| 国产精品99久| 欧美亚洲一区二区在线| 欧美一级高清大全免费观看| 久久精品视频免费观看| 一区二区三区产品免费精品久久75| 亚洲成人一二三| 国产美女一区二区| 在线免费观看成人短视频| 日韩午夜三级在线| 国产欧美1区2区3区| 又紧又大又爽精品一区二区| 久久99精品久久久久久动态图| 风间由美一区二区三区在线观看 | 亚洲精品一区二区三区蜜桃下载| 国产精品视频一二三| 亚洲成国产人片在线观看| 激情综合网最新| 在线欧美日韩国产| 欧美r级在线观看| 久久精品国产亚洲a| 一本色道**综合亚洲精品蜜桃冫| 精品日韩一区二区三区| 亚洲精品日韩一| 国产99久久精品| 欧美久久久久免费| 亚洲欧美在线另类| 久久99九九99精品| 在线欧美日韩国产| 国产日本欧洲亚洲| 婷婷国产在线综合| 一本大道久久a久久综合婷婷| 久久夜色精品国产噜噜av| 午夜伦欧美伦电影理论片| 99久久99久久精品国产片果冻| 欧美一区二区三区电影| 一区二区三区不卡视频| 国产成人亚洲综合a∨猫咪| 欧美一区二区三区性视频| 亚洲精品高清在线| 国产精品一区二区在线播放| 欧美一三区三区四区免费在线看| 亚洲丝袜美腿综合| 国产福利一区二区三区视频在线 | 5858s免费视频成人| 亚洲摸摸操操av| 成人视屏免费看| 久久久国产精品午夜一区ai换脸| 久久黄色级2电影| 日韩欧美在线1卡| 日本欧美一区二区三区| 欧美唯美清纯偷拍| 亚洲精品第1页| 在线观看不卡一区| 亚洲伦理在线免费看| 波多野结衣中文一区| 国产日本欧美一区二区| 国产东北露脸精品视频| 久久一区二区三区四区| 精品一区二区久久| 日韩一级黄色片| 蜜桃av噜噜一区| 日韩一区二区三免费高清| 丝袜美腿亚洲综合| 亚洲三级电影网站| 99精品久久99久久久久| 亚洲欧洲99久久| 91精品办公室少妇高潮对白| 亚洲乱码国产乱码精品精可以看| 91小宝寻花一区二区三区| 中文字幕一区二区三区不卡在线 | 欧美视频在线一区| 亚洲国产成人高清精品| 欧美日韩久久一区| 性做久久久久久免费观看欧美| 欧美日本一区二区三区| 日韩av一区二区三区| 欧美不卡123| 国产乱对白刺激视频不卡| 中文字幕av一区二区三区免费看| 99v久久综合狠狠综合久久| 亚洲三级视频在线观看| 欧美亚洲一区二区在线| 午夜国产精品一区| 精品国产免费人成在线观看| 国产91清纯白嫩初高中在线观看| 中文字幕一区二区在线播放| 欧美性生交片4| 久久国产生活片100| 中文在线一区二区| 欧美日韩精品二区第二页| 韩国理伦片一区二区三区在线播放| 久久精品在线免费观看| 99vv1com这只有精品| 日韩 欧美一区二区三区| 国产欧美视频在线观看| 在线视频你懂得一区|