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

Options.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 _Options_h_included
00024 #define  _Options_h_included
00025 
00026 #include <string>
00027 #include <vector>
00028 
00029 #include "Option.h"
00030 
00031 namespace CLI {
00032 
00045 class Options {
00046     public:
00047         typedef std::vector<Option> Vector;
00048 
00049         Options();
00050 
00051         Options(const Options&);
00052         Options& operator=(const Options&);
00053 
00054         ~Options(); 
00055 
00059         void addOption(const Option& option);
00060 
00070         void addOption(const char* const option, const bool hasArg, const char* const usage);
00071 
00072         void addOption(const char* const option, const char* const longOption, const bool hasArg, const char* const usage);
00073 
00074         bool hasOption(const char* const which) const;
00075         const Option& getOption(const char* const which) const;
00076         std::string toString() const;
00077         const Vector& operator()() const;
00078 
00079     private:
00080         class Implementation;
00081         Implementation* impl_;
00082 };
00083 
00084 } 
00085 
00086 #endif // #ifndef _Options_h_included

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