util::Cmdline Class Reference

Abstraction of the usual "int argc, int** argv"-Commandline, to be able to treat it as a vector of strings. More...

#include <cmdline.hpp>

Inheritance diagram for util::Cmdline:

Inheritance graph
[legend]
Collaboration diagram for util::Cmdline:

Collaboration graph
[legend]

List of all members.

Public Member Functions

template<class In>
 Cmdline (In first, In last)
 Cmdline (const string cmdline)
 create by tokenizing a string (e.g.
 Cmdline (int argc, char *argv[])
 create as a tokenized copy of the current commandline.
 operator string () const
 conversion to string by joining the tokens
VectS & operator= (const VectS &source)


Detailed Description

Inherits from vector<std::string>, but provides convienient conversions to string (joining delimited by space)...

Definition at line 48 of file cmdline.hpp.


Constructor & Destructor Documentation

util::Cmdline::Cmdline ( int  argc,
char *  argv[] 
)

Note that argv[0] is allways ignored.

Definition at line 55 of file cmdline.cpp.

00056     : vector<string> (noneg(argc-1))
00057     {
00058       for (int i=1; i<argc; ++i)
00059         {
00060           ASSERT (argv[i]);
00061           (*this)[i-1] = argv[i];
00062         }
00063     }

util::Cmdline::Cmdline ( const string  cmdline  )  [explicit]

"fake" cmdline, separated by whitespace)

Definition at line 69 of file cmdline.cpp.

00070     {
00071       regex tokendef("[^ \r\n\t]+");
00072       smatch match;
00073       string::const_iterator it = cmdline.begin();
00074       string::const_iterator end = cmdline.end();
00075       
00076       while (regex_search(it, end, match, tokendef))
00077         {
00078           string ss(match[0]);
00079           this->push_back(ss);
00080           it = match[0].second;
00081         }
00082       
00083     }


The documentation for this class was generated from the following files:

Generated on Sat Aug 16 18:10:48 2008 for Lumiera by  doxygen 1.5.5