00001 00009 /************************************************************************** 00010 00011 begin : Thu Dec 17 2002 00012 copyright : (C) 2002-2010 by Ewald Arnold 00013 email : mockpp at ewald-arnold dot de 00014 00015 This program is free software; you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as 00017 published by the Free Software Foundation; either version 2 of the License, 00018 or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 00029 **/ 00030 00031 00032 #define MOCKPP_NEED_EXPORTS 00033 #include <mockpp/mockpp.h> // always first 00034 00035 #include MOCKPP_ALGORITHM_H 00036 00037 #include <mockpp/VerifiableList.h> 00038 #include <mockpp/compat/Asserter.h> 00039 00040 00041 MOCKPP_NS_START 00042 00043 00044 MOCKPP_API_IMPL0 VerifiableList::VerifiableList (const String &name, VerifiableList *parent) 00045 : Verifiable(name, parent) 00046 { 00047 } 00048 00049 00050 MOCKPP_API_IMPL(void) VerifiableList::addVerifiable (Verifiable* vf) 00051 { 00052 if (vf != 0) 00053 verifiables.push_back(vf); 00054 } 00055 00056 00057 MOCKPP_API_IMPL(void) VerifiableList::removeVerifiable (Verifiable* vf) 00058 { 00059 MOCKPP_STL::vector<Verifiable*>::iterator it = 00060 MOCKPP_STL::find (verifiables.begin(), verifiables.end(), vf); 00061 00062 if(it != verifiables.end()) 00063 verifiables.erase(it); 00064 } 00065 00066 00067 MOCKPP_API_IMPL(bool) VerifiableList::hasVerifiable (Verifiable* vf) const 00068 { 00069 MOCKPP_STL::vector<Verifiable*>::const_iterator it = 00070 MOCKPP_STL::find(verifiables.begin(), verifiables.end(), vf); 00071 return it != verifiables.end(); 00072 } 00073 00074 00075 MOCKPP_API_IMPL(unsigned) VerifiableList::numVerifiables() const 00076 { 00077 return verifiables.size(); 00078 } 00079 00080 00081 MOCKPP_API_IMPL(void) VerifiableList::clearVerifiables() 00082 { 00083 verifiables.clear(); 00084 } 00085 00086 00087 MOCKPP_API_IMPL(Verifiable *) VerifiableList::getVerifiable(unsigned idx) 00088 { 00089 MOCKPP_ASSERT_TRUE(idx < verifiables.size()); 00090 00091 return verifiables[idx]; 00092 } 00093 00094 00095 MOCKPP_NS_END 00096