4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Parse public header */
32 #include <boost/utility.hpp>
33 #include <boost/scoped_ptr.hpp>
34 #include <boost/range/iterator_range.hpp>
36 //#include "Parse.mpp"
37 ///////////////////////////////hh.p////////////////////////////////////////
42 namespace detail { struct ParserAccess; }
49 std::string const & value() const;
54 explicit ArgumentToken(std::string token);
58 friend class detail::ParserAccess;
64 class ParseCommandInfo
66 typedef std::vector<ArgumentToken> Tokens;
69 typedef Tokens::const_iterator token_iterator;
70 typedef boost::iterator_range<token_iterator> argument_value_type;
73 typedef std::vector<argument_value_type> Arguments;
76 typedef Arguments::const_iterator argument_iterator;
77 typedef Arguments::size_type size_type;
79 std::string const & commandPath() const;
81 size_type arguments() const;
82 argument_iterator begin_arguments() const;
83 argument_iterator end_arguments() const;
85 size_type tokens() const;
86 token_iterator begin_tokens() const;
87 token_iterator end_tokens() const;
93 void setCommand(std::string const & commandPath);
96 void addToken(ArgumentToken const & token);
101 std::string commandPath_;
103 typedef std::pair<Tokens::size_type, Tokens::size_type> TempArgumentRange;
104 typedef std::vector<TempArgumentRange> TempArguments;
107 Arguments arguments_;
108 TempArguments tempArguments_;
110 friend class detail::ParserAccess;
115 class SingleCommandParser
119 ///////////////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////////////
123 ///\name Structors and default members
126 SingleCommandParser();
127 ~SingleCommandParser();
130 ///////////////////////////////////////////////////////////////////////////
132 bool parseCommand(std::string command, ParseCommandInfo & info);
139 boost::scoped_ptr<Impl> impl_;
144 ///////////////////////////////hh.e////////////////////////////////////////
146 //#include "Parse.ct"
147 //#include "Parse.cti"
154 // comment-column: 40
155 // c-file-style: "senf"
156 // indent-tabs-mode: nil
157 // ispell-local-dictionary: "american"
158 // compile-command: "scons -u test"