本文整理汇总了C++中std::istream::precision方法的典型用法代码示例。如果您正苦于以下问题:C++ istream::precision方法的具体用法?C++ istream::precision怎么用?C++ istream::precision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::istream
的用法示例。
在下文中一共展示了istream::precision方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parser
bool CConfigurationFile::CXML::load(std::istream & is,
const std::string & relativeTo)
{
mPWD = relativeTo;
is.imbue(std::locale::classic());
is.precision(16);
mpIstream = &is;
bool success = true;
bool done = false;
CVersion Version;
CCopasiXMLParser Parser(Version);
#define BUFFER_SIZE 0xfffe
char * pBuffer = new char[BUFFER_SIZE + 1];
while (!done)
{
mpIstream->get(pBuffer, BUFFER_SIZE, 0);
if (mpIstream->eof()) done = true;
if (mpIstream->fail() && !done)
{
std::string ConfigFile;
COptions::getValue("ConfigFile", ConfigFile);
CCopasiMessage Message(CCopasiMessage::WARNING, MCConfiguration + 2, ConfigFile.c_str());
done = true;
success = false;
}
if (!Parser.parse(pBuffer, -1, done))
{
CCopasiMessage Message(CCopasiMessage::RAW, MCXML + 2,
Parser.getCurrentLineNumber(),
Parser.getCurrentColumnNumber(),
Parser.getErrorString());
done = true;
success = false;
}
}
delete [] pBuffer;
#undef BUFFER_SIZE
if (success && Parser.getCurrentGroup() != NULL)
{
mConfiguration = * Parser.getCurrentGroup();
mConfiguration.setObjectName("Configuration");
delete Parser.getCurrentGroup();
}
else
mConfiguration.clear();
return success;
}
示例2: restore
void ParameterizedFunction::restore ( std::istream & is, int format )
{
if (is.good())
{
is.precision (std::numeric_limits<double>::digits10 + 1);
std::string tmp;
bool b_endOfBlock ( false ) ;
while ( !b_endOfBlock )
{
is >> tmp; // start of block
if ( this->isEndTag( tmp, "ParameterizedFunction" ) )
{
b_endOfBlock = true;
continue;
}
tmp = this->removeStartTag ( tmp );
if ( tmp.compare("m_parameters") == 0 )
{
is >> m_parameters;
}
else
{
示例3: _GetEpsilon
CoordType _GetEpsilon(std::istream& is)
{
std::streamsize str_prec = is.precision();
CoordType str_eps = 1;
while(--str_prec > 0) // Precision of 6 gives epsilon = 1e-5
str_eps /= 10;
return str_eps;
}
示例4: readBranchLength
double readBranchLength(std::istream &iss)
{
auto result = double{0.};
iss.precision(std::numeric_limits<double>::digits10 + 2);
iss >> result;
return result;
}