Converts the provided data block into a vector of boost::any or a string.
659 throw runtime_error(
"Compiled format invalid!");
662 throw runtime_error(
"Data pointer == NULL!");
664 const char *ptr =
reinterpret_cast<const char *
>(dat);
667 for (Converter::FormatList::const_iterator
i=
fList.begin();
i<
fList.end()-1;
i++)
672 err <<
"Format description [fmt=" <<
fFormat <<
"|size=" <<
GetSize() <<
"] exceeds available data size (" <<
size <<
")";
673 throw runtime_error(err.str());
676 if (*
i->first.first ==
typeid(
string))
686 for (
int j=0; j<
i->second.first; j++)
688 switch (
i->first.first->name()[0])
690 case 'b': Add<bool> (text, ptr);
break;
691 case 'c': Add<char> (text, ptr);
break;
692 case 's': Add<short> (text, ptr);
break;
693 case 'i': Add<int> (text, ptr);
break;
694 case 'l': Add<long> (text, ptr);
break;
695 case 'f': Add<float> (text, ptr);
break;
696 case 'd': Add<double> (text, ptr);
break;
697 case 'x': Add<long long>(text, ptr);
break;
702 throw runtime_error(
"Type 'void' not supported!");
704 throw runtime_error(
"TypeId '"+
string(
i->first.first->name())+
"' not known!");
712 err <<
"Data block size (" << size <<
") doesn't fit format description [fmt=" <<
fFormat <<
"|size=" <<
GetSize() <<
"]";
713 throw runtime_error(err.str());
const FormatList fList
Original format string.
void AddString(std::string &str, const char *&ptr) const
const std::string fFormat
ostream to which output is redirected