//============================================================================= 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; }
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; }
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; }
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; }
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; }
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; }