Changeset 14613


Ignore:
Timestamp:
11/13/12 17:35:11 (12 years ago)
Author:
tbretz
Message:
Unescape 'C' formated text.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Converter.cc

    r12846 r14613  
    7373
    7474#include <boost/regex.hpp>
    75 
    76 #include "Readline.h"
     75#include <boost/tokenizer.hpp>
     76
     77#include "tools.h"
    7778#include "WindowLog.h"
    7879
     
    325326string Converter::GetStringEol(stringstream &line) const
    326327{
    327     // Remove leading whitespaces
    328     while (line.peek()==' ')
    329         line.get();
    330 
    331328    line >> noskipws;
    332329
    333330    const istream_iterator<char> eol; // end-of-line iterator
    334     const string s(istream_iterator<char>(line), eol);
    335     return s + '\0';
     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';
    336349}
    337350
Note: See TracChangeset for help on using the changeset viewer.