本文整理汇总了C++中IsDBCSLeadByte函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDBCSLeadByte函数的具体用法?C++ IsDBCSLeadByte怎么用?C++ IsDBCSLeadByte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsDBCSLeadByte函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: StrRStrIA
/*************************************************************************
* StrRStrIA [COMCTL32.372]
*
* Find the last occurrence of a substring within a string.
*
* PARAMS
* lpszStr [I] String to search in
* lpszEnd [I] End of lpszStr
* lpszSearch [I] String to look for
*
* RETURNS
* The last occurrence lpszSearch within lpszStr, or NULL if not found.
*/
LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
{
LPSTR lpszRet = NULL;
WORD ch1, ch2;
INT iLen;
TRACE("(%s,%s)\n", debugstr_a(lpszStr), debugstr_a(lpszSearch));
if (!lpszStr || !lpszSearch || !*lpszSearch)
return NULL;
if (!lpszEnd)
lpszEnd = lpszStr + lstrlenA(lpszStr);
if (IsDBCSLeadByte(*lpszSearch))
ch1 = *lpszSearch << 8 | lpszSearch[1];
else
ch1 = *lpszSearch;
iLen = lstrlenA(lpszSearch);
while (lpszStr <= lpszEnd && *lpszStr)
{
ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
if (!COMCTL32_ChrCmpIA(ch1, ch2))
{
if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
lpszRet = (LPSTR)lpszStr;
}
lpszStr = CharNextA(lpszStr);
}
return lpszRet;
}
开发者ID:francissabado,项目名称:wine,代码行数:45,代码来源:string.c
示例2: defined
void CUITextBox::CheckSplit( int& nCurCnt, int& nSplitCnt, int& nEnterCnt)
{
std::string strTmp;
int pos;
int len = m_Str.size();
bool bDBSC = false;
#if defined(G_KOR) || defined(G_THAI)
bDBSC = true;
#endif
pos = m_Str.find("\\n", nCurCnt);
if (pos != std::string::npos && (pos - nCurCnt + 1) <= nSplitCnt)
{
nSplitCnt = pos - nCurCnt;
nEnterCnt = 2;
}
// 한글인지 검사.
if (bDBSC == true)
{
if ((nCurCnt + nSplitCnt) < len && IsDBCSLeadByte(m_Str[nCurCnt + nSplitCnt]))
{
bool bLead = false;
for (int i = nCurCnt; i <= (nCurCnt + nSplitCnt); ++i)
{
if (IsDBCSLeadByte(m_Str[i]))
{
bLead = true;
++i;
if (i > (nCurCnt + nSplitCnt))
{
bLead = false;
}
}
else
{
bLead = false;
}
}
if (bLead == true)
--nSplitCnt;
}
}
if ((nCurCnt + nSplitCnt) > len)
nSplitCnt = len - nCurCnt;
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:54,代码来源:UITextBox.cpp
示例3: MakeCompressedName
/*
** char MakeCompressedName(char ARG_PTR *pszFileName);
**
** Make a file name into the corresponding compressed file name.
**
** Arguments: pszOriginalName - file name to convert to compressed file name
**
** Returns: char - Uncompressed file name extension character that was
** replaced. '\0' if no character needed to be replaced.
**
** Globals: none
**
** N.b., assumes pszFileName's buffer is long enough to hold an extra two
** characters ("._").
**
** For DBCS filenames, we know we can have at most one DBCS character in the
** extension. So instead of just blindly replacing the last character of a
** three-byte extension with an underscore, we replace the last single-byte
** character with an underscore.
*/
CHAR MakeCompressedName(CHAR ARG_PTR *pszFileName)
{
CHAR chReplaced = '\0';
CHAR ARG_PTR *pszExt;
#ifdef DBCS
if ((pszExt = ExtractExtension(pszFileName)) != NULL)
{
if (STRLEN(pszExt) >= 3)
{
// Replace the last single-byte character in the extension with an
// underscore.
if (! IsDBCSLeadByte(*pszExt) && IsDBCSLeadByte(pszExt[1]))
{
// Assert: The first character in the extension is a single-byte
// character and the second character in the extension is a
// double-byte character.
chReplaced = *pszExt;
*pszExt = chEXTENSION_CHAR;
}
else
{
// Assert: The third character in the extension is a single-byte
// character. The first two bytes may be two single-byte
// characters or a double-byte character.
chReplaced = pszExt[2];
pszExt[2] = chEXTENSION_CHAR;
}
}
else
STRCAT(pszExt, pszEXTENSION_STR);
}
else
STRCAT(pszFileName, pszNULL_EXTENSION);
#else
if ((pszExt = ExtractExtension(pszFileName)) != NULL)
{
if (STRLEN(pszExt) >= 3)
{
chReplaced = pszExt[STRLEN(pszExt) - 1];
pszExt[STRLEN(pszExt) - 1] = chEXTENSION_CHAR;
}
else
STRCAT(pszExt, pszEXTENSION_STR);
}
else
STRCAT(pszFileName, pszNULL_EXTENSION);
#endif
return(chReplaced);
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:73,代码来源:utils.c
示例4: IsNative
BOOL IsNative( LPCTSTR lpszStr )
{
ASSERT( g_codePage != 0 );
LPCWSTR pwSrc = (LPCWSTR) lpszStr;
if( g_codePage == 874 ) // 타이
{
return (BYTE)*lpszStr >= 0xa1 && (BYTE)*lpszStr <= 0xfb;
}
else
if( g_codePage == 949 ) // 한글
{
return IsHangul( *pwSrc );
}
else
if( g_codePage == 932 ) // 일본
{
return IsDBCSLeadByte( (BYTE)( *pwSrc ) );
}
else
if( g_codePage == 936 ) // 한자 : 중국
{
return IsDBCSLeadByte( (BYTE)( *pwSrc ) );
}
else
if( g_codePage == 950 ) // 한자 : 대만
{
// return IsDBCSLeadByte( *pwSrc );
if( ((BYTE)*lpszStr >= 0xCA && (BYTE)*lpszStr <= 0xFD) && ( (BYTE)*lpszStr+1 >= 0xA1 ) && ( (BYTE)*lpszStr+1 <= 0xFE) )
{
return TRUE;
}
else
if ( ( ( (BYTE)*lpszStr >= 0x41 ) &&
( (BYTE)*lpszStr <= 0x5A ) ) ||
( ( (BYTE)*lpszStr >= 0x61 ) && ( (BYTE)*lpszStr <= 0x7A) ) )
{
return TRUE;
}
else
if( isdigit2( (BYTE)*lpszStr ) )
return TRUE;
}
return FALSE;
}
开发者ID:iceberry,项目名称:flyffsf,代码行数:48,代码来源:vutil.cpp
示例5: SetStrNull
void SetStrNull( CString& string, int nNullLength )
{
int nLength = string.GetLength();
// 0을 넣을 포지션이 실제 스트링 길이보다 길면 실제 스트링 길이로 맞출 필요가 있음
if( nNullLength > nLength )
nNullLength = nLength;
int i; for( i = 0; i < nNullLength; )
{
#ifdef __CLIENT
if( ::GetLanguage() == LANG_THA && g_codePage == 874 ) // 타이
i++;
else if(::GetLanguage() == LANG_VTN && g_codePage == 1258)
i++;
else
#endif//__CLIENT
if( IsDBCSLeadByte( string[ i ] ) )
i+=2;
else
i++;
}
// i가 nLength 보다 크다면 Word캐릭터일 것이고, 끝부분이 깨져서 오차가 생긴 것이다.
if( i > nNullLength )
string = string.Left( i - 2 );
else
string = string.Left( i );
}
开发者ID:iceberry,项目名称:flyffsf,代码行数:26,代码来源:vutil.cpp
示例6: _mbsinc
void CFilteringTable::RemoveSpace(LPCTSTR textInput, LPTSTR textOutput, size_t size) const
{
TCHAR buffer[MAX_PATH] = {0};
for(PUCHAR inputPointer = PUCHAR(textInput);
0 < *inputPointer;
inputPointer = _mbsinc((const PUCHAR)inputPointer))
{
LPCTSTR removedSpeicalCharacter = _T("\t\n\r ~`[email protected]#$%^&*()-_=+\\|<,>.?/");
if(_tcschr(removedSpeicalCharacter, *inputPointer))
{
continue;
}
_tcsncat(
buffer,
LPCTSTR(inputPointer),
IsDBCSLeadByte(*inputPointer) ? 2 : 1);
}
SafeStrCpy(
textOutput,
buffer,
size);
}
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:26,代码来源:FilteringTable.cpp
示例7: GetDC
bool DXAPI::InitFont(){
int fontsize = 500;
LOGFONT lf = {fontsize, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, OUT_TT_ONLY_PRECIS,
CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FIXED_PITCH | FF_MODERN,"MS 明朝"};
HFONT hFont;
if(!(hFont = CreateFontIndirect(&lf))){
return false;
}
HDC hdc = GetDC(NULL);
HFONT oldFont = (HFONT)SelectObject(hdc, hFont);
// 文字コード取得
TCHAR *c = "あ";
UINT code = 0;
if(IsDBCSLeadByte(*c))
code = (BYTE)c[0]<<8 | (BYTE)c[1];
else
code = c[0];
/*
// フォントビットマップ取得
GetTextMetrics( hdc, &TM );
CONST MAT2 Mat = {{0,1},{0,0},{0,0},{0,1}};
DWORD size = GetGlyphOutline(hdc, code, GGO_GRAY4_BITMAP, &GM, 0, NULL, &Mat);
BYTE *ptr = new BYTE[size];
GetGlyphOutline(hdc, code, GGO_GRAY4_BITMAP, &GM, size, ptr, &Mat);
*/
// デバイスコンテキストとフォントハンドルの開放
SelectObject(hdc, oldFont);
DeleteObject(hFont);
ReleaseDC(NULL, hdc);
return true;
}
开发者ID:kodack64,项目名称:koma2011,代码行数:35,代码来源:DXAPI.cpp
示例8: MakePath
/*=========================================================================
パス合成(ANSI 版)
=========================================================================*/
int MakePath(char *dest, const char *dir, const char *file, int max_len)
{
if (!dir) {
dir = dest;
}
int len;
if (dest == dir) {
len = (int)strlen(dir);
} else {
len = strcpyz(dest, dir);
}
if (len > 0) {
bool need_sep = (dest[len -1] != '\\');
if (len >= 2 && !need_sep) { // 表などで終端の場合は sep必要
BYTE *p = (BYTE *)dest;
while (*p) {
if (IsDBCSLeadByte(*p) && *(p+1)) {
p += 2;
if (!*p) {
need_sep = true;
}
} else {
p++;
}
}
}
if (need_sep) {
dest[len++] = '\\';
}
}
return len + strncpyz(dest + len, file, max_len - len);
}
开发者ID:Mapaler,项目名称:FastCopy-M,代码行数:38,代码来源:tstr.cpp
示例9: TJS_mbtowc
//---------------------------------------------------------------------------
int TJS_mbtowc(tjs_char *pwc, const tjs_nchar *s, size_t n)
{
if(!s || !n) return 0;
if(*s == 0)
{
if(pwc) *pwc = 0;
return 0;
}
/* Borland's RTL seems to assume always MB_MAX_CHARLEN = 2. */
/* This may true while we use Win32 platforms ... */
if(IsDBCSLeadByte((BYTE)(*s)))
{
// multi(double) byte character
if((int)n < TJS_MB_MAX_CHARLEN) return -1;
if(MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS,
s, TJS_MB_MAX_CHARLEN, pwc, pwc ? 1:0) == 0)
{
if(s[1] == 0) return -1;
}
return TJS_MB_MAX_CHARLEN;
}
else
{
// single byte character
if(MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, s,
1, pwc, pwc ? 1:0) == 0)
return -1;
return 1;
}
}
开发者ID:ihavesomefork,项目名称:DollEngine,代码行数:33,代码来源:tjsConfig.cpp
示例10: isUniversalCharacter
int isUniversalCharacter(unsigned char* i) {
struct _UniversalChar *p;
if (IsDBCSLeadByte(*i)) {
if (!g_pUC) {
g_pUC = (struct _UniversalChar *)malloc(sizeof(struct _UniversalChar));
g_pUC->index = 1;
g_pUC->value = *(short int *)i;
g_pUC->next = 0;
return 1;
}
for (p = g_pUC; p->next; p = p->next) {
if (*(short int*)i == p->value)
return p->index;
}
if (*(short int*)i == p->value)
return p->index;
p->next = (struct _UniversalChar *)malloc(sizeof(struct _UniversalChar));
p->next->index = p->index + 1;
p->next->value = *(short int *)i;
p->next->next = 0;
return p->next->index;
}
return 0;
}
开发者ID:HsuJv,项目名称:Note,代码行数:25,代码来源:Terminal.c
示例11: while
BOOL CServerSystem::IsInvalidCharInclude( char* pStr )
{
while( *pStr )
{
BOOL bOk = FALSE;
if( IsDBCSLeadByte( *pStr ) )
{
++pStr;
}
else
{
//영문
if( ( *pStr >= 'A' && *pStr <= 'Z' ) || ( *pStr >= 'a' && *pStr <= 'z' ) )
bOk = TRUE;
//숫자
else if( *pStr >= '0' && *pStr <= '9' )
bOk = TRUE;
}
++pStr;
if( bOk == FALSE )
{
return TRUE;
}
}
return FALSE;
}
开发者ID:xianyinchen,项目名称:LUNAPlus,代码行数:30,代码来源:ServerSystem.cpp
示例12: SelectObject
vector<int> CglResouce::Build3DText(unsigned char *str)
{
vector<int> result;
result.clear();
HDC hDC=wglGetCurrentDC();
//设置当前字体
SelectObject(wglGetCurrentDC(),hFont);
DWORD dwChar;
GLYPHMETRICSFLOAT pgmf[1];
for(size_t i=0;i<strlen((char *)str);i++)
{
if(IsDBCSLeadByte(str[i]))
{
dwChar=(DWORD)((str[i]<<8)|str[i+1]);
i++;
}
else
dwChar=str[i];
result.push_back( glGenLists(1) );
wglUseFontOutlines(hDC,dwChar,1,result.back(),0.0,0.1f,WGL_FONT_POLYGONS,pgmf);
}
return result;
}
开发者ID:Zhun-John,项目名称:paradox4d,代码行数:28,代码来源:glResouce.cpp
示例13: _tcsrchr
int
CString::ReverseFind(char ch) const
{
LPSTR lpsz;
#ifdef _WIN32
// This routine is multi-byte aware
lpsz = _tcsrchr(m_pchData, (_TUCHAR)ch);
#else
assert(!IsDBCSLeadByte(ch));
// Visual C++ 1.52 runtime has no multi-byte aware version
// of strrchr
if (g_bDBCS) {
LPSTR lpszLast = NULL;
// Walk forward through the string remembering the last
// match
for (lpsz = m_pchData; *lpsz; lpsz = AnsiNext(lpsz)) {
if (*lpsz == ch)
lpszLast = lpsz;
}
lpsz = lpszLast;
} else {
lpsz = strrchr(m_pchData, ch);
}
#endif
return lpsz == NULL ? -1 : (int)(lpsz - m_pchData);
}
开发者ID:vicamo,项目名称:b2g_mozilla-central,代码行数:32,代码来源:cstring.cpp
示例14: _tcschr
// Searching (return starting index, or -1 if not found)
// look for a single character match
int
CString::Find(char ch) const
{
LPSTR lpsz;
#ifdef _WIN32
lpsz = _tcschr(m_pchData, ch);
#else
assert(!IsDBCSLeadByte(ch));
// Visual C++ 1.52 runtime has no multi-byte aware version
// of strchr
if (g_bDBCS) {
if (ch == '\0')
lpsz = m_pchData + m_nDataLength;
else {
// Use the MBCS routine to step through the characters
for (lpsz = m_pchData; *lpsz; lpsz = AnsiNext(lpsz)) {
if (*lpsz == ch)
break;
}
if (*lpsz == '\0') {
lpsz = NULL; // No match.
}
}
} else {
lpsz = strchr(m_pchData, ch);
}
#endif
return lpsz == NULL ? -1 : (int)(lpsz - m_pchData);
}
开发者ID:vicamo,项目名称:b2g_mozilla-central,代码行数:36,代码来源:cstring.cpp
示例15: wglGetCurrentDC
void Window::drawString(string str) {
int len = 0;
wchar_t* wstring;
HDC hDC = wglGetCurrentDC();
for (int i = 0; str[i] != '\0'; ++i)
{
if (IsDBCSLeadByte(str[i]))
++i;
++len;
}
GLuint list = glGenLists(1);
// 将混合字符转化为宽字符
wstring = (wchar_t*)malloc((len + 1) * sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str.c_str(), -1, wstring, len);
wstring[len] = L'\0';
// 逐个输出字符
for (int i = 0; i < len; ++i)
{
wglUseFontBitmapsW(hDC, wstring[i], 1, list);
glCallList(list);
}
// 回收所有临时资源
free(wstring);
glDeleteLists(list, 1);
}
开发者ID:Infinideastudio,项目名称:Island-Survival,代码行数:30,代码来源:Window.cpp
示例16: wglGetCurrentDC
void CFontDisplay::drawCNString(const char* str)
{
int len, i;
wchar_t* wstring;
HDC hDC = wglGetCurrentDC();
GLuint list = glGenLists(1);
// 计算字符的个数
// 如果是双字节字符的(比如中文字符),两个字节才算一个字符
// 否则一个字节算一个字符
len = 0;
for(i=0; str[i]!='\0'; ++i)
{
if( IsDBCSLeadByte(str[i]) )
++i;
++len;
}
// 将混合字符转化为宽字符
wstring = (wchar_t*)malloc((len+1) * sizeof(wchar_t));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str, -1, wstring, len);
wstring[len] = L'\0';
// 逐个输出字符
for(i=0; i<len; ++i)
{
wglUseFontBitmapsW(hDC, wstring[i], 1, list);
glCallList(list);
}
// 回收所有临时资源
free(wstring);
glDeleteLists(list, 1);
}
开发者ID:friends110110,项目名称:FlyCap,代码行数:34,代码来源:FontDisplay.cpp
示例17: wglGetCurrentDC
void CGLFont::Printfc3d(CString strText,HFONT hFont,float z)
{ HDC hdc = wglGetCurrentDC(); //设备场景
HFONT hOldFont=(HFONT)::SelectObject(hdc,hFont);//将字体选入场景
UCHAR * pChar=(UCHAR*)strText.GetBuffer(strText.GetLength());//定义字符串长度
int nListNum; //显示列表
DWORD dwChar; //字符指针
GLYPHMETRICSFLOAT pgmf[1]; //轮廓字体字符集的信息
glPushMatrix(); //压入堆栈
for(int i = 0; i < strText.GetLength(); i++)
{ if(IsDBCSLeadByte((BYTE)pChar[i])) //是否双字节(汉字)
{ dwChar=(DWORD)((pChar[i]<<8)|pChar[i+1]); //取当前字符,双字节转换
i++;
}
else dwChar = pChar[i]; //取当前字符
nListNum = glGenLists(1); //创建列表
wglUseFontOutlines( hdc, //拥有字体的HDC
dwChar, //转化为显示列表的第一个字符
1, //转化为显示列表的字符数
nListNum, //显示列表的开始
0.0f,
z, //Z轴负方向的厚度
WGL_FONT_POLYGONS, //绘制字体方式
pgmf //指向存放信息的数组,为count个
);
glCallList(nListNum); //绘制显示列表
glDeleteLists(nListNum, 1); //删除列表
}
glPopMatrix(); //弹出堆栈
strText.ReleaseBuffer(); //清除字符串
::SelectObject(hdc,hOldFont); //恢复字体
}
开发者ID:gangMeng,项目名称:AntAnimation,代码行数:31,代码来源:GLFont.cpp
示例18: getWin32SelPos
static long getWin32SelPos(AwtTextComponent *c, long orgPos)
{
long mblen;
long pos = 0;
long cur = 0;
TCHAR *mbbuf;
if ((mblen = c->GetTextLength()) == 0)
return 0;
mbbuf = new TCHAR[mblen + 1];
c->GetText(mbbuf, mblen + 1);
while (cur < orgPos && pos < mblen) {
#ifndef UNICODE
if (IsDBCSLeadByte(mbbuf[pos])) {
pos++;
} else if (mbbuf[pos] == '\r' && mbbuf[pos + 1] == '\n') {
pos++;
}
#else
if (mbbuf[pos] == TEXT('\r') && mbbuf[pos + 1] == TEXT('\n')) {
pos++;
}
#endif
pos++;
cur++;
}
delete[] mbbuf;
return pos;
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:30,代码来源:PPCTextComponentPeer.cpp
示例19: TrimViewString
void TrimViewString(CmyString &strDst, LPCSTR pszSrc)
{
int i, nLen;
BYTE byTmp;
char szTmp[3];
strDst.Empty ();
if (pszSrc == NULL) {
return;
}
nLen = strlen (pszSrc);
if (nLen <= 0) {
return;
}
ZeroMemory (szTmp, sizeof (szTmp));
for (i = 0; i < nLen; i ++) {
byTmp = (BYTE)pszSrc[i];
if (IsDBCSLeadByte (byTmp)) {
szTmp[0] = byTmp;
szTmp[1] = pszSrc[i + 1];
strDst += szTmp;
i ++;
continue;
}
if ((byTmp < 0x20) || ((byTmp >= 0x7F) && !((byTmp >= 0xA1) && (byTmp <= 0xDF)))) {
continue;
}
szTmp[0] = byTmp;
szTmp[1] = 0;
strDst += szTmp;
}
}
开发者ID:psgsgpsg,项目名称:scrapbookonline,代码行数:33,代码来源:SBOGlobal.cpp
示例20: mystrchr
// -----------------------------------------------------------------------
//
// String helper function to remove crt dependency
//
// -----------------------------------------------------------------------
LPSTR
mystrchr(
__in LPSTR cs,
char c
)
{
while (*cs != 0)
{
if (IsDBCSLeadByte(*cs))
{
cs++;
if (*cs == 0)
{
return NULL;
}
}
else
if (*cs == c)
return cs;
cs++;
}
// fail to find c in cs
return NULL;
}
开发者ID:kcrazy,项目名称:winekit,代码行数:30,代码来源:util.c
注:本文中的IsDBCSLeadByte函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论