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


C++ IsDigit函数代码示例

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


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

示例1: remove_unknown

/* remove_unknown()
 *
 * inputs	- client who gave us message, supposed sender, buffer
 * output	-
 * side effects	- kills issued for clients, squits for servers
 */
static void
remove_unknown(struct Client *client_p, const char *lsender, char *lbuffer)
{
	int slen = strlen(lsender);
	char sid[4];
	struct Client *server;

	/* meepfoo	is a nickname (ignore)
	 * #XXXXXXXX	is a UID (KILL)
	 * #XX		is a SID (SQUIT)
	 * meep.foo	is a server (SQUIT)
	 */
	if((IsDigit(lsender[0]) && slen == 3) ||
	   (strchr(lsender, '.') != NULL))
	{
		sendto_realops_snomask(SNO_DEBUG, L_ALL,
				     "Unknown prefix (%s) from %s, Squitting %s",
				     lbuffer, client_p->name, lsender);

		sendto_one(client_p,
			   ":%s SQUIT %s :(Unknown prefix (%s) from %s)",
			   get_id(&me, client_p), lsender,
			   lbuffer, client_p->name);
	}
	else if(!IsDigit(lsender[0]))
		;
	else if(slen != 9)
		sendto_realops_snomask(SNO_DEBUG, L_ALL,
				     "Invalid prefix (%s) from %s",
				     lbuffer, client_p->name);
	else
	{
		memcpy(sid, lsender, 3);
		sid[3] = '\0';
		server = find_server(NULL, sid);
		if (server != NULL && server->from == client_p)
			sendto_one(client_p, ":%s KILL %s :%s (Unknown Client)",
					get_id(&me, client_p), lsender, me.name);
	}
}
开发者ID:kamilion,项目名称:charybdis,代码行数:46,代码来源:parse.c

示例2: VolNameToFirstName

// Get the name of first volume. Return the leftmost digit of volume number.
wchar* VolNameToFirstName(const wchar *VolName,wchar *FirstName,size_t MaxSize,bool NewNumbering)
{
  if (FirstName!=VolName)
    wcsncpyz(FirstName,VolName,MaxSize);
  wchar *VolNumStart=FirstName;
  if (NewNumbering)
  {
    wchar N='1';

    // From the rightmost digit of volume number to the left.
    for (wchar *ChPtr=GetVolNumPart(FirstName);ChPtr>FirstName;ChPtr--)
      if (IsDigit(*ChPtr))
      {
        *ChPtr=N; // Set the rightmost digit to '1' and others to '0'.
        N='0';
      }
      else
        if (N=='0')
        {
          VolNumStart=ChPtr+1; // Store the position of leftmost digit in volume number.
          break;
        }
  }
  else
  {
    // Old volume numbering scheme. Just set the extension to ".rar".
    SetExt(FirstName,L"rar",MaxSize);
    VolNumStart=GetExt(FirstName);
  }
  if (!FileExist(FirstName))
  {
    // If the first volume, which name we just generated, is not exist,
    // check if volume with same name and any other extension is available.
    // It can help in case of *.exe or *.sfx first volume.
    wchar Mask[NM];
    wcsncpyz(Mask,FirstName,ASIZE(Mask));
    SetExt(Mask,L"*",ASIZE(Mask));
    FindFile Find;
    Find.SetMask(Mask);
    FindData FD;
    while (Find.Next(&FD))
    {
      Archive Arc;
      if (Arc.Open(FD.Name,0) && Arc.IsArchive(true) && Arc.FirstVolume)
      {
        wcsncpyz(FirstName,FD.Name,MaxSize);
        break;
      }
    }
  }
  return VolNumStart;
}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:53,代码来源:pathfn.cpp

示例3: while

Stack<Error>* Corrector::CheckExpression(Lexema *input) {
	int i = 0;
	int count_bracket = 0;
	while (input[i].GetType() != Type_Lexems::terminal) {
		if (IsDigit(input[i])) {
			if(IsDigitRight(input[i]) == false){
				AddError(input[i].GetPosition(), "Ошибка в числе. Позиция ошибки: ");
			}
		}
		if (IsBinaryOperaion(input[i]))
		{
			if (input[i+1].GetType() == Type_Lexems::terminal)
			{
				AddError(input[i].GetPosition(), "Ошибка в бинарной операции. Позиция ошибки: ");
			}
			if (input[i + 1].GetType() != Type_Lexems::terminal && IsBinaryOperaion(input[i+1])) {
				AddError(input[i].GetPosition(), "Ошибка в повторе бинарной операций. Позиция ошибки: ");
			}
			if (input[i + 1].GetType() != Type_Lexems::terminal && input[i + 1].GetType() == Type_Lexems::close_bracket) {
				AddError(input[i].GetPosition(), "Ошибка в бинарной операции, пропущен аргумент. Позиция ошибки: ");
			}
		}
		if (IsOperationUnary(input[i]))
		{
			if (input[i + 1].GetType() == Type_Lexems::terminal) {
				AddError(input[i].GetPosition(), "Ошибка в унарной операции. Позиция ошибки: ");
			}
			if (input[i + 1].GetType() != Type_Lexems::terminal && input[i + 1].GetType() == Type_Lexems::close_bracket)
			{
				AddError(input[i].GetPosition(), "Ошибка в унарной операции, пропущен аргумент. Позиция ошибки: ");
			}
		}
		if (IsOpenBracket(input[i]))
		{
			count_bracket++;
		}
		if (IsCloseBracket(input[i]))
		{
			count_bracket--;
			if (count_bracket<0)
			{
				AddError(input[i].GetPosition(), "Ошибка в закрывающей скобке. Позиция ошибки: ");
			}
		}
		i++;
	}
	if (count_bracket != 0)
	{
		AddError("Ошибка в скобках.");
	}
	return &errors;
}
开发者ID:SemenBevzuk,项目名称:mp2-lab3-arithmetic,代码行数:52,代码来源:corrector.cpp

示例4: xl_eval

static int xl_eval(definition *def_ptr, char *val)
{
	if (!val)
		panic("Null value found in evaluation!");
	if (IsDigit(val[0])) {
		if (val[0] == '~')
			return ~xl_eval(def_ptr, &val[1]);
		if (val[1] == '-')
			return -xl_eval(def_ptr, &val[1]);
		if ((val[0] == '0') && (val[1] == 'x')) {
			/* Hexadecimal. */
			int num = 0;
			int pos = 2;
			
			while (val[pos]) {
				num = num << 4;
				if (isdigit(((int) val[pos])))
					num += (val[pos] - '0');
				else {
					num += (((val[pos] - 'A') & 0x1f)
						+ 10);
					if ((val[pos] < 'A')
					    || (val[pos] > 'f'))
						panic(("Invalid hex value "
						       "`%s'."),
						      val);
					if ((val[pos] & 0x1f) > 5)
						panic(("Invalid hex value "
						       "`%s'."),
						      val);
				}
				pos++;
			}
			return num;
		} else
			return atoi(val);
		
	} else {
		int ref = aoi_name(def_ptr, val, NO_CREATE);
		aoi_type bind = outaoi.defs.defs_val[ref].binding;
		
		if (ref < 0)
			panic("Undefined const `%s'.", val);
		if (bind->kind != AOI_CONST)
			panic("Invalid type found in evaluation.");
		if (bind->aoi_type_u_u.const_def.value->kind != AOI_CONST_INT)
			panic("Invalid const type found in evaluation.");
		
		return (bind->aoi_type_u_u.const_def.value->aoi_const_u_u.
			const_int);
	}
}
开发者ID:berkus,项目名称:flick,代码行数:52,代码来源:xlate.c

示例5: MeasureTokenLength

	void MeasureTokenLength()
	{
		if(IsNameChar(*m_pNext))
		{
			for(m_len = 1; IsNameChar(m_pNext[m_len]) || IsDigit(m_pNext[m_len]); m_len++)
			{
			}
			m_type = name;
		}
		else if(IsDigit(*m_pNext) || *m_pNext == '.')
		{
			int exps = 0;
			int decimals = 0;
			if(*m_pNext == '.')
				decimals++;
			for(m_len = 1; m_pNext[m_len] != '\0'; m_len++)
			{
				if(IsDigit(m_pNext[m_len]))
					continue;
				if(m_pNext[m_len] == '.' && decimals == 0 && exps == 0)
				{
					decimals++;
					continue;
				}
				if(m_pNext[m_len] == 'e' && IsDigit(m_pNext[m_len + 1]) && exps == 0)
				{
					exps++;
					continue;
				}
				break;
			}
			m_type = number;
		}
		else
		{
			m_len = 1;
			m_type = symbol;
		}
	}
开发者ID:kslazarev,项目名称:waffles,代码行数:39,代码来源:GFunction.cpp

示例6: GetNum

char GetNum()
{
    char c = Look;

    if( !IsDigit(Look)) {
        sprintf(tmp, "Integer");
        Expected(tmp);
    }

    GetChar();

    return c;
}
开发者ID:GoAwayPeter,项目名称:BasicParser,代码行数:13,代码来源:cradle.c

示例7: return

bool CSocketAddressIP::SetHostStr( LPCTSTR pszHostName )
{
	// try to resolve the host name with DNS for the true ip address.
	if ( pszHostName[0] == '\0' )
		return( false );
	if ( IsDigit( pszHostName[0] ))
	{
		SetAddrStr( pszHostName ); // 0.1.2.3
		return( true );
	}
	// NOTE: This is a blocking call !!!!
	return SetHostStruct( gethostbyname( pszHostName ));
}
开发者ID:MortalROs,项目名称:Source,代码行数:13,代码来源:CSocket.cpp

示例8: ParseSeqId

// The <seq-id> is a sequence number in base 36,
// using digits and upper case letters
static bool ParseSeqId(State *state) {
  const char *p = state->mangled_cur;
  for (;*p != '\0'; ++p) {
    if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) {
      break;
    }
  }
  if (p != state->mangled_cur) {  // Conversion succeeded.
    state->mangled_cur = p;
    return true;
  }
  return false;
}
开发者ID:lengerrong,项目名称:SimpleMallocTrace,代码行数:15,代码来源:Demangle.cpp

示例9: Asn1ToDate

Date Asn1ToDate(ASN1_STRING *time)
{
	if(!time) return Null;
	int digit = 0;
	while(digit < time->length && IsDigit(time->data[digit]))
		digit++;
	if(digit < 6)
		return Null;
	int year2 = time->data[0] * 10 + time->data[1] - 11 * '0';
	int month = time->data[2] * 10 + time->data[3] - 11 * '0';
	int day   = time->data[4] * 10 + time->data[5] - 11 * '0';
	return Date(year2 + (year2 < 90 ? 2000 : 1900), month, day);
}
开发者ID:koz4k,项目名称:soccer,代码行数:13,代码来源:Util.cpp

示例10: operator

	virtual bool operator()(int pos, const RichPara& para)// A++ bug here....
	{
		if(!IsNull(para.format.label)) {
			AddLinkRef(link, para.format.label);
			ref.FindAdd(para.format.label);
		}
		for(int i = 0; i < para.part.GetCount(); i++)
			if(para.part[i].IsText()) {
				const wchar *s = para.part[i].text;
				for(;;) {
					while(!IsLetter(*s) && !IsDigit(*s) && *s)
						s++;
					if(*s == '\0')
						break;
					StringBuffer sb;
					while(IsLetter(*s) || IsDigit(*s))
						sb.Cat(ToAscii(ToLower(*s++)));
					words.FindAdd(TopicWordIndex(sb));
				}
			}
		return false;
	}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:22,代码来源:TopicBase.cpp

示例11: ParseDigits

static int ParseDigits(char **ppText)
{
	char *p=*ppText;
	int Value=0;

	SkipSpaces(&p);
	while (IsDigit(*p)) {
		Value=Value*10+(*p-'0');
		p++;
	}
	*ppText=p;
	return Value;
}
开发者ID:ChenglongWang,项目名称:TVTest,代码行数:13,代码来源:ChannelList.cpp

示例12: IsStrNumericDec

bool IsStrNumericDec( lpctstr pszTest )
{
	if ( !pszTest || !*pszTest )
		return false;

	do
	{
		if ( !IsDigit(*pszTest) )
			return false;
	}
	while ( *(++pszTest) );

	return true;
}
开发者ID:Sphereserver,项目名称:Source2,代码行数:14,代码来源:CExpression.cpp

示例13: ReadString

	JsonValue * JsonParser::ReadValue(JsonValue * parent)
	{
		if (*cur_ == '"')
		{
			return ReadString(parent);
		}
		else if (IsDigit(*cur_) || *cur_ == '-')
		{
			return ReadNumber(parent);
		}
		else if (IsAlpha(*cur_))
		{
			std::string keyword;
			ParseIdentifier(keyword);

			if (keyword == "null")
			{
				return 0;
			}
			if (keyword == "true")
			{
				return new JsonBooleanValue(parent, true);
			}
			else if (keyword == "false")
			{
				return new JsonBooleanValue(parent, false);
			}
			else
			{
				throw Error(
					row_,
					column_ - keyword.length(),
					FormatString("Invalid bareword \"%s\", while value expected", keyword.c_str())
				);
			}
		}
		else if (*cur_ == '[')
		{
			return ReadArray(parent);
		}
		else if (*cur_ == '{')
		{
			return ReadObject(parent);
		}
		else
		{
			RaiseError("Invalid symbol, while value expected");
			return 0;
		}
	}
开发者ID:haroldzmli,项目名称:cuboid,代码行数:50,代码来源:JsonParser.cpp

示例14: Factor

// <factor>          ::= <number_literal> | <identifier> | ( <bool_expression> )
void Factor(CPU *cpu, Files file){
    if(Peek('(', file)){
        Match('(', file);
        Boolean::Expression(cpu, file);
        Match(')', file);
    }
    else if(IsDigit(Peek())){
        cpu->LoadNumber(GetNumber(file));
    }
    else if(IsAlpha(Peek()))
        Identifier(cpu, file);
    else
        Abort("Internal Error. FIXME!", file);
}
开发者ID:FlyingJester,项目名称:EmeraldC,代码行数:15,代码来源:math_expression.cpp

示例15: SetupLexer

void SetupLexer()
{
	int i;

	for (i = 0; i < END_OF_FILE + 1; i++)
	{
		if (IsLetter(i))
		{
			Scanners[i] = ScanIdentifier;
		}
		else if (IsDigit(i))
		{
			Scanners[i] = ScanNumericLiteral;
		}
		else
		{
			Scanners[i] = ScanBadChar;
		}
	}

	Scanners[END_OF_FILE] = ScanEOF;
	Scanners['\''] = ScanCharLiteral;
	Scanners['"']  = ScanStringLiteral;
	Scanners['+']  = ScanPlus;
	Scanners['-']  = ScanMinus;
	Scanners['*']  = ScanStar;
	Scanners['/']  = ScanSlash;
    Scanners['%']  = ScanPercent;
	Scanners['<']  = ScanLess;
	Scanners['>']  = ScanGreat;
	Scanners['!']  = ScanExclamation;
	Scanners['=']  = ScanEqual;
	Scanners['|']  = ScanBar;
	Scanners['&']  = ScanAmpersand;
	Scanners['^']  = ScanCaret;
	Scanners['.']  = ScanDot;
	Scanners['{']  = ScanLBRACE;
	Scanners['}']  = ScanRBRACE;
	Scanners['[']  = ScanLBRACKET;
	Scanners[']']  = ScanRBRACKET;
	Scanners['(']  = ScanLPAREN;
	Scanners[')']  = ScanRPAREN;
	Scanners[',']  = ScanCOMMA;
	Scanners[';']  = ScanSEMICOLON;
	Scanners['~']  = ScanCOMP;
	Scanners['?']  = ScanQUESTION;
	Scanners[':']  = ScanCOLON;
	Scanners['#']  = ScanHASH;
    Scanners['\n'] = ScanNewLine;
}
开发者ID:gyc2015,项目名称:GYC,代码行数:50,代码来源:lex.c


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