Changeset 18824


Ignore:
Timestamp:
04/14/17 12:27:38 (8 years ago)
Author:
tbretz
Message:
Keep position arguments in continous order without gaps.
File:
1 edited

Legend:

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

    r16803 r18824  
    227227//!   If the map is also empty the file name was empty, if the map has
    228228//!   one entry then for this entry the equal sign was missing.
    229 //!
     229//
     230//! allow==true allows for positional (empty) arguments, like in
     231//!    file.txt arg1 arg2="argument 2" arg3
     232//!
     233#include <iostream>
    230234map<string,string> Tools::Split(string &opt, bool allow)
    231235{
     
    248252    map<string,string> rc;
    249253
    250     int i=-1;
     254    int cnt=0;
    251255
    252256    for (; it!=tok.end(); it++)
     
    254258        if (it->empty())
    255259            continue;
    256 
    257         i++;
    258260
    259261        const size_t pos = it->find_first_of('=');
     
    262264            if (allow)
    263265            {
    264                 rc[to_string(i)] = *it;
     266                std::cout << "|" << *it << "|" << std::endl;
     267                rc[to_string(cnt++)] = *it;
    265268                continue;
    266269            }
Note: See TracChangeset for help on using the changeset viewer.