Ejemplo n.º 1
0
VOID CPokemonCodec::SetCatcherName(LPCTSTR szCatcherName)
{
	if(m_pPokemon == NULL)
		return;

	if(m_pPokemon->Header.bNickNameLanguage == 0x00)
	{
		if(m_dwLang == lang_jp)
			m_pPokemon->Header.bNickNameLanguage = 0x01;
		else
			m_pPokemon->Header.bNickNameLanguage = 0x02;
	}

	switch(m_dwLang)
	{
	case lang_jp:		// jp version
		StringToCode(szCatcherName, m_pPokemon->Header.bCatcherName, POKEMON_TRAINER_NAME_SIZE, 0xFF, 0xFF, lang_jp);
		//FillMemory(m_pPokemon->Header.bCatcherName + 5, POKEMON_TRAINER_NAME_SIZE - 5, 0x00);
		break;

	default:		// en version
		StringToCode(szCatcherName, m_pPokemon->Header.bCatcherName, POKEMON_TRAINER_NAME_SIZE, 0xFF, 0xFF, lang_en);
		break;
	}
}
Ejemplo n.º 2
0
VOID CPokemonCodec::SetNickName(LPCTSTR szName)
{
	if(m_pPokemon == NULL)
		return;

	if(m_pPokemon->Header.bNickNameLanguage == 0x00)
	{
		if(m_dwLang == lang_jp)
			m_pPokemon->Header.bNickNameLanguage = 0x01;
		else
			m_pPokemon->Header.bNickNameLanguage = 0x02;
	}

	switch(m_pPokemon->Header.bNickNameLanguage)
	{
	case 0x01:		// jp version
		StringToCode(szName, m_pPokemon->Header.bNickName, 5, 0xFF, 0xFF, lang_jp);
		m_pPokemon->Header.bNickName[5] = 0xFF;
		FillMemory(m_pPokemon->Header.bNickName + 6, POKEMON_NICK_NAME_SIZE - 6, 0x00);
		break;

	default:		// en version
		StringToCode(szName, m_pPokemon->Header.bNickName, POKEMON_NICK_NAME_SIZE, 0xFF, 0xFF, lang_en);
		break;
	}
}
Ejemplo n.º 3
0
// Convert first UTF-8 symbol of "src" into ASCII-7 character.
// "ascii_table" specifies whether to use ASCII-7 translation tables.
// Length of the retrieved UTF-8 symbol is returned in "*seq_len"
// (if "seq_len" is not NULL).
// Return resulting ASCII-7 character.
// NOTE:  If the UTF-8 symbol has no ASCII-7 equivalent, then return
//        kOutrangeChar or hSkipChar.
//
char StringToChar(const string&      src,
                  size_t*            seq_len,
                  bool               ascii_table,
                  EConversionStatus* status)
{
    long              dst_code;  // UTF-code symbol code
    unsigned char     dst_char;  // Result character
    EConversionStatus stat;      // Temporary status     

    // Process one UTF character
    dst_code = StringToCode(src, seq_len, &stat);
    if (status) *status = stat;
    // If it was happily
    if (stat == eSuccess) {
        // Conversion
        if (ascii_table) {
            // Convert into appropriate 7-bit character via conversion table 
            dst_char = CodeToChar(dst_code, status);
            return dst_char;
        }    
        else
        {
            // if character greater than 127 (0x7F) than substitute it 
            // with kOutrangeChar, else leave it as is.
            if (dst_code > 0x7F) {
                RETURN_S (kOutrangeChar, eOutrangeChar);
            }
        }
    }
    // Was error translate char
    return (char)dst_code;
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
// 指定されたエントリを空にしてから単語を追加
// エントリを変数的に利用する時に使用する
// 戻り値 : 追加した単語のID
TWordID TNS_KawariDictionary::InsertAfterClear(TEntryID entry,const string& word)
{
	TKawariCode_base *code=StringToCode(word);
	TWordID id=InsertAfterClear(entry,code);

	return(id);
}
Ejemplo n.º 5
0
//---------------------------------------------------------------------------
// 単語ID取得
// 戻り値 : 1オリジン、見つからなければ0を返す
TWordID TNS_KawariDictionary::GetWordID(const string& word) const
{
	TKawariCode_base *code=StringToCode(word);
	TWordID id=GetWordID(code);
	delete code;

	return(id);
}
Ejemplo n.º 6
0
int32
ResourceType::FindIndex(type_code code)
{
	for (int32 i = 0; kDefaultTypes[i].type != NULL; i++)
		if (StringToCode(kDefaultTypes[i].code) == code)
			return i;

	return -1;
}
bool HTTP::ResponseDecoder::MatchStartLine (const std::string& inLine) {
    
    std::regex reInitialLine ("^HTTP/([0-9\\.0-9]+)\\s([0-9]+)");
    std::smatch matchLine;
    if (std::regex_search (inLine, matchLine, reInitialLine)) {
        
        mMessage = std::make_unique<Response> ();
        mMessage->mVersion = StringToVersion (matchLine[1].str ());
        mMessage->mCode = StringToCode (matchLine[2].str ());
        
        return true;
    }
    
    return false;
}
Ejemplo n.º 8
0
// Convert UTF-8 string "src" into the vector of Unicode symbol codes
// using StringToCode().
// Return resulting vector.
//
vector<long> StringToVector (const string& src)
{
    vector<long> dst;      // String to result 
    long         ch;       // Unicode symbol code
    size_t       utf_len;  // Length of Unicode symbol
    size_t       src_len;  // Length of source string

    src_len = src.size();

    for (size_t i = 0; i < src_len; )
    {
        // Process one UTF character
        ch = StringToCode(src.data()+i, &utf_len);
        // Add character to the result vector
        dst.push_back(ch);
        i += utf_len;
    }
    return dst;
}
Ejemplo n.º 9
0
static void LogLocations(int Kmer)
	{
	Log("LogLocations(%d %s)", Kmer, CodeToString(Kmer, k));
	for (DeclareListPtr(p) = GetListPtr(Kmer); NotEndOfList(p); p = GetListNext(p))
		Log(" [%d]=%d", p->Pos, StringToCode(SeqQ + p->Pos, k));
	}
Ejemplo n.º 10
0
static inline int GetKmer(const char *Seq, int Pos)
	{
	return StringToCode(Seq + Pos, k);
	}