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


C++ IS_ASCII函数代码示例

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


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

示例1: __F_NAME

 _WCRTLINK int __F_NAME(strnicmp,_wcsnicmp)( const CHAR_TYPE *s, const CHAR_TYPE *t, size_t n )
#endif
{
    UCHAR_TYPE      c1;
    UCHAR_TYPE      c2;

    for( ; n > 0; --n ) {
        c1 = *s;
        c2 = *t;
        if( IS_ASCII( c1 ) && IS_ASCII( c2 ) ) {
            if( c1 >= STRING( 'A' ) && c1 <= STRING( 'Z' ) )
                c1 += STRING( 'a' ) - STRING( 'A' );
            if( c2 >= STRING( 'A' ) && c2 <= STRING( 'Z' ) ) {
                c2 += STRING( 'a' ) - STRING( 'A' );
            }
        }
        if( c1 != c2 )
            return( c1 - c2 );      /* less than or greater than */
        if( c1 == NULLCHAR )
            break;          /* equal */
        ++s;
        ++t;
    }
    return( 0 );            /* equal */
}
开发者ID:Graham-stott,项目名称:open-watcom-v2,代码行数:25,代码来源:strnicmp.c

示例2: __F_NAME

 _WCRTLINK int __F_NAME(strnicmp,_wcsnicmp)( const CHAR_TYPE *s, const CHAR_TYPE *t, size_t n )
#endif
{
    UCHAR_TYPE      c1;
    UCHAR_TYPE      c2;

    for( ;; ) {
        if( n == 0 )
            return( 0 );            /* equal */
        c1 = *s;
        c2 = *t;
        if( IS_ASCII( c1 ) && IS_ASCII( c2 ) ) {
            if( c1 >= 'A'  &&  c1 <= 'Z' )
                c1 += 'a' - 'A';
            if( c2 >= 'A'  &&  c2 <= 'Z' )
                c2 += 'a' - 'A';
        }
        if( c1 != c2 )
            return( c1 - c2 );      /* less than or greater than */
        if( c1 == NULLCHAR )
            return( 0 );            /* equal */
        ++s;
        ++t;
        --n;
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:26,代码来源:strnicmp.c

示例3: GetClass

uint8_t nsSampleWordBreaker::GetClass(char16_t c)
{
    // begin of the hack

    if (IS_ALPHABETICAL_SCRIPT(c))  {
        if(IS_ASCII(c))  {
            if(ASCII_IS_SPACE(c)) {
                return kWbClassSpace;
            } else if(ASCII_IS_ALPHA(c) || ASCII_IS_DIGIT(c)) {
                return kWbClassAlphaLetter;
            } else {
                return kWbClassPunct;
            }
        } else if(IS_THAI(c))	{
            return kWbClassThaiLetter;
        } else if (c == 0x00A0/*NBSP*/) {
            return kWbClassSpace;
        } else {
            return kWbClassAlphaLetter;
        }
    }  else {
        if(IS_HAN(c)) {
            return kWbClassHanLetter;
        } else if(IS_KATAKANA(c))   {
            return kWbClassKatakanaLetter;
        } else if(IS_HIRAGANA(c))   {
            return kWbClassHiraganaLetter;
        } else if(IS_HALFWIDTHKATAKANA(c))  {
            return kWbClassHWKatakanaLetter;
        } else  {
            return kWbClassAlphaLetter;
        }
    }
    return 0;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:35,代码来源:nsSampleWordBreaker.cpp

示例4: stri_test_Rmark

/** Check R encoding marking *for testing only*
 *  This function should not be exported
 *
 *  @param s character vector
 *
 *  Results are printed on STDERR
 *
 * @version 0.1 (Marek Gagolewski)
 */
SEXP stri_test_Rmark(SEXP s)
{
#ifndef NDEBUG
   s = stri_prepare_arg_string(s, "str");
   int ns = LENGTH(s);
   for (int i=0; i < ns; ++i) {
      fprintf(stdout, "!NDEBUG: Element #%d:\n", i);
      SEXP curs = STRING_ELT(s, i);
      if (curs == NA_STRING){
         fprintf(stdout, "!NDEBUG: \tNA\n");
         continue;
      }
      //const char* string = CHAR(curs);
      fprintf(stdout, "!NDEBUG: \tMARK_ASCII = %d\n", (IS_ASCII(curs) > 0));
      fprintf(stdout, "!NDEBUG: \tMARK_UTF8  = %d\n", (IS_UTF8(curs) > 0));
      fprintf(stdout, "!NDEBUG: \tMARK_LATIN1= %d\n", (IS_LATIN1(curs) > 0));
      fprintf(stdout, "!NDEBUG: \tMARK_BYTES = %d\n", (IS_BYTES(curs) > 0));
      fprintf(stdout, "!NDEBUG: \n");
   }
   return R_NilValue;
#else
   Rf_error("This function is enabled only if NDEBUG is undef.");
   return s;  // s here avoids compiler warning
#endif
}
开发者ID:rforge,项目名称:stringi,代码行数:34,代码来源:stri_test.cpp

示例5: fseek

int Message::Read(const char *filename)
{
    FILE *msgfile;
    int size;
    char cur;

    if(!(msgfile=fopen(filename,"r"))) return 0;

    //get file size
    fseek(msgfile,0,SEEK_END);
    size=ftell(msgfile)+1;
    fseek(msgfile,0,SEEK_SET);

    AllocateBuffers(size);

    if(!cipher || !plain) return 0;

    //read from file
    msg_len=0;

    while(fscanf(msgfile,"%c",&cur)!=EOF)
    {
        if(!IS_ASCII(cur) || cur==' ') continue;
        cipher[msg_len++]=cur;
    }

    cipher[msg_len]='\0';
    fclose(msgfile);

    SetInfo(true);

    return msg_len;
}
开发者ID:BGCX261,项目名称:zkdecrypto-lite-git,代码行数:33,代码来源:message.cpp

示例6: inTrieTranspose

static int inTrieTranspose(TrieNode* node, char* word, char* suggestion, int maxEdits)
{
	int result = FALSE;
	/*TrieNode* nextNode = node->children[CH_INDEX(word[1])];
	 
	 if(IS_ASCII((int)word[1]) && nextNode != NULL)
	 {
	 TrieNode* nextNextNode = nextNode->children[CH_INDEX(word[0])];
	 if(nextNextNode != NULL)
	 {
	 suggestion[0] = word[1];
	 suggestion[1] = word[0];
	 result = inTrie(nextNextNode, word + 2, suggestion + 2, maxEdits);
	 }
	 }*/
	if(IS_ASCII((int)word[1]))
	{
		TrieNode* nextNode = node->children[CH_INDEX(word[1])];
		if(nextNode != NULL)
		{
			TrieNode* nextNextNode = nextNode->children[CH_INDEX(word[0])];
			if(nextNextNode != NULL)
			{
				suggestion[0] = word[1];
				suggestion[1] = word[0];
				result = inTrie(nextNextNode, word + 2, suggestion + 2, maxEdits);
			}
		}
	}
	
	return result;
}
开发者ID:aidanlaw,项目名称:Unix_C,代码行数:32,代码来源:check.c

示例7: cproxy_forward_a2a_downstream

/* Do the actual work of forwarding the command from an
 * upstream ascii conn to its assigned ascii downstream.
 */
bool cproxy_forward_a2a_downstream(downstream *d) {
    assert(d != NULL);

    conn *uc = d->upstream_conn;

    assert(uc != NULL);
    assert(uc->state == conn_pause);
    assert(uc->cmd_start != NULL);
    assert(uc->thread != NULL);
    assert(uc->thread->base != NULL);
    assert(IS_ASCII(uc->protocol));
    assert(IS_PROXY(uc->protocol));

    if (cproxy_connect_downstream(d, uc->thread) > 0) {
        assert(d->downstream_conns != NULL);

        if (uc->cmd == -1) {
            return cproxy_forward_a2a_simple_downstream(d, uc->cmd_start, uc);
        } else {
            return cproxy_forward_a2a_item_downstream(d, uc->cmd, uc->item, uc);
        }
    }

    return false;
}
开发者ID:CaptTofu,项目名称:moxi,代码行数:28,代码来源:cproxy_protocol_a2a.c

示例8: __F_NAME

_WCRTLINK int __F_NAME(ispunct,iswpunct)( INTCHAR_TYPE c )
{
    if( IS_ASCII( c ) ) {
        return( IsWhat( c ) & _PUNCT );
    } else {
        return( 0 );
    }
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:8,代码来源:ispunct.c

示例9: __F_NAME

_WCRTLINK int __F_NAME(isgraph,iswgraph)( INTCHAR_TYPE c )
{
    if( IS_ASCII(c) ) {
        return( (IsWhat( c ) & (_PRINT|_SPACE)) == _PRINT );
    } else {
        return( 0 );
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:8,代码来源:isgraph.c

示例10: __F_NAME

_WCRTLINK int __F_NAME(isalpha,iswalpha)( INTCHAR_TYPE c )
{
    if( IS_ASCII( c ) ) {
        return( IsWhat( c ) & (_LOWER|_UPPER) );
    } else {
        return( 0 );
    }
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:8,代码来源:isalpha.c

示例11: __F_NAME

_WCRTLINK int __F_NAME(isspace,iswspace)( INTCHAR_TYPE c )
{
    if( IS_ASCII( c ) ) {
        return( IsWhat( c ) & _SPACE );
    } else {
        return( 0 );
    }
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:8,代码来源:isspace.c

示例12: __F_NAME

_WCRTLINK int __F_NAME(isdigit,iswdigit)( INTCHAR_TYPE c )
{
    if( IS_ASCII( c ) ) {
        return( IsWhat( c ) & _DIGIT );
    } else {
        return( 0 );
    }
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:8,代码来源:isdigit.c

示例13: cproxy_forward_a2a_downstream

/* Do the actual work of forwarding the command from an
 * upstream ascii conn to its assigned ascii downstream.
 */
bool cproxy_forward_a2a_downstream(downstream *d) {
    assert(d != NULL);

    conn *uc = d->upstream_conn;

    assert(uc != NULL);
    assert(uc->state == conn_pause);
    assert(uc->cmd_start != NULL);
    assert(uc->thread != NULL);
    assert(uc->thread->base != NULL);
    assert(IS_ASCII(uc->protocol));
    assert(IS_PROXY(uc->protocol));

    int server_index = -1;

    if (cproxy_is_broadcast_cmd(uc->cmd_curr) == true) {
        cproxy_ascii_broadcast_suffix(d);
    } else {
        char *key = NULL;
        int   key_len = 0;

        if (ascii_scan_key(uc->cmd_start, &key, &key_len) &&
            key != NULL &&
            key_len > 0) {
            server_index = cproxy_server_index(d, key, key_len, NULL);
            if (server_index < 0) {
                return false;
            }
        }
    }

    int nc = cproxy_connect_downstream(d, uc->thread, server_index);
    if (nc == -1) {
        return true;
    }

    if (nc > 0) {
        assert(d->downstream_conns != NULL);

        if (d->usec_start == 0 &&
            d->ptd->behavior_pool.base.time_stats) {
            d->usec_start = usec_now();
        }

        if (uc->cmd == -1) {
            return cproxy_forward_a2a_simple_downstream(d, uc->cmd_start, uc);
        } else {
            return cproxy_forward_a2a_item_downstream(d, uc->cmd, uc->item, uc);
        }
    }

    if (settings.verbose > 2) {
        moxi_log_write("%d: cproxy_forward_a2a_downstream connect failed\n",
                uc->sfd);
    }

    return false;
}
开发者ID:avsej,项目名称:couchbase.deb,代码行数:61,代码来源:cproxy_protocol_a2a.c

示例14: ToLowerCase_inline

// We want ToLowerCase(PRUint32) and ToLowerCaseASCII(PRUint32) to be fast
// when they're called from within the case-insensitive comparators, so we
// define inlined versions.
static NS_ALWAYS_INLINE PRUint32
ToLowerCase_inline(PRUint32 aChar)
{
  if (IS_ASCII(aChar)) {
    return gASCIIToLower[aChar];
  }

  return mozilla::unicode::GetLowercase(aChar);
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:12,代码来源:nsUnicharUtils.cpp

示例15: ToLowerCaseASCII_inline

static NS_ALWAYS_INLINE PRUint32
ToLowerCaseASCII_inline(const PRUint32 aChar)
{
  if (IS_ASCII(aChar)) {
    return gASCIIToLower[aChar];
  }

  return aChar;
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:9,代码来源:nsUnicharUtils.cpp


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