2 #include "StringHelper.h" 12 typedef std::map<WCHAR, WCHAR> CharacterWideCharMap_type;
14 :m_nMinRange(0xffff), m_nMaxRange(0)
24 const WCHAR* swText = ParaEngine::StringHelper::MultiByteToWideChar(sLineText, DEFAULT_GUI_ENCODING);
27 WCHAR wcFrom = *swText;
30 WCHAR wcTo = *(++swText);
32 while(wcTo!=L
'\0' && !bBreak)
34 if(wcTo!=L
' ' && wcTo!=L
'\t')
37 m_char_map[wcFrom] = wcTo;
38 if(wcFrom<m_nMinRange)
40 if(wcFrom>m_nMaxRange)
51 OUTPUT_LOG(
"error: unable to open locale file %s\n", sFileName);
55 const WCHAR* TranslateW(
const WCHAR* sText)
59 static vector<WCHAR> sOutput;
60 int nSize = (int)(wcslen(sText));
61 if(nSize >= ((
int)sOutput.size()))
63 sOutput.resize(nSize+2);
64 sOutput[nSize] = L
'\0';
66 for(
int i=0; i<nSize; ++i)
69 if(m_nMinRange<=c && c<=m_nMaxRange)
71 CharacterWideCharMap_type::iterator iter = m_char_map.find(c);
72 if(iter!=m_char_map.end())
74 sOutput[i] = iter->second;
78 sOutput[i] = sText[i];
83 sOutput[i] = sText[i];
86 sOutput[nSize] = L
'\0';
90 CharacterWideCharMap_type m_char_map;
PE_CORE_DECL int OpenAssetFile(const char *filename, bool bDownloadIfNotUpToDate=true, const char *relativePath=NULL)
This is rather similar to OpenFile() method, except that it will first look in the AssetManifest to s...
Definition: ParaFile.cpp:384
different physics engine has different winding order.
Definition: EventBinding.h:32
PE_CORE_DECL int GetNextLine(char *buf, int sizeBuf)
return the next line of text string from the current file position.
Definition: ParaFile.cpp:1226
it presents a real or virtual file in ParaEngine.
Definition: ParaFile.h:31
this is usually used for translating from simplified Chinese to traditional Chinese character...
Definition: SimpleTranslator.h:9