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


C++ ParseFloat函数代码示例

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


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

示例1: 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

示例2: ParseVec2

 void ParseVec2(std::vector<Vec2>& buffer)
 {
     Vec2 v;
     v.x = ParseFloat();
     v.y = ParseFloat();
     buffer.push_back(v);
 }
开发者ID:mpj500,项目名称:creepy-capsicum,代码行数:7,代码来源:OBJReader.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: ParseVector3f

	sf::Vector3f ParseVector3f(const std::string theValue, const sf::Vector3f theDefault)
	{
		sf::Vector3f anResult = theDefault;

		// Try to find the first comma
		size_t anComma1Offset = theValue.find_first_of(',', 0);
		if(anComma1Offset != std::string::npos)
		{
			float anX = ParseFloat(theValue.substr(0, anComma1Offset), theDefault.x);

			// Try to find the next comma
			size_t anComma2Offset = theValue.find_first_of(',',anComma1Offset+1);
			if(anComma2Offset != std::string::npos)
			{
				float anY = ParseFloat(theValue.substr(anComma1Offset+1, anComma2Offset), theDefault.y);
				float anZ = ParseFloat(theValue.substr(anComma2Offset+1), theDefault.z);

				// Now that all 3 values have been parsed, return the Vector3f found
				anResult.x = anX;
				anResult.y = anY;
				anResult.z = anZ;
			}
		}

		// Return the result found or theDefault assigned above
		return anResult;
	}
开发者ID:adrigm,项目名称:Generic-Game-Engine,代码行数:27,代码来源:StringUtil.cpp

示例5: NumFeaturesParse

Features_p NumFeaturesParse(Scanner_p in)
{
   Features_p handle = FeaturesAlloc();
   long i;

   AcceptInpId(in, "PA");
   AcceptInpTok(in, Colon);
   handle->pred_max_arity = parse_sig_distrib(in,
					      handle->pred_distrib);

   AcceptInpId(in, "FA");
   AcceptInpTok(in, Colon);
   handle->func_max_arity = parse_sig_distrib(in,
					      handle->func_distrib);
   AcceptInpTok(in, OpenBracket);
   handle->features[0] = ParseFloat(in);
   for(i=1; i< FEATURE_NUMBER; i++)
   {
      AcceptInpTok(in, Comma);
      handle->features[i] = ParseFloat(in);
   }
   AcceptInpTok(in, CloseBracket);

   return handle;
}
开发者ID:kylepjohnson,项目名称:sigma,代码行数:25,代码来源:cle_numfeatures.c

示例6: 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

示例7: throw

novatel_gps_msgs::GpgsaPtr novatel_gps_driver::GpgsaParser::ParseAscii(const novatel_gps_driver::NmeaSentence& sentence) throw(ParseException)
{
  // Check the length first -- should be 18 elements long
  const size_t LENGTH = 18;
  if (sentence.body.size() != LENGTH)
  {
    std::stringstream error;
    error << "Expected GPGSA length " << LENGTH
          << ", actual length " << sentence.body.size();
    throw ParseException(error.str());
  }

  novatel_gps_msgs::GpgsaPtr msg = boost::make_shared<novatel_gps_msgs::Gpgsa>();
  msg->message_id = sentence.body[0];
  msg->auto_manual_mode = sentence.body[1];
  ParseUInt8(sentence.body[2], msg->fix_mode);
  // Words 3-14 of the sentence are SV IDs. Copy only the non-null strings.
  msg->sv_ids.resize(12, 0);
  size_t n_svs = 0;
  for (std::vector<std::string>::const_iterator id = sentence.body.begin()+3; id < sentence.body.begin()+15; ++id)
  {
    if (! id->empty())
    {
      ParseUInt8(*id, msg->sv_ids[n_svs]);
      ++n_svs;
    }
  }
  msg->sv_ids.resize(n_svs);

  ParseFloat(sentence.body[15], msg->pdop);
  ParseFloat(sentence.body[16], msg->hdop);
  ParseFloat(sentence.body[17], msg->vdop);
  return msg;
}
开发者ID:lardemua,项目名称:drivers,代码行数:34,代码来源:gpgsa.cpp

示例8: ParseFloat

   glm::vec3
   POVRayParser::ParseVec3FromStream(std::istringstream& tokens)
   {
      std::string token;

      std::getline(tokens, token, ',');
      float x = ParseFloat(token);

      std::getline(tokens, token, ',');
      float y = ParseFloat(token);

      std::getline(tokens, token, '>');
      float z = ParseFloat(token);

      return glm::vec3(x, y, z);
   }
开发者ID:ryanschmitty,项目名称:RDSTracer,代码行数:16,代码来源:POVRayParser.cpp

示例9: KBDescParse

KBDesc_p KBDescParse(Scanner_p in)
{
   KBDesc_p handle = KBDescCellAlloc();
   
   AcceptInpId(in, "Version");
   AcceptInpTok(in, Colon);
   CheckInpTok(in, String);
   handle->version = DStrCopy(AktToken(in)->literal);
   
   if(strcmp(handle->version, KB_VERSION) > 0)
   {
      Error("Knowledge base is younger than your tool set. Please"
	    " update from" E_URL, USAGE_ERROR);
   }
   NextToken(in);
   AcceptInpId(in, "NegProp");
   AcceptInpTok(in, Colon);
   handle->neg_proportion = ParseFloat(in);
   AcceptInpId(in, "FailExamples");
   AcceptInpTok(in, Colon);
   handle->fail_neg_examples = AktToken(in)->numval;
   AcceptInpTok(in, PosInt);

   return handle;
}
开发者ID:kylepjohnson,项目名称:sigma,代码行数:25,代码来源:cle_kbdesc.c

示例10: ParseFloat

	float ConfigReader::GetFloat(const std::string theSection,
		const std::string theName, const float theDefault) const
	{
		float anResult = theDefault;

		// Check if theSection really exists
		std::map<const std::string, typeNameValue*>::const_iterator iter;
		iter = mSections.find(theSection);
		if(iter != mSections.end())
		{
			// Try to obtain the name, value pair
			typeNameValue* anMap = iter->second;
			if(NULL != anMap)
			{
				typeNameValueIter iterNameValue;
				iterNameValue = anMap->find(theName);
				if(iterNameValue != anMap->end())
				{
					anResult = ParseFloat(iterNameValue->second, theDefault);
				}
			}
		}

		// Return the result found or theDefault assigned above
		return anResult;
	}
开发者ID:adrigm,项目名称:Generic-Game-Engine,代码行数:26,代码来源:ConfigReader.cpp

示例11: ParseVector2f

	sf::Vector2f ParseVector2f(const std::string theValue, const sf::Vector2f theDefault)
	{
		sf::Vector2f anResult = theDefault;

		// Try to find the first comma
		size_t anCommaOffset = theValue.find_first_of(',');
		if(anCommaOffset != std::string::npos)
		{
			float anX = ParseFloat(theValue.substr(0,anCommaOffset), theDefault.x);
			float anY = ParseFloat(theValue.substr(anCommaOffset+1), theDefault.y);

			// Now that both values have been parsed, return the vector found
			anResult.x = anX;
			anResult.y = anY;
		}

		// Return the result found or theDefault assigned above
		return anResult;
	}
开发者ID:adrigm,项目名称:Generic-Game-Engine,代码行数:19,代码来源:StringUtil.cpp

示例12: FileFormatException

void FeatureDataIterator::readNext() {
  m_next.clear();
  try {
    StringPiece marker = m_in->ReadDelimited();
    if (marker != StringPiece(FEATURES_TXT_BEGIN)) {
      throw FileFormatException(m_in->FileName(), marker.as_string());
    }
    size_t sentenceId = m_in->ReadULong();
    size_t count = m_in->ReadULong();
    size_t length = m_in->ReadULong();
    m_in->ReadLine(); //discard rest of line
    for (size_t i = 0; i < count; ++i) {
      StringPiece line = m_in->ReadLine();
      m_next.push_back(FeatureDataItem());
      for (TokenIter<AnyCharacter, true> token(line, AnyCharacter(" \t")); token; ++token) {
        TokenIter<AnyCharacter,false> value(*token,AnyCharacter(":"));
        if (!value) throw FileFormatException(m_in->FileName(), line.as_string());
        StringPiece first = *value;
        ++value;
        if (!value) {
          //regular feature
          float floatValue = ParseFloat(first);
          m_next.back().dense.push_back(floatValue);
        } else {
          //sparse feature
          StringPiece second = *value;
          float floatValue = ParseFloat(second);
          m_next.back().sparse.set(first.as_string(),floatValue); 
        }
      }
      if (length != m_next.back().dense.size()) {
        throw FileFormatException(m_in->FileName(), line.as_string());
      }
    }
    StringPiece line = m_in->ReadLine();
    if (line != StringPiece(FEATURES_TXT_END)) {
      throw FileFormatException(m_in->FileName(), line.as_string());
    }
  } catch (EndOfFileException &e) {
    m_in.reset();
  }
}
开发者ID:ILucifer,项目名称:mosesdecoder,代码行数:42,代码来源:FeatureDataIterator.cpp

示例13: ClauseWeightAgeParse

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

示例14: ParseRotationDelta

//------------------------------------------------------
// ParseRotationDelta
//	Reads in a ranged rotationDelta value
//
// input:
//	string that contains one or two floats
//
// return:
//	success of parse operation.
//------------------------------------------------------
bool CPrimitiveTemplate::ParseRotationDelta( const gsl::cstring_view& val )
{
	float min, max;

	if ( ParseFloat( val, min, max ) == qtrue )
	{
		mRotationDelta.SetRange( min, max );
		return true;
	}

	return false;
}
开发者ID:nikaza,项目名称:OpenJK,代码行数:22,代码来源:FxTemplate.cpp

示例15: ParseRotationDelta

//------------------------------------------------------
// ParseRotationDelta
//	Reads in a ranged rotationDelta value
//
// input:
//	string that contains one or two floats
//
// return:
//	success of parse operation.
//------------------------------------------------------
bool CPrimitiveTemplate::ParseRotationDelta( const char *val )
{
	float min, max;

	if ( ParseFloat( val, &min, &max ) == qtrue )
	{
		mRotationDelta.SetRange( min, max );
		return true;
	}

	return false;
}
开发者ID:LTolosa,项目名称:Jedi-Outcast,代码行数:22,代码来源:FxTemplate.cpp


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