00001 /* 00002 This is a descendent of argument that deals with string values. 00003 00004 Copyright (C) 2002 Ross A. Beyer 00005 00006 Contact Author: Ross A. Beyer, rbeyer@rossbeyer.net 00007 00008 CVS $Id: string_arg.hpp,v 1.2 2003/03/03 00:52:30 rbeyer Exp $ 00009 00010 00011 License & Copyright Information 00012 ------------------------------- 00013 00014 This file is part of the commandl package, 00015 $Name: commandl_Beta-1 $. 00016 00017 The commandl packge is free software; you can redistribute it 00018 and/or modify it under the terms of the GNU General Public License 00019 as published by the Free Software Foundation; either version 2 of the 00020 License, or (at your option) any later version. 00021 00022 The commandl package is distributed in the hope that it will be useful, 00023 but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 GNU General Public License for more details. 00026 00027 You should have received a copy of the GNU General Public License 00028 along with this program; if not, write to the Free Software 00029 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00030 00031 */ 00032 00033 #ifndef STRING_ARG_HEADER // Begin the Header Guard to prevent multiple 00034 #define STRING_ARG_HEADER // inclusions. 00035 00036 #include "argument.hpp" 00037 #include <string> 00038 00039 namespace commandl 00040 { 00041 00045 class string_arg : public argument, public std::string 00046 { 00047 00048 // ==================== Constructors & Destructor ===================== // 00049 public: 00050 00051 string_arg 00052 ( 00053 std::vector<std::string>, // keys 00054 std::string = "", // value description 00055 std::string = "", // description 00056 bool = false, // argument required? 00057 bool = false // value required? 00058 ); 00059 00060 string_arg 00061 ( 00062 std::string, // key 00063 std::string = "", // value description 00064 std::string = "", // description 00065 bool = false, // argument required? 00066 bool = false // value required? 00067 ); 00068 00069 00070 // =========================== Accessors ============================== // 00071 public: 00072 00073 00074 // =========================== Methods ================================ // 00075 public: 00076 00077 // value(s) prefix, key, assignment 00078 void operator() ( 00079 const std::string&, // prefix 00080 const std::string&, // key 00081 const unsigned long // order 00082 ); 00083 void operator() ( 00084 const std::string&, // value 00085 const std::string&, // prefix 00086 const std::string&, // key 00087 const std::string&, // assign 00088 const unsigned long // order 00089 ); 00090 void operator() ( 00091 const std::vector<std::string>&, // values 00092 const std::string&, // prefix 00093 const std::string&, // key 00094 const std::string&, // assign 00095 const unsigned long // order 00096 ); 00097 00098 string_arg& operator=( const std::string& ); 00099 string_arg& operator=( const char* ); 00100 string_arg& operator=( const char ); 00101 00102 // --------------------------- Protected Methods ---------------------- // 00103 protected: 00104 00105 00106 // --------------------------- Private Methods ------------------------ // 00107 private: 00108 00109 00110 // =========================== Member Variables ======================= // 00111 protected: 00112 00113 00114 }; // End of the class declaration 00115 00116 } // End of the namespace declaration 00117 00118 #endif // End the Header Guard 00119