Lumiera  0.pre.03
»edityourfreedom«
cmdline.hpp
Go to the documentation of this file.
1 /*
2  CMDLINE.hpp - abstraction of the usual commandline, a sequence of strings
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
33 #ifndef LIB_CMDLINE_H
34 #define LIB_CMDLINE_H
35 
36 #include <vector>
37 #include <string>
38 
39 
40 
41 namespace lib {
42 
43  using std::string;
44  using std::vector;
45  using std::ostream;
46 
47  typedef vector<string> VectS;
48 
49 
56  class Cmdline : public VectS
57  {
58  public:
59  Cmdline (int argc, const char** argv);
60  explicit Cmdline (const string cmdline);
61 
62  operator string () const;
63  VectS& operator= (const VectS& source) { return VectS::operator= (source); }
64 
65  // inherited ctors
66  template <class In>
67  Cmdline (In first, In last) : VectS (first,last) {}
68  Cmdline () : VectS () {}
69 
70  };
71 
72 
73 
74 } // namespace lib
75 #endif
Cmdline(In first, In last)
Definition: cmdline.hpp:67
basic_ostream< char, char_traits< char > > ostream
Definition: format-obj.hpp:63
Implementation namespace for support and library code.
enable_if< can_direct_access_Last< COLL >, typename COLL::reference > last(COLL const &coll)
access the last element of a STL-like container.
Definition: util-coll.hpp:123
VectS & operator=(const VectS &source)
Definition: cmdline.hpp:63
enable_if< treat_as_STL_Container< COLL >, typename COLL::reference > first(COLL const &coll)
access the first element of a STL-like container.
Definition: util-coll.hpp:107
Abstraction of the usual int argc, int** argv-Commandline, to be able to treat it as a vector of stri...
Definition: cmdline.hpp:56
vector< string > VectS
Definition: cmdline.hpp:47