diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-08-05 10:54:12 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-08-05 11:10:14 +0900 |
commit | 430373ae38565e0d7f62b8fca0cbad73de73ec7f (patch) | |
tree | 670a7322ddd2732c8824b1fb73090b937e2a1f82 /src/tclap/ValuesConstraint.h | |
parent | d833de5bbe40d780fe02dc95d1c981a4b1007108 (diff) | |
download | universal-indent-gui-tqt-430373ae38565e0d7f62b8fca0cbad73de73ec7f.tar.gz universal-indent-gui-tqt-430373ae38565e0d7f62b8fca0cbad73de73ec7f.zip |
Format code using uncrustify
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/tclap/ValuesConstraint.h')
-rw-r--r--[-rwxr-xr-x] | src/tclap/ValuesConstraint.h | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/src/tclap/ValuesConstraint.h b/src/tclap/ValuesConstraint.h index 235939c..882f762 100755..100644 --- a/src/tclap/ValuesConstraint.h +++ b/src/tclap/ValuesConstraint.h @@ -1,24 +1,22 @@ - - -/****************************************************************************** - * +/****************************************************************************** + * * file: ValuesConstraint.h - * + * * Copyright (c) 2005, Michael E. Smoot * All rights reverved. - * + * * See the file COPYING in the top directory of this distribution for * more information. - * - * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - *****************************************************************************/ + * + * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ #ifndef TCLAP_VALUESCONSTRAINT_H #define TCLAP_VALUESCONSTRAINT_H @@ -28,120 +26,122 @@ #include <tclap/Constraint.h> #ifdef HAVE_CONFIG_H -#include <config.h> + #include <config.h> #else -#define HAVE_SSTREAM + #define HAVE_SSTREAM #endif -#if defined(HAVE_SSTREAM) -#include <sstream> -#elif defined(HAVE_STRSTREAM) -#include <strstream> +#if defined (HAVE_SSTREAM) + #include <sstream> +#elif defined (HAVE_STRSTREAM) + #include <strstream> #else -#error "Need a stringstream (sstream or strstream) to compile!" + #error "Need a stringstream (sstream or strstream) to compile!" #endif -namespace TCLAP { - -/** - * A Constraint that constrains the Arg to only those values specified - * in the constraint. - */ -template<class T> -class ValuesConstraint : public Constraint<T> +namespace TCLAP { - public: - - /** - * Constructor. - * \param allowed - vector of allowed values. - */ - ValuesConstraint(std::vector<T>& allowed); - - /** - * Virtual destructor. - */ - virtual ~ValuesConstraint() {} - - /** - * Returns a description of the Constraint. - */ - virtual std::string description() const; - - /** - * Returns the short ID for the Constraint. - */ - virtual std::string shortID() const; - - /** - * The method used to verify that the value parsed from the command - * line meets the constraint. - * \param value - The value that will be checked. - */ - virtual bool check(const T& value) const; - - protected: - - /** - * The list of valid values. - */ - std::vector<T> _allowed; - - /** - * The string used to describe the allowed values of this constraint. - */ - std::string _typeDesc; - -}; - -template<class T> -ValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed) -: _allowed(allowed) -{ - for ( unsigned int i = 0; i < _allowed.size(); i++ ) - { - -#if defined(HAVE_SSTREAM) - std::ostringstream os; -#elif defined(HAVE_STRSTREAM) - std::ostrstream os; + /** + * A Constraint that constrains the Arg to only those values specified + * in the constraint. + */ + template<class T> + class ValuesConstraint : public Constraint<T> + { + public: + /** + * Constructor. + * \param allowed - vector of allowed values. + */ + ValuesConstraint(std::vector<T> &allowed); + + /** + * Virtual destructor. + */ + virtual ~ValuesConstraint() + { + } + + /** + * Returns a description of the Constraint. + */ + virtual std::string description() const; + + /** + * Returns the short ID for the Constraint. + */ + virtual std::string shortID() const; + + /** + * The method used to verify that the value parsed from the command + * line meets the constraint. + * \param value - The value that will be checked. + */ + virtual bool check(const T &value) const; + + protected: + /** + * The list of valid values. + */ + std::vector<T> _allowed; + + /** + * The string used to describe the allowed values of this constraint. + */ + std::string _typeDesc; + }; + + template<class T> + ValuesConstraint<T>::ValuesConstraint(std::vector<T> &allowed) : + _allowed(allowed) + { + for (unsigned int i = 0; i < _allowed.size(); i++) + { +#if defined (HAVE_SSTREAM) + std::ostringstream os; +#elif defined (HAVE_STRSTREAM) + std::ostrstream os; #else -#error "Need a stringstream (sstream or strstream) to compile!" + #error "Need a stringstream (sstream or strstream) to compile!" #endif - os << _allowed[i]; - - std::string temp( os.str() ); - - if ( i > 0 ) - _typeDesc += "|"; - _typeDesc += temp; - } -} - -template<class T> -bool ValuesConstraint<T>::check( const T& val ) const -{ - if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() ) - return false; - else - return true; -} - -template<class T> -std::string ValuesConstraint<T>::shortID() const -{ - return _typeDesc; -} - -template<class T> -std::string ValuesConstraint<T>::description() const -{ - return _typeDesc; -} - - + os << _allowed[i]; + + std::string temp(os.str()); + + if (i > 0) + { + _typeDesc += "|"; + } + _typeDesc += temp; + } + } + + template<class T> + bool ValuesConstraint<T>::check(const T &val) const + { + if (std::find(_allowed.begin(), _allowed.end(), val) == _allowed.end()) + { + return false; + } + else + { + return true; + } + } + + template<class T> + std::string ValuesConstraint<T>::shortID() const + { + return _typeDesc; + } + + template<class T> + std::string ValuesConstraint<T>::description() const + { + return _typeDesc; + } } //namespace TCLAP -#endif +#endif |