Changeset 10326


Ignore:
Timestamp:
Apr 8, 2011, 2:07:50 PM (10 years ago)
Author:
tbretz
Message:
Fixed the conversion for the Option-argument.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r10323 r10326  
    4343not understood by Dim. In addition there are \b O(ptions) which are like
    4444Words but can be omitted. They should only be used at the end of the string.
    45 \b B(ool) is also special. It evaluates true/false, yes/no, on/off, 1/0.
     45Both can be encapsulated in quotationmarks '"'. \b B(ool) is also special.
     46It evaluates true/false, yes/no, on/off, 1/0.
    4647
    4748The non-DIM like format options can be switched on and off by using the
    48 strict argument in the constructor.
     49strict argument in the constructor. In general DimCommands can use these
     50options, but DimServices not.
    4951
    5052@remark Note that all values are interpreted as signed, except the single
     
    175177    wout << " (" << val << ")";
    176178
    177     v.insert(v.end(), val.begin(), val.end());
     179    v.insert(v.end(), val.begin(), val.end()+1);
    178180}
    179181
     
    196198
    197199    v.push_back(val);
     200    v.push_back('\n');
    198201}
    199202
     
    274277        line.get();
    275278        getline(line, buf, '\"');
     279        if (line.peek()==-1)
     280            line.clear(ios::eofbit);
    276281    }
    277282    else
     
    400405//! @param ptr
    401406//!     Pointer to the binary representation. It will be incremented
    402 //!     according to the sze of the template argument
     407//!     according to the size of the template argument
    403408//!
    404409//! @tparam T
     
    420425//!
    421426//! @param ptr
    422 //!     Pointer to the binary representation.
    423 //!
    424 void Converter::AddString(string &str, const string &ptr) const
    425 {
    426     str += ' ' + ptr;
     427//!     Pointer to the binary representation. It will be incremented
     428//!     according to the size of the template argument
     429//!
     430void Converter::AddString(string &str, const char* &ptr) const
     431{
     432    const string txt(ptr);
     433    str += " [" + txt + "]";
     434    ptr += txt.length()+1;
    427435}
    428436
     
    435443//!
    436444//! @param ptr
    437 //!     Pointer to the binary representation of the string.
    438 //!
    439 void Converter::AddString(vector<boost::any> &vec, const string &ptr) const
    440 {
    441     vec.push_back(ptr);
     445//!     Pointer to the binary representation. It will be incremented
     446//!     according to the size of the template argument
     447//!
     448void Converter::AddString(vector<boost::any> &vec, const char* &ptr) const
     449{
     450    const string txt(ptr);
     451    vec.push_back(txt);
     452    ptr += txt.length()+1;
    442453}
    443454
     
    551562                GetBinString(data, GetString(line));
    552563                if (*i->first.first == typeid(O))
    553                     line.clear(ios::goodbit);
     564                    line.clear(ios::goodbit|(line.rdstate()&ios::eofbit));
    554565                break;
    555566            default:
     
    564575            break;
    565576    }
    566 
    567577    wout << endl;
    568578
     
    653663        if (*i->first.first == typeid(string))
    654664        {
    655             const string str(ptr);
    656             AddString(text, str);
    657             ptr += str.length()+1;
     665            AddString(text, ptr);
    658666            break;
    659667        }
     
    672680            case 'd': Add<double>   (text, ptr); break;
    673681            case 'x': Add<long long>(text, ptr); break;
     682            case 'N': AddString(text, ptr);      break;
     683
    674684            case 'v':
    675685                // This should never happen!
  • trunk/FACT++/src/Converter.h

    r10287 r10326  
    5858    template<class T>
    5959        void Add(std::string &str, const char* &ptr) const;
    60     void AddString(std::string &str, const std::string &ptr) const;
     60    void AddString(std::string &str, const char* &ptr) const;
    6161    template<class T>
    6262        void Add(std::vector<boost::any> &vec, const char* &ptr) const;
    63     void AddString(std::vector<boost::any> &vec, const std::string &ptr) const;
     63    void AddString(std::vector<boost::any> &vec, const char* &ptr) const;
    6464
    6565
Note: See TracChangeset for help on using the changeset viewer.