66 lines
1.7 KiB
C++
66 lines
1.7 KiB
C++
#ifdef _COUNTRY_TL_
|
|
// 태국어 로컬라이징관련 기능들 모음
|
|
|
|
|
|
//#include <string>
|
|
#include <iostream>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
using namespace std;
|
|
|
|
namespace LocalizationTL
|
|
{
|
|
|
|
/*
|
|
악명높은 태국어 워드-브레이킹을 처리해주는 클래스
|
|
/ 사용법 :
|
|
1. "iptdict.txt", "BaseChar.txt", "tewordbreak.txt" 3개의 파일을 LoadDic()에서 읽는다. (프로그램 시작 할때 한번 로딩)
|
|
2. wcut = 줄바꿈 구분자로 사용할 스트링 (설정해줘야 함)
|
|
3. n_ch = 몇글자에서 잘라낼 것인지 결정하는 int (설정해줘야 함)
|
|
4. TEWordBreak::BreakString을 부른다. (이 함수는 매우 느림)
|
|
|
|
ex) wcut : "\n", n_ch : 3일때
|
|
"1234567890" 을 BreakString하면 "123\n345\n678\n90" 식으로 출력된다.
|
|
*/
|
|
#define THAI_STRING_LENGTH 512
|
|
class TEWordBreak{
|
|
public:
|
|
int o;
|
|
int ob;
|
|
int l;
|
|
int p;
|
|
int q;
|
|
int j;
|
|
int m;
|
|
int n_ch;
|
|
int x_sc2[50];
|
|
string Dic[20000],BaseChar,abuf, RSBuf, wcut;
|
|
const char *p_buf;
|
|
char Buffer[20];
|
|
void LoadDic();
|
|
string BreakString(const char *);
|
|
int B_strlen(string);
|
|
bool E_strcmp(string);
|
|
void SearchDic(int,int);
|
|
int checkchar(string);
|
|
};
|
|
|
|
|
|
bool IsComposible(unsigned char prev, unsigned char curr, int mode);
|
|
// CharNextExA의 태국어 버전. 인터넷에서 굴러다니는 것을 줏어왔음.
|
|
const char* CharNextTh(const char* lpsz);
|
|
const char* CharPrevTh(const char* lpszStart, const char* lpszCurrent);
|
|
|
|
// 이 string에 ascii code 128 이상의 문자가 들어갔는지 체크한다.
|
|
bool isOnlyEnglishWord(const std::string& str);
|
|
|
|
// wstr 안에서 cursorpos가 가리키는 문자가 몇바이트인지 반환한다. 쓸모가 많음
|
|
int GetCursorLength(const wchar_t* wstr, int len, int cursorpos);
|
|
|
|
extern TEWordBreak g_TEWordBreak;
|
|
|
|
}
|
|
|
|
#endif
|