CLI for C++ Project Page CLI for C++ Home Page

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CommandLine.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 John H. Poplett. All rights reserved.
00003  * 
00004  * This software is provided 'as-is', without any express or implied
00005  * warranty. In no event will the authors be held liable for any damages
00006  * arising from the use of this software.
00007  * 
00008  * Permission is granted to anyone to use this software for any purpose,
00009  * including commercial applications, and to alter it and redistribute it
00010  * freely, subject to the following restrictions:
00011  * 
00012  *     1. The origin of this software must not be misrepresented; you must
00013  *     not claim that you wrote the original software. If you use this
00014  *     software in a product, an acknowledgment in the product documentation
00015  *     would be appreciated but is not required.
00016  * 
00017  *     2. Altered source versions must be plainly marked as such, and must
00018  *     not be misrepresented as being the original software.
00019  * 
00020  *     3. This notice may not be removed or altered from any source
00021  *     distribution.
00022  */
00023 #ifndef _CommandLine_h_included
00024 #define  _CommandLine_h_included
00025 
00026 #include <string>
00027 #include <vector>
00028 
00029 #include "Options.h"
00030 #include "Types.h"  // FIXME
00031 
00032 namespace CLI {
00033 
00041 class CommandLine {
00042     public:
00043         CommandLine();
00045         CommandLine(const CommandLine& other);
00046         ~CommandLine();
00047 
00049         CommandLine& operator=(const CommandLine& other);
00050 
00055         std::vector<std::string> getArgs() const;
00056 
00063         bool hasOption(const char option) const;
00064 
00072         std::string getOptionValue(const char* const option) const;
00073 
00077         const Options::Vector& operator()() const;
00078 
00079         void addOption(const Option& sourceOption, int& index, const int argc, const char* argv[]);
00080         void addArg(const char* const arg);
00081 
00082 
00083         void addOption(const Option& sourceOption, Tokens::const_iterator& token, const Tokens::const_iterator& end);
00084         void addArg(const std::string& arg);
00085 
00086     private:
00087         class Implementation;
00088         Implementation* impl_;
00089 };
00090 
00091 } 
00092 
00093 #endif // #ifndef _CommandLine_h_included

SourceForge Logo hosts this site. Send comments to:
John Poplett