AaronCameron.net
Because you all make me very, very tired.
Not a Member? - Login or Create an Account
Sunday the 20th of May 2012 @ 03:21pm
Front Page Journal Projects Your Profile About
[]

LibN2L-4 Library Code Reference

Classes
Compounds
Files
Members
Method Index
Full Reference

cConfValidators.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library
00003 Copyright (C) 2003  Aaron Cameron
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation; either
00008 version 2.1 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 
00019 A copy of the GNU Lesser General Public License has been provided with
00020 this library in the file 'COPYING'.
00021 
00022 Contact information for the author of this library has been provided
00023 with this library in the file 'AUTHOR'.
00024 ************************************************************************/
00025 
00026 #include "cConfValidators.h"
00027 
00028 namespace n2l
00029 {
00030 
00031     /**************************************************************************/
00032     cConfValidators::cConfValidators(
00033         const cAutoPtr<cConfValidatorInterface> &iV1,
00034         const cAutoPtr<cConfValidatorInterface> &iV2,
00035         const cAutoPtr<cConfValidatorInterface> &iV3,
00036         const cAutoPtr<cConfValidatorInterface> &iV4,
00037         const cAutoPtr<cConfValidatorInterface> &iV5,
00038         const cAutoPtr<cConfValidatorInterface> &iV6,
00039         const cAutoPtr<cConfValidatorInterface> &iV7,
00040         const cAutoPtr<cConfValidatorInterface> &iV8,
00041         const cAutoPtr<cConfValidatorInterface> &iV9,
00042         const cAutoPtr<cConfValidatorInterface> &iV10,
00043         const cAutoPtr<cConfValidatorInterface> &iV11,
00044         const cAutoPtr<cConfValidatorInterface> &iV12,
00045         const cAutoPtr<cConfValidatorInterface> &iV13 )
00046     {
00047         mGroup.push_back(iV1);
00048         // Now for the real stupidity
00049         if (iV2) mGroup.push_back(iV2);
00050         if (iV3) mGroup.push_back(iV3);
00051         if (iV4) mGroup.push_back(iV4);
00052         if (iV5) mGroup.push_back(iV5);
00053         if (iV6) mGroup.push_back(iV6);
00054         if (iV7) mGroup.push_back(iV7);
00055         if (iV8) mGroup.push_back(iV8);
00056         if (iV9) mGroup.push_back(iV9);
00057         if (iV10) mGroup.push_back(iV10);
00058         if (iV11) mGroup.push_back(iV11);
00059         if (iV12) mGroup.push_back(iV12);
00060         if (iV13) mGroup.push_back(iV13);
00061     }
00062 
00063     /**************************************************************************/
00064     cConfValidators::~cConfValidators()
00065     {
00066     }
00067 
00068     /**************************************************************************/
00069     const cConfValidatorInterface *const cConfValidators::valueOk(
00070         const cDynVar &iValue ) const
00071     {
00072         const cConfValidatorInterface *error;
00073         for (tConstIterator vIt=begin(); vIt!=end(); ++vIt)
00074             if ((error=(*vIt)->valueOk(iValue))) return error;
00075         return 0;
00076     }
00077 
00078     /**************************************************************************/
00079     void cConfValidators::add(
00080         const cAutoPtr<cConfValidatorInterface> &iValidator )
00081     {
00082         return mGroup.push_back( iValidator );
00083     }
00084 
00085     /**************************************************************************/
00086     const cConfValidators::tConstIterator cConfValidators::begin() const
00087     {
00088         return mGroup.begin();
00089     }
00090 
00091     /**************************************************************************/
00092     const cConfValidators::tConstIterator cConfValidators::end() const
00093     {
00094         return mGroup.end();
00095     }
00096 
00097     /**************************************************************************/
00098     const tString cConfValidators::describe() const
00099     {
00100         tString retStr("Validator Group(");
00101         for (tConstIterator vIt=begin(); vIt!=end(); ++vIt)
00102             retStr += (*vIt)->describe();
00103         return retStr;
00104     }
00105     
00106 } // namespace
©2012 Aaron Cameron