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


C++ IsAlpha函数代码示例

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


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

示例1: assert

// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The
// "assign" optimization removes over 10% of the execution time.
//
const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
{
	// Oddly, not supported on some comilers,
	//name->clear();
	// So use this:
	*name = "";
	assert( p );

	// Names start with letters or underscores.
	// Of course, in unicode, tinyxml has no idea what a letter *is*. The
	// algorithm is generous.
	//
	// After that, they can be letters, underscores, numbers,
	// hyphens, or colons. (Colons are valid ony for namespaces,
	// but tinyxml can't tell namespaces from names.)
	if (    p && *p 
		 && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
	{
		const char* start = p;
		while(		p && *p
				&&	(		IsAlphaNum( (unsigned char ) *p, encoding ) 
						 || *p == '_'
						 || *p == '-'
						 || *p == '.'
						 || *p == ':' ) )
		{
			//(*name) += *p; // expensive
			++p;
		}
		if ( p-start > 0 ) {
			name->assign( start, p-start );
		}
		return p;
	}
	return 0;
}
开发者ID:hihua,项目名称:hihuacode,代码行数:39,代码来源:tinyxmlparser.cpp

示例2: CharFilterAlpha

int CharFilterAlpha(int c)
{
	return IsAlpha(c) ? c : 0;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:4,代码来源:StrUtil.cpp

示例3: SkipWhiteSpace

MDBXMLNode* MDBXMLNode::Identify( const char* p, MDBXMLEncoding encoding )
{
	MDBXMLNode* returnNode = 0;

	p = SkipWhiteSpace( p, encoding );
	if( !p || !*p || *p != '<' )
	{
		return 0;
	}

	MDBXMLDocument* doc = GetDocument();
	p = SkipWhiteSpace( p, encoding );

	if ( !p || !*p )
	{
		return 0;
	}

	// What is this thing? 
	// - Elements start with a letter or underscore, but xml is reserved.
	// - Comments: <!--
	// - Decleration: <?xml
	// - Everthing else is unknown to tinyxml.
	//

	const char* xmlHeader = { "<?xml" };
	const char* commentHeader = { "<!--" };
	const char* dtdHeader = { "<!" };
	const char* cdataHeader = { "<![CDATA[" };

	if ( StringEqual( p, xmlHeader, true, encoding ) )
	{
		#ifdef DEBUG_PARSER
			MDBXML_LOG( "XML parsing Declaration\n" );
		#endif
		returnNode = new MDBXMLDeclaration();
	}
	else if ( StringEqual( p, commentHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			MDBXML_LOG( "XML parsing Comment\n" );
		#endif
		returnNode = new MDBXMLComment();
	}
	else if ( StringEqual( p, cdataHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			MDBXML_LOG( "XML parsing CDATA\n" );
		#endif
		MDBXMLText* text = new MDBXMLText( "" );
		text->SetCDATA( true );
		returnNode = text;
	}
	else if ( StringEqual( p, dtdHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			MDBXML_LOG( "XML parsing Unknown(1)\n" );
		#endif
		returnNode = new MDBXMLUnknown();
	}
	else if (    IsAlpha( *(p+1), encoding )
			  || *(p+1) == '_' )
	{
		#ifdef DEBUG_PARSER
			MDBXML_LOG( "XML parsing Element\n" );
		#endif
		returnNode = new MDBXMLElement( "" );
	}
	else
	{
		#ifdef DEBUG_PARSER
			MDBXML_LOG( "XML parsing Unknown(2)\n" );
		#endif
		returnNode = new MDBXMLUnknown();
	}

	if ( returnNode )
	{
		// Set the parent, so it can report errors
		returnNode->parent = this;
	}
	else
	{
		if ( doc )
			doc->SetError( MDBXML_ERROR_OUT_OF_MEMORY, 0, 0, MDBXML_ENCODING_UNKNOWN );
	}
	return returnNode;
}
开发者ID:alienyu9527,项目名称:QMDB81,代码行数:88,代码来源:mdbXMLParser.cpp

示例4: IsAlNum

bool IsAlNum(char c)
{
    return IsAlpha(c) || IsDigit(c);
}
开发者ID:A-deLuna,项目名称:Let-s-build-a-compiler,代码行数:4,代码来源:cradle.c

示例5: GetNumber

static UInt GetNumber(Int readDecimalPoint)
{
  UInt symbol = S_ILLEGAL;
  UInt i = 0;
  Char c;
  UInt seenADigit = 0;
  UInt seenExp = 0;
  UInt seenExpDigit = 0;

  STATE(ValueObj) = 0;

  c = PEEK_CURR_CHAR();
  if (readDecimalPoint) {
    STATE(Value)[i++] = '.';
  }
  else {
    // read initial sequence of digits into 'Value'
    while (IsDigit(c)) {
      i = AddCharToValue(i, c);
      seenADigit = 1;
      c = GET_NEXT_CHAR();
    }

    // maybe we saw an identifier character and realised that this is an
    // identifier we are reading
    if (IsIdent(c) || c == '\\') {
      // if necessary, copy back from STATE(ValueObj) to STATE(Value)
      if (STATE(ValueObj)) {
        i = GET_LEN_STRING(STATE(ValueObj));
        GAP_ASSERT(i >= MAX_VALUE_LEN - 1);
        memcpy(STATE(Value), CONST_CSTR_STRING(STATE(ValueObj)), MAX_VALUE_LEN);
        STATE(ValueObj) = 0;
      }
      // this looks like an identifier, scan the rest of it
      return GetIdent(i);
    }

    // Or maybe we saw a '.' which could indicate one of two things: a
    // float literal or S_DOT, i.e., '.' used to access a record entry.
    if (c == '.') {
      GAP_ASSERT(i < MAX_VALUE_LEN - 1);

      // If the symbol before this integer was S_DOT then we must be in
      // a nested record element expression, so don't look for a float.
      // This is a bit fragile
      if (STATE(Symbol) == S_DOT || STATE(Symbol) == S_BDOT) {
        symbol = S_INT;
        goto finish;
      }

      // peek ahead to decide which
      if (PEEK_NEXT_CHAR() == '.') {
        // It was '.', so this looks like '..' and we are probably
        // inside a range expression.
        symbol = S_INT;
        goto finish;
      }

      // Now the '.' must be part of our number; store it and move on
      i = AddCharToValue(i, '.');
      c = GET_NEXT_CHAR();
    }

    else {
      // Anything else we see tells us that the token is done
      symbol = S_INT;
      goto finish;
    }
  }


  // When we get here we have read possibly some digits, a . and possibly
  // some more digits, but not an e,E,d,D,q or Q

    // read digits
    while (IsDigit(c)) {
      i = AddCharToValue(i, c);
      seenADigit = 1;
      c = GET_NEXT_CHAR();
    }
    if (!seenADigit)
      SyntaxError("Badly formed number: need a digit before or after the "
                  "decimal point");
    if (c == '\\')
      SyntaxError("Badly formed number");

    // If we found an identifier type character in this context could be an
    // error or the start of one of the allowed trailing marker sequences
    if (IsIdent(c) && c != 'e' && c != 'E' && c != 'd' && c != 'D' &&
        c != 'q' && c != 'Q') {

      // Allow one letter on the end of the numbers -- could be an i, C99
      // style
      if (IsAlpha(c)) {
        i = AddCharToValue(i, c);
        c = GET_NEXT_CHAR();
      }
      // independently of that, we allow an _ signalling immediate conversion
      if (c == '_') {
        i = AddCharToValue(i, c);
//.........这里部分代码省略.........
开发者ID:cdwensley,项目名称:gap,代码行数:101,代码来源:scanner.c

示例6: CfgNextTok

void CfgNextTok (void)
/* Read the next token from the input stream */
{
    unsigned I;


Again:
    /* Skip whitespace */
    while (isspace (C)) {
     	NextChar ();
    }

    /* Remember the current position */
    CfgErrorLine = InputLine;
    CfgErrorCol  = InputCol;

    /* Identifier? */
    if (C == '_' || IsAlpha (C)) {

	/* Read the identifier */
	I = 0;
	while (C == '_' || IsAlNum (C)) {
	    if (I < CFG_MAX_IDENT_LEN) {
	        CfgSVal [I++] = C;
	    }
	    NextChar ();
     	}
	CfgSVal [I] = '\0';
     	CfgTok = CFGTOK_IDENT;
	return;
    }

    /* Hex number? */
    if (C == '$') {
	NextChar ();
	if (!isxdigit (C)) {
	    Error ("%s(%u): Hex digit expected", CfgName, InputLine);
	}
	CfgIVal = 0;
	while (isxdigit (C)) {
       	    CfgIVal = CfgIVal * 16 + DigitVal (C);
	    NextChar ();
	}
	CfgTok = CFGTOK_INTCON;
	return;
    }

    /* Decimal number? */
    if (isdigit (C)) {
	CfgIVal = 0;
	while (isdigit (C)) {
       	    CfgIVal = CfgIVal * 10 + DigitVal (C);
	    NextChar ();
	}
	CfgTok = CFGTOK_INTCON;
	return;
    }

    /* Other characters */
    switch (C) {

	case '{':
	    NextChar ();
	    CfgTok = CFGTOK_LCURLY;
	    break;

	case '}':
	    NextChar ();
	    CfgTok = CFGTOK_RCURLY;
	    break;

	case ';':
	    NextChar ();
     	    CfgTok = CFGTOK_SEMI;
	    break;

	case '.':
	    NextChar ();
            if (C == '.') {
                NextChar ();
                CfgTok = CFGTOK_DOTDOT;
            } else {
	        CfgTok = CFGTOK_DOT;
            }
	    break;

	case ',':
	    NextChar ();
	    CfgTok = CFGTOK_COMMA;
	    break;

	case '=':
	    NextChar ();
	    CfgTok = CFGTOK_EQ;
	    break;

        case ':':
	    NextChar ();
	    CfgTok = CFGTOK_COLON;
     	    break;
//.........这里部分代码省略.........
开发者ID:eakmeister,项目名称:cc65,代码行数:101,代码来源:scanner.c

示例7: AsmInc

void AsmInc (const char* Filename, char CommentStart, int IgnoreUnknown)
/* Read an assembler include file */
{
    char        Buf[1024];
    char*       L;
    const char* Comment;
    unsigned    Line;
    unsigned	Len;
    long        Val;
    unsigned    DVal;
    int         Sign;
    unsigned    Base;
    unsigned    Digits;
    StrBuf      Ident = STATIC_STRBUF_INITIALIZER;

    /* Try to open the file for reading */
    FILE* F = fopen (Filename, "r");
    if (F == 0) {
        Error ("Cannot open asm include file \"%s\": %s",
               Filename, strerror (errno));
    }

    /* Read line by line, check for NAME = VALUE lines */
    Line = 0;
    while ((L = fgets (Buf, sizeof (Buf), F)) != 0) {

        /* One more line read */
        ++Line;

        /* Ignore leading white space */
        while (IsBlank (*L)) {
            ++L;
        }

	/* Remove trailing whitespace */
	Len = strlen (L);
	while (Len > 0 && IsSpace (L[Len-1])) {
	    --Len;
	}
	L[Len] = '\0';

        /* If the line is empty or starts with a comment char, ignore it */
        if (*L == '\0' || *L == CommentStart) {
            continue;
        }

        /* Read an identifier */
        SB_Clear (&Ident);
        if (IsAlpha (*L) || *L == '_') {
            SB_AppendChar (&Ident, *L++);
            while (IsAlNum (*L) || *L == '_') {
                SB_AppendChar (&Ident, *L++);
            }
            SB_Terminate (&Ident);
        } else {
            if (!IgnoreUnknown) {
                Error ("%s(%u): Syntax error", Filename, Line);
            }
            continue;
        }

        /* Ignore white space */
        L = SkipWhitespace (L);

        /* Check for := or = */
        if (*L == '=') {
            ++L;
        } else if (*L == ':' && *++L == '=') {
            ++L;
        } else {
	    if (!IgnoreUnknown) {
	       	Error ("%s(%u): Missing `='", Filename, Line);
	    }
	    continue;
	}

        /* Allow white space once again */
        L = SkipWhitespace (L);

        /* A number follows. Read the sign. */
        if (*L == '-') {
            Sign = -1;
            ++L;
        } else {
            Sign = 1;
            if (*L == '+') {
                ++L;
            }
        }

        /* Determine the base of the number. Allow $ and % as prefixes for
         * hex and binary numbers respectively.
         */
        if (*L == '$') {
            Base = 16;
            ++L;
        } else if (*L == '%') {
            Base = 2;
            ++L;
        } else {
//.........这里部分代码省略.........
开发者ID:Aliandrana,项目名称:snesdev,代码行数:101,代码来源:asminc.c

示例8: IsAlpha

bool CgaLexer::IsAlphaNumeric(char c)
{
	return IsAlpha(c) || IsDigit(c);
}
开发者ID:coderespawn,项目名称:cga-parser,代码行数:4,代码来源:CgaLexer.cpp

示例9: IsAlphaOrUnderscore

static inline bool IsAlphaOrUnderscore(char c) {
  return IsAlpha(c) || (c == '_');
}
开发者ID:asoffer,项目名称:Icarus,代码行数:3,代码来源:Lexer.cpp

示例10: IsAlphaNumeric

static inline bool IsAlphaNumeric(char c) { return IsAlpha(c) || IsDigit(c); }
开发者ID:asoffer,项目名称:Icarus,代码行数:1,代码来源:Lexer.cpp

示例11: FormatStopwatch

	static String FormatStopwatch(int64 us, const String& format)
	{
		String result, keyPattern;

		if (us < 0)
		{
			result.push_back(U'-');

			us = -us;
		}

		bool inQuot = false;

		char32 previousChar = U'\0';

		for (size_t i = 0; i < format.length(); ++i)
		{
			const char32 ch = format[i];

			if (IsAlpha(ch))
			{
				if (inQuot)
				{
					result.push_back(ch);
				}
				else
				{
					if (keyPattern.isEmpty() || ch == previousChar)
					{
						keyPattern.push_back(ch);
					}
					else
					{
						result.append(GetFormattedElement(us, keyPattern));
						keyPattern.clear();
						keyPattern.push_back(ch);
					}
				}
			}
			else
			{
				if (!keyPattern.isEmpty())
				{
					result.append(GetFormattedElement(us, keyPattern));
					keyPattern.clear();
				}

				if (ch == U'\'')
				{
					if (format[i + 1] == U'\'')
					{
						result.push_back(U'\'');

						++i;

						continue;
					}

					inQuot = !inQuot;
				}
				else
				{
					result.push_back(ch);
				}
			}

			previousChar = ch;
		}

		if (!keyPattern.isEmpty())
		{
			result.append(GetFormattedElement(us, keyPattern));
		}

		return result;
	}
开发者ID:azaika,项目名称:OpenSiv3D,代码行数:76,代码来源:SivStopwatch.cpp

示例12: IsAlphaNumberic

 /**
  * @brief Checks if current character is alphanumeric (a-z|0-9).
  *
  * @return
  */
 bool IsAlphaNumberic() const {
     return IsAlpha() || IsRange('0', '9');
 }
开发者ID:05storm26,项目名称:codelite,代码行数:8,代码来源:CMakeParser.cpp

示例13: return

bool wxSimpleHtmlParser::IsWord()
{
    return (IsAlpha(GetChar(m_pos)));
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:4,代码来源:htmlparser.cpp

示例14: CharFilterAlphaToLower

int CharFilterAlphaToLower(int c)
{
	return IsAlpha(c) ? IsLower(c) ? c : ToLower(c) : 0;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:4,代码来源:StrUtil.cpp

示例15: CharFilterAlphaToUpper

int CharFilterAlphaToUpper(int c)
{
	return IsAlpha(c) ? IsUpper(c) ? c : ToUpper(c) : 0;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:4,代码来源:StrUtil.cpp


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