Frobby  0.9.5
StringParameter.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef STRING_PARAMETER_GUARD
18 #define STRING_PARAMETER_GUARD
19 
20 #include "Parameter.h"
21 #include <utility>
22 #include <string>
23 
24 class StringParameter : public Parameter {
25 public:
26  StringParameter(const string& name,
27  const string& description,
28  const string& defaultValue);
29 
30  const string& getValue() const {return _value;}
31  void setValue(const string& value) {_value = value;}
32 
33  operator const string&() const {return getValue();}
34  void operator=(const string& value) {setValue(value);}
35  bool operator==(const string& str) const {return getValue() == str;}
36 
37 private:
38  virtual string doGetArgumentType() const;
39  virtual string doGetValueAsString() const;
40  virtual pair<size_t, size_t> doGetArgumentCountRange() const;
41  virtual void doProcessArguments(const char** args, size_t argCount);
42 
43  string _value;
44 };
45 
46 #endif
bool operator==(const string &str) const
StringParameter(const string &name, const string &description, const string &defaultValue)
virtual pair< size_t, size_t > doGetArgumentCountRange() const
const string & getValue() const
void setValue(const string &value)
virtual void doProcessArguments(const char **args, size_t argCount)
void operator=(const string &value)
virtual string doGetValueAsString() const
virtual string doGetArgumentType() const