Shellp

shellcmdintarg.h

00001 /*
00002     
00003   This file is a part of Shellp, a 'shell helper' library.
00004   
00005   Copyright (C) 2011-2012 Jori Liesenborgs
00006   
00007   Contact: jori.liesenborgs@gmail.com
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Lesser General Public
00011   License as published by the Free Software Foundation; either
00012   version 2.1 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Lesser General Public License for more details.
00018 
00019   You should have received a copy of the GNU Lesser General Public
00020   License along with this library; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
00022   USA
00023 
00024 */
00025 
00026 #ifndef SHELLP_SHELLCMDINTARG_H
00027 
00028 #define SHELLP_SHELLCMDINTARG_H
00029 
00030 #include "shellconfig.h"
00031 #include "shellcmdarg.h"
00032 
00033 namespace shellp
00034 {
00035 
00036 class SHELLP_IMPORTEXPORT ShellCmdIntArg : public ShellCmdArg
00037 {
00038 public:
00039         ShellCmdIntArg(const std::string &name);
00040         ShellCmdIntArg(const std::string &name, const std::string &defaultValue);
00041         ~ShellCmdIntArg();
00042         void setMin(int val)                                                            { m_minval = val; m_usemin = true; }
00043         void setMax(int val)                                                            { m_maxval = val; m_usemax = true; }
00044         void clearMin()                                                                 { m_usemin = false; }
00045         void clearMax()                                                                 { m_usemax = false; }
00046         bool useMin() const                                                             { return m_usemin; }
00047         bool useMax() const                                                             { return m_usemax; }
00048         int getMin() const                                                              { return m_minval; }
00049         int getMax() const                                                              { return m_maxval; }
00050         bool parse(const std::string &arg);
00051         int getValue() const                                                            { return m_val; }
00052 private:
00053         bool m_usemin, m_usemax;
00054         int m_minval, m_maxval;
00055         int m_val;
00056 };
00057 
00058 } // end namespace
00059 
00060 #endif // SHELLP_SHELLCMDINTARG_H