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


C++ ParseInt函数代码示例

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


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

示例1: WeightLessDepthParse

WFCB_p WeightLessDepthParse(Scanner_p in, OCB_p ocb, ProofState_p
		      state)
{
   ClausePrioFun prio_fun;
   int           fweight, vweight;
   double        max_term_multiplier, max_literal_multiplier,
                 pos_multiplier, term_depth_multiplier;
   
   AcceptInpTok(in, OpenBracket);
   prio_fun = ParsePrioFun(in);
   AcceptInpTok(in, Comma);
   fweight = ParseInt(in);
   AcceptInpTok(in, Comma);
   vweight = ParseInt(in);
   AcceptInpTok(in, Comma);
   max_term_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   max_literal_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   pos_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   term_depth_multiplier = ParseFloat(in);
   AcceptInpTok(in, CloseBracket);   
   
   return WeightLessDepthInit(prio_fun, fweight, vweight, ocb,
			      max_term_multiplier, max_literal_multiplier,
			      pos_multiplier, term_depth_multiplier);
}
开发者ID:kylepjohnson,项目名称:sigma,代码行数:28,代码来源:che_varweights.c

示例2: assert

SystemPath SystemPath::Parse(const char * const str)
{
	assert(str);

	// syspath = '('? [+-]? [0-9]+ [, +-] [0-9]+ [, +-] [0-9]+ ')'?
	// with whitespace allowed between tokens

	const char *s = str;

	int x, y, z;

	while (isspace(*s)) { ++s; }
	if (*s == '(') { ++s; }

	x = ParseInt(s); // note: ParseInt (actually, strtol) skips leading whitespace itself

	while (isspace(*s)) { ++s; }
	if (*s == ',' || *s == '.') { ++s; }

	y = ParseInt(s);

	while (isspace(*s)) { ++s; }
	if (*s == ',' || *s == '.') { ++s; }

	z = ParseInt(s);

	while (isspace(*s)) { ++s; }
	if (*s == ')') { ++s; }
	while (isspace(*s)) { ++s; }

	if (*s) // extra unexpected text after the system path
		throw SystemPath::ParseFailure();
	else
		return SystemPath(x, y, z);
}
开发者ID:AmesianX,项目名称:pioneer,代码行数:35,代码来源:SystemPath.cpp

示例3: TPTPTypeWeightParse

WFCB_p TPTPTypeWeightParse(Scanner_p in, OCB_p ocb, ProofState_p
			   state)
{
   ClausePrioFun prio_fun;
   int           fweight, vweight;
   double        max_term_multiplier, max_literal_multiplier,
                 pos_multiplier, conjecture_multiplier,
                 hypothesis_multiplier;
   
   AcceptInpTok(in, OpenBracket);
   prio_fun = ParsePrioFun(in);
   AcceptInpTok(in, Comma);
   fweight = ParseInt(in);
   AcceptInpTok(in, Comma);
   vweight = ParseInt(in);
   AcceptInpTok(in, Comma);
   max_term_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   max_literal_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   pos_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   conjecture_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   hypothesis_multiplier = ParseFloat(in);
   AcceptInpTok(in, CloseBracket);   

   return TPTPTypeWeightInit(prio_fun, fweight, vweight, ocb,
			     max_term_multiplier,
			     max_literal_multiplier, pos_multiplier,
			     conjecture_multiplier,
			     hypothesis_multiplier);
}
开发者ID:kylepjohnson,项目名称:sigma,代码行数:33,代码来源:che_varweights.c

示例4: ParseIndexTrio

    bool ParseIndexTrio( IndexTrio& trio )
    {
        SkipSpace();

        if (!IsDigitOrSign(*m_line))
        {
            return false;
        }

        trio.iPos = ParseInt();
        
        if (*(m_line++) != '/')
        {
            return true;
        }

        // look for iTex
        if (*m_line != '/')
        {
            trio.iTex = ParseInt();

            if (*(m_line++) != '/')
            {
                return true;
            }
        }

        // look for iNorm
        if (IsDigitOrSign(*m_line))
        {
            trio.iNorm = ParseInt();
        }
        return true;
    }
开发者ID:mpj500,项目名称:creepy-capsicum,代码行数:34,代码来源:OBJReader.cpp

示例5: EvalMid

void EvalMid(const void *data, qCtx *ctx, qStr *out, qArgAry *args) {
	if (args->Count() >= 2) {
		CStr tmp   = (*args)[0];
		int  index = ParseInt((*args)[1]);
		if (args->Count() >= 3) {
			int len = ParseInt((*args)[2]);
			if (abs(index) < tmp.Length()) {
				if (index >= 0) {
					out->PutS(tmp.SafeP() + index, min(tmp.Length()-index, len));
				} else {
					out->PutS(tmp.SafeP() + max(tmp.Length() + index - abs(len), 0), min(tmp.Length(), len));
				}
			}
		} else {
			if (abs(index) < tmp.Length()) {
				if (index >= 0) {
					out->PutS(tmp.SafeP() + index, tmp.Length()-index);
				} else {
					out->PutS(tmp.SafeP(), tmp.Length() + index);
				}
			}

		}
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:25,代码来源:string.cpp

示例6: ClauseOrientWeightParse

WFCB_p ClauseOrientWeightParse(Scanner_p in, OCB_p ocb, ProofState_p
				state)
{
   ClausePrioFun prio_fun;
   int fweight, vweight;
   double pos_multiplier, max_literal_multiplier,
      unorientable_literal_multiplier;

   AcceptInpTok(in, OpenBracket);
   prio_fun = ParsePrioFun(in);
   AcceptInpTok(in, Comma);
   fweight = ParseInt(in);
   AcceptInpTok(in, Comma);
   vweight = ParseInt(in);
   AcceptInpTok(in, Comma);
   unorientable_literal_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   max_literal_multiplier = ParseFloat(in);
   AcceptInpTok(in, Comma);
   pos_multiplier = ParseFloat(in);
   AcceptInpTok(in, CloseBracket);
   
   return ClauseOrientWeightInit(prio_fun, fweight, vweight, ocb,
				 unorientable_literal_multiplier,
				 max_literal_multiplier,
				 pos_multiplier);
}
开发者ID:kylepjohnson,项目名称:sigma,代码行数:27,代码来源:che_orientweight.c

示例7: ParseColor

SDL_Color ParseColor(String const& str) {
	auto parts = SplitString(str, ',');
	int r = ParseInt(parts[0]);
	int g = ParseInt(parts[1]);
	int b = ParseInt(parts[2]);
	int a = parts.size() > 3 ? ParseInt(parts[3]) : 0xff;
	return { r, g, b, a };
}
开发者ID:J0eCool,项目名称:NaNoWri2014,代码行数:8,代码来源:StringHandling.cpp

示例8: _Route_ParseRouteName

int _Route_ParseRouteName(const char *Name, void *Addr, int *SubnetBits, int *Metric)
{
	 int	type, addrlen;
	 int	ofs = 0, ilen;
	
	ENTER("sName pAddr pSubnetBits pMetric", Name, Addr, SubnetBits, Metric);

	ilen = ParseInt(Name, &type);
	if(ilen == 0) {
		LOG("Type failed to parse");
		LEAVE_RET('i', -1);
	}
	ofs += ilen;
	
	if(Name[ofs] != ':')	LEAVE_RET('i', -1);
	ofs ++;

	addrlen = IPStack_GetAddressSize(type);
	if( Addr )
	{
		if( UnHex(Addr, addrlen, Name + ofs) != addrlen )
			return -1;
	}
	ofs += addrlen*2;
	
	if(Name[ofs] != ':')	LEAVE_RET('i', -1);
	ofs ++;

	ilen = ParseInt(Name+ofs, SubnetBits);
	if(ilen == 0) {
		LOG("Subnet failed to parse");
		LEAVE_RET('i', -1);
	}
	ofs += ilen;
	
	if(Name[ofs] != ':')	LEAVE_RET('i', -1);
	ofs ++;

	ilen = ParseInt(Name+ofs, Metric);
	if(ilen == 0) {
		LOG("Metric failed to parse");
		LEAVE_RET('i', -1);
	}
	ofs += ilen;
	
	if(Name[ofs] != '\0')	LEAVE_RET('i', -1);

	LEAVE('i', type);
	return type;
}
开发者ID:AshishKumar4,项目名称:acess2,代码行数:50,代码来源:routing.c

示例9: ParseDouble

static double ParseDouble(const char *sz)
{
	bool bNegate = false;
	double dVal = 0.0;
	int iExp = 0;

	while (*sz == ' ') sz++;
	if (*sz == '+') {
		sz++;
	} else if (*sz == '-') {
		bNegate = true;
		sz++;
	}

	for (; *sz && (*sz >= '0') && (*sz <= '9'); sz++)
		dVal = dVal*10.0f + (*sz - '0');

	if (*sz == '.') {
		sz++;
		for (; *sz && (*sz >= '0') && (*sz <= '9'); sz++) {
			dVal = dVal*10.0f + (*sz - '0');
			iExp--;
		}		
	}

	if ((*sz == 'e') || (*sz == 'E') || (*sz == '^')) {
		sz++;
		iExp += ParseInt(sz);
	}
	if (bNegate) dVal = - dVal;

	return dVal * pow(10.0, iExp);
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:33,代码来源:ief_fits.cpp

示例10: EvalXTCPRecv

void EvalXTCPRecv(const void *obj, qCtx *ctx, qStr *out, qArgAry *args)
{
    Sock *s = (Sock *) obj;

    int len;
    char *line = NULL;
    if (args->Count() > 0)  {
        len = ParseInt((*args)[0]);
        len = s->Read(len);
        line = s->GetBuf();
    } else {
        len = s->ReadLine(&line);
    }

    if (len > 0)
        out->PutS(line, len);
    else if (len < 0 ) {
        if (len == Sock::ERR_TIMEOUT) {
            ctx->ThrowF(out, 702, "Timeout while waiting to read data from host %s:%d, %y", s->GetHost(), s->GetPort());
        } else {
            ctx->ThrowF(out, 702, "Error while reading data from host %s:%d, %y", s->GetHost(), s->GetPort(), GetLastError());
        }
    }

}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:25,代码来源:proto.cpp

示例11: EvalFmt

void EvalFmt(const void *data, qCtx *ctx, qStr *out, qArgAry *args) {
	CStr val = (*args)[0];

	ColFmt col; 
	memset(&col, 0, sizeof(col));

	col.dec = args->Count() > 1 ? ParseInt((*args)[1]) : 2;

	if (args->Count() > 2) {
		CStr dch = (*args)[2];
		col.dch = (dch.IsEmpty()) ? 0 : *dch;
	} else
		col.dch = '.';

	if (args->Count() > 3) {
		CStr tho = (*args)[3];
		col.tho = (tho.IsEmpty()) ? 0 : *tho;
	} else
		col.tho = ',';

	CStr res(256);
	double dval;
	const char *p = CTabFmt::NumFmt(col, val.SafeP(), res.GetBuffer(), 256, &dval);
	out->PutS(p);
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:25,代码来源:string.cpp

示例12: ParseArgs

CmdArgs ParseArgs(int argc, char *argv[]) {
  CmdArgs ret;

  optind = 1; // reset parsing

  int c, long_index;
  while ((c = getopt_long(argc, argv, "", long_opts, &long_index)) != -1) {
    if (c != 0) continue;

    if (!strcmp("config", long_opts[long_index].name)) {
      ret.config_file = optarg;
    }
    else if (!strcmp("stats-interval", long_opts[long_index].name)) {
      unsigned long stats_interval;
      if (!ParseInt(optarg, stats_interval)) {
        std::stringstream error_msg;
        error_msg << "Invalid stats-interval. Used \"" << optarg << '"';
        throw std::invalid_argument(error_msg.str());
      }
      ret.stats_interval = stats_interval;
    }
  }

  return ret;
}
开发者ID:forward32,项目名称:dpdk_dpi,代码行数:25,代码来源:cmd_args.cpp

示例13: EvalThrow

void EvalThrow(const void *data, qCtx *ctx, qStr *out, qArgAry *args) 
{
	VALID_ARGC("throw", 2, 2);
	if (args->Count()>1) {
		ctx->Throw(out, ParseInt((*args)[0]), (*args)[1]);
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:7,代码来源:core.cpp

示例14: EvalSubExpr

void EvalSubExpr(const void *data, qCtx *ctx, qStr *out, qArgAry *args) {
	CRegX *myRx = (CRegX *)data;
	int myIndex = ParseInt((*args)[0]);
	const char *sp; const char *ep;
	if (myIndex >=0 && myRx->GetMatchInfo(sp, ep, myIndex))
		out->PutS(sp, ep-sp);
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:7,代码来源:string.cpp

示例15: ParseBool

static bool ParseBool(char *s, char *e, bool *bOut)
{
    str::TrimWsEnd(s, e);
    size_t len = e - s;
    if (4 == len && str::EqNI(s, "true", 4)) {
        *bOut = true;
        return true;
    }
    if (5 == len && str::EqNI(s, "false", 5)) {
        *bOut = false;
        return true;
    }
    int64_t i;
    if (!ParseInt(s, e, &i))
        return false;
    if (0 == i) {
        *bOut = false;
        return true;
    }
    if (1 == i) {
        *bOut = true;
        return true;
    }
    return false;
}
开发者ID:kindleStudy,项目名称:sumatrapdf,代码行数:25,代码来源:SerializeTxt.cpp


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