本文整理汇总了C++中istream::flags方法的典型用法代码示例。如果您正苦于以下问题:C++ istream::flags方法的具体用法?C++ istream::flags怎么用?C++ istream::flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类istream
的用法示例。
在下文中一共展示了istream::flags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_line_
//=============================================================================
static string get_line_ (istream& in)
{
string line;
ios_base::fmtflags ff (in.flags());
in.setf (ios_base::skipws);
getline (in, line);
in.flags (ff);
return line;
}
示例2: readFromStream
bool SubRip::readFromStream(istream& is)
{
if ( !valid ) { clear(); }
unsigned int sa, sb, sc, sd; //start times
unsigned int ea, eb, ec, ed; //end times
unsigned int num;
bool go = true;
auto flags = is.flags();
char c, c1, c2;
char cl[6];
do {
is >> skipws >> num >> sa;
c = is.get(); if (c!=':') { valid = false; break; }
is >> sb;
c = is.get(); if (c!=':') { valid = false; break; }
is >> sc;
c = is.get(); if (c!=',') { valid = false; break; }
is >> sd;
is.get(cl, 6); if (strcmp(cl, " --> ")!=0) { valid = false; break; }
is >> ea;
c = is.get(); if (c!=':') { valid = false; break; }
is >> eb;
c = is.get(); if (c!=':') { valid = false; break; }
is >> ec;
c = is.get(); if (c!=',') { valid = false; break; }
is >> ed;
c1 = is.get(); c2 = is.get(); if ( c1!='\r' || c2!='\n') { valid = false; break; }
is >> noskipws;
string aggr;
bool stop = false;
while (!stop) {
string temp;
getline(is, temp, '\n'); temp.append("\n");
if (temp.length() == 1) {
go = false;
break;
}
if (temp.length()==2) {
stop = true;
}
aggr.append(temp);
}
int sTime = aggregateTimes(sa, sb, sc, sd);
int eTime = aggregateTimes(ea, eb, ec, ed);
nodes.push_back(make_pair(make_pair(sTime, eTime), aggr));
} while (go);
is.flags(flags);
return valid;
}
示例3: LoadFile
FeatureVectorListPtr FeatureFileIO::LoadFile (const KKStr& _fileName,
FileDescConstPtr _fileDesc,
MLClassList& _classes,
istream& _in,
OptionUInt32 _maxCount, // Maximum # images to load.
VolConstBool& _cancelFlag,
bool& _changesMade,
KKStr& _errorMessage,
RunLog& _log
)
{
_errorMessage = "Driver '" + DriverName () + "' does not implemenet 'LoadFile' method.";
_log.Level (10) << endl
<< "FeatureFileIO::LoadFile ***ERROR*** " << _errorMessage << endl
<< " _fileName : " << _fileName << endl
<< " _fileDesc : " << _fileDesc->NumOfFields () << endl
<< " _classes : " << _classes.ToCommaDelimitedStr () << endl
<< " _in.flags : " << _in.flags () << endl
<< " _maxCount : " << _maxCount << endl
<< " _cancelFlag : " << _cancelFlag << endl
<< " _changesMade: " << _changesMade << endl
<< endl;
_errorMessage = "ROBERTS read functionality not implemented.";
return NULL;
}
示例4: GetFileDesc
FileDescConstPtr FeatureFileIO::GetFileDesc (const KKStr& _fileName,
istream& _in,
MLClassListPtr _classes,
kkint32& _estSize,
KKStr& _errorMessage,
RunLog& _log
)
{
_errorMessage = "Driver '" + DriverName () + "' does not implemenet 'GetFileDesc' method.";
_log.Level (10) << endl
<< "FeatureFileIO::GetFileDesc ***ERROR*** " << _errorMessage << endl
<< " _fileName: " << _fileName << endl
<< " _in.flags: " << _in.flags () << endl
<< " _classes : " << _classes->ToCommaDelimitedStr () << endl
<< " _estSize : " << _estSize << endl
<< endl;
_errorMessage = "ROBERTS read_estSize, functionality not implemented.";
return NULL;
}
示例5: switch
int
__gmp_istream_set_base (istream &i, char &c, bool &zero, bool &showbase)
{
int base;
zero = showbase = false;
switch (i.flags() & ios::basefield)
{
case ios::dec:
base = 10;
break;
case ios::hex:
base = 16;
break;
case ios::oct:
base = 8;
break;
default:
showbase = true; // look for initial "0" or "0x" or "0X"
if (c == '0')
{
if (! i.get(c))
c = 0; // reset or we might loop indefinitely
if (c == 'x' || c == 'X')
{
base = 16;
i.get(c);
}
else
{
base = 8;
zero = true; // if no other digit is read, the "0" counts
}
}
else
base = 10;
break;
}
return base;
}
示例6: _Ipfx
short _Ipfx(istream& Is_, int noskip)
{
if (Is_.good())
{
if (Is_.tie() != 0)
Is_.tie()->flush();
if (!noskip && Is_.flags() & ios::skipws)
{
int ch;
while (isspace(ch = Is_.rdbuf()->sbumpc()))
;
if (ch != EOF)
Is_.rdbuf()->sputbackc(ch);
}
if (Is_.good())
return 1;
}
Is_.clear(ios::failbit);
return 0;
}