当前位置: 首页>>代码示例>>C++>>正文


C++ IsDBCSLeadByte函数代码示例

本文整理汇总了C++中IsDBCSLeadByte函数的典型用法代码示例。如果您正苦于以下问题:C++ IsDBCSLeadByte函数的具体用法?C++ IsDBCSLeadByte怎么用?C++ IsDBCSLeadByte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IsDBCSLeadByte函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IsDBCSLeadByte函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。