예제 #1
0
// But simple narrow to wide conversion.  No Unicode considered.  Will only 
// work with normal range of ANSII characters in wide format.
std::wstring NarrowToWideString( const std::string& str )
{
	// Create matching buffers and add null terminator char to end.
	std::vector<wchar_t> wideChars( str.length() + 1, L'\0' );
	std::vector<char>	 narrowChars( str.length() + 1, '\0' );
	memcpy( &narrowChars[0], str.c_str(), str.length() );

	std::for_each( narrowChars.begin(), narrowChars.end(), NarrowCharToWide( wideChars ) );
	return std::wstring( &wideChars[0] );
}
예제 #2
0
	SourceIndex::WordID getLocaseWordId(ConstStrA word)
	{
		Crc32 crc32;
		TypeConvWriter<Crc32 &, char> crc32chr(crc32);
		WideToUtf8Writer<TypeConvWriter<Crc32 &, char> &> crc32wchr(crc32chr);

		Utf8ToWideReader<ConstStrA::Iterator> wideChars(word.getFwIter());

		while (wideChars.hasItems()) crc32wchr.write(towupper(wideChars.getNext()));

		return crc32.getCrc32();
	}