• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ParseInt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: EvalDir

void EvalDir(const void *data, qCtx *ctx, qStr *out, qArgAry *args)
{
	VALID_ARGC("dir", 2, 3);

	CStr path = (*args)[0];

	if (!path) {
		ctx->ThrowF(out, 601, "Empty directory path is invalid");
		return;
	}

	if (!safe_fcheck(ctx, path, 'r')) {
		ctx->ThrowF(out, 601, "Failed to open directory. %y", GetLastError());
		return;
	}

	CStr body = args->GetAt(1);
	int mask = 0;
	if (args->Count() > 2) {
		mask = ParseInt((*args)[2]);
	}

	if (!mask)
		mask = -1;

	ScanDir(path, mask, body, ctx, out);
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:27,代码来源:file.cpp


示例17: while

void RawParser::ParseCompBlock(int nDstComp)
{
	do {
		if (!ParseToken(sz)) return;
	} while (*sz != '{');

	DWORD nComp = 0;
	for (; nComp < nComps; nComp++)
		if (Comps[nComp].nDstComp == nDstComp)
			break;
	if (nComps == 4) {
		do {
			if (!ParseToken(sz)) return;
		} while (*sz != '}');
		return;
	}
	if (nComp == nComps) nComps++;

	Comps[nComp].nDstComp = nDstComp;

	while (!EndOfScript()) {

		// Get command token
		bool bMore;
		if (!ParseToken(sz, &bMore)) return;

		if (*sz == '}') return;				// End of block?

		// Handle commands
		if        (_strcmpi(sz, "file") == 0) {

			if (bMore) ParseFileString(Comps[nComp].szFile, &bMore);

		} else if (_strcmpi(sz, "start") == 0) {

			if (bMore) ParseInt(Comps[nComp].nStart, &bMore);

		} else if (_strcmpi(sz, "delta") == 0) {

			if (bMore) ParseInt(Comps[nComp].nDelta, &bMore);

		}

		// Remove any unparsed command parameters
		while (bMore) ParseToken(sz, &bMore);
	}
}
开发者ID:FMJ-Software,项目名称:ieCpp,代码行数:47,代码来源:ief_raw.cpp


示例18: TRACE_ERR

void Data::loadNBest(const string &file, bool oneBest)
{
  TRACE_ERR("loading nbest from " << file << endl);
  util::FilePiece in(file.c_str());

  ScoreStats scoreentry;
  string sentence, feature_str, alignment;
  int sentence_index;

  while (true) {
    try {
      StringPiece line = in.ReadLine();
      if (line.empty()) continue;
      // adding statistics for error measures
      scoreentry.clear();

      util::TokenIter<util::MultiCharacter> it(line, util::MultiCharacter("|||"));

      sentence_index = ParseInt(*it);
      if (oneBest && m_score_data->exists(sentence_index)) continue;
      ++it;
      sentence = it->as_string();
      ++it;
      feature_str = it->as_string();
      ++it;

      if (it) {
        ++it;                             // skip model score.

        if (it) {
          alignment = it->as_string(); //fifth field (if present) is either phrase or word alignment
          ++it;
          if (it) {
            alignment = it->as_string(); //sixth field (if present) is word alignment
          }
        }
      }
      //TODO check alignment exists if scorers need it

      if (m_scorer->useAlignment()) {
        sentence += "|||";
        sentence += alignment;
      }
      m_scorer->prepareStats(sentence_index, sentence, scoreentry);

      m_score_data->add(scoreentry, sentence_index);

      // examine first line for name of features
      if (!existsFeatureNames()) {
        InitFeatureMap(feature_str);
      }
      AddFeatures(feature_str, sentence_index);
    } catch (util::EndOfFileException &e) {
      PrintUserTime("Loaded N-best lists");
      break;
    }
  }
}
开发者ID:840462307cn,项目名称:mosesdecoder,代码行数:58,代码来源:Data.cpp


示例19: EvalDup

void EvalDup(const void *data, qCtx *ctx, qStr *out, qArgAry *args) {
	if (args->Count() >= 2) {
		CStr str = (*args)[0];
		int dup;
		for (dup = ParseInt((*args)[1]); dup > 0; --dup) {
			out->PutS(str);
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:9,代码来源:string.cpp


示例20: EvalSkipTokens

void EvalSkipTokens(int *skip, qCtx *ctx, qStr *out, qArgAry *args)
{
	if (args->Count() >= 0) {
		int tmp = ParseInt((*args)[0]);
		if (tmp >= 0) {
			*skip = tmp;
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:9,代码来源:string.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ParseLine函数代码示例发布时间:2022-05-30
下一篇:
C++ ParseHex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap