Changeset 14054 for trunk


Ignore:
Timestamp:
06/03/12 21:39:02 (12 years ago)
Author:
tbretz
Message:
Allow to split command lines without equal signs
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r13713 r14054  
    156156//!   one entry then for this entry the euqal sign was missing.
    157157//!
    158 map<string,string> Tools::Split(string &opt)
     158map<string,string> Tools::Split(string &opt, bool allow)
    159159{
    160160    using namespace boost;
     
    176176    map<string,string> rc;
    177177
     178    int i=-1;
     179
    178180    for (; it!=tok.end(); it++)
    179181    {
     182        if (it->empty())
     183            continue;
     184
     185        i++;
     186
    180187        const size_t pos = it->find_first_of('=');
    181188        if (pos==string::npos)
    182189        {
     190            if (allow)
     191            {
     192                rc[to_string(i)] = *it;
     193                continue;
     194            }
     195
    183196            opt = "";
    184197            rc.clear();
  • trunk/FACT++/src/tools.h

    r13713 r14054  
    1313    std::string Wrap(std::string &str, size_t width=78);
    1414
    15     std::map<std::string,std::string> Split(std::string &);
     15    std::map<std::string,std::string> Split(std::string &, bool = false);
    1616    std::string Uncomment(const std::string &opt);
    1717}
Note: See TracChangeset for help on using the changeset viewer.