FACT++  1.0
string Converter::GetStringEol ( std::stringstream &  line) const
private

Converts from the stringstream into a string. Leading whitespaces are skipped. Everything until the end-of-line is returned. A trailing \0 is added.

Parameters
linereference to the stringstream from which the data should be interpreted
Returns
The string

Definition at line 326 of file Converter.cc.

References str, and Tools::Trim().

Referenced by Get().

327 {
328  line >> noskipws;
329 
330  const istream_iterator<char> eol; // end-of-line iterator
331  const string text(istream_iterator<char>(line), eol);
332 
333  string str = Tools::Trim(text);
334  if (str.length()>=2)
335  {
336  const char b = str[0];
337  const char e = str[str.length()-1];
338 
339  if ((b=='\"' && e=='\"') || (b=='\'' && e=='\''))
340  {
341  typedef boost::escaped_list_separator<char> separator;
342  const boost::tokenizer<separator> tok(str, separator("\\", " ", "\"'"));
343 
344  str = *tok.begin();
345  }
346  }
347 
348  return str + '\0';
349 }
char str[80]
Definition: test_client.c:7
std::string Trim(const std::string &str)
Definition: tools.cc:68

+ Here is the call graph for this function:

+ Here is the caller graph for this function: