Converts the provided format string into a vector.
528 throw runtime_error(
"Compiled format invalid!");
538 stringstream line(
str);
542 for (Converter::FormatList::const_iterator
i=
fList.begin();
i<
fList.end()-1;
i++)
544 if (*
i->first.first ==
typeid(
string))
547 line.clear(ios::eofbit);
552 for (
int j=0; j<
i->second.first; j++)
554 switch (
i->first.first->name()[0])
557 case 's':
GetBinImp(data, Get<short> (line));
break;
558 case 'i':
GetBinImp(data, Get<int> (line));
break;
559 case 'l':
GetBinImp(data, Get<long> (line));
break;
560 case 'f':
GetBinImp(data, Get<float> (line));
break;
561 case 'd':
GetBinImp(data, Get<double> (line));
break;
562 case 'x':
GetBinImp(data, Get<long long>(line));
break;
565 const unsigned short val = Get<unsigned short>(line);
567 line.setstate(ios::failbit);
568 GetBinImp(data, static_cast<unsigned char>(val));
573 if (*
i->first.first ==
typeid(O))
574 line.clear(ios::goodbit|(line.rdstate()&ios::eofbit));
578 throw runtime_error(
"Format '"+
string(
i->first.first->name())+
" not supported!");
590 if (line.fail() && !line.eof())
595 err <<
"Error converting argument at " << arg <<
" [fmt=" <<
fFormat <<
"]!\n";
596 err << line.str() <<
"\n";
597 err << setw(
int(line.tellg())) <<
" " <<
"^\n";
598 throw runtime_error(err.str());
602 if (line.fail() && line.eof())
607 err <<
"Not enough arguments [fmt=" << fFormat <<
"]!\n";
608 err << line.str() <<
"\n";
609 err << setw(
int(line.tellg())+1) <<
" " <<
"^\n";
610 throw runtime_error(err.str());
616 if (line.good() && !line.eof())
619 err <<
"More arguments available than expected [fmt=" << fFormat <<
"]!\n";
620 err << line.str() <<
"\n";
621 err << setw(
int(line.tellg())+1) <<
" " <<
"^\n";
622 throw runtime_error(err.str());
std::string GetString(std::stringstream &line) const
void GetBinImp(std::vector< char > &v, const T &val) const
void GetBinString(std::vector< char > &v, const std::string &val) const
bool GetBool(std::stringstream &line) const
std::string GetStringEol(std::stringstream &line) const
const FormatList fList
Original format string.
const std::string fFormat
ostream to which output is redirected