00001 /***************************** License ********************************** 00002 00003 Copyright (C) 2008 by Communicative Machines 00004 http://www.cmlabs.com All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 ************************************************************************/ 00021 00022 00023 // Collection.h: interface for the Collection class. 00024 // 00025 ////////////////////////////////////////////////////////////////////// 00026 00027 #if !defined(AFX_COLLECTION_H__CA9E28D1_CE17_4E79_9147_47BC3C70087F__INCLUDED_) 00028 #define AFX_COLLECTION_H__CA9E28D1_CE17_4E79_9147_47BC3C70087F__INCLUDED_ 00029 00030 #if _MSC_VER > 1000 00031 #pragma once 00032 #endif // _MSC_VER > 1000 00033 00034 #include "CollectionBase.h" 00035 00036 namespace cmlabs { 00037 00038 class Collection : public CollectionBase 00039 { 00040 public: 00041 Collection(); 00042 Collection(const JString& xml); 00043 Collection(XMLNode *node); 00044 virtual ~Collection(); 00045 Collection(const Collection &c); 00046 const Collection& operator = (const Collection& c); 00047 bool addAll(const CollectionBase* c); 00048 bool addAll(const CollectionBase& c); 00049 00050 bool unitTest(); 00051 00052 bool contains(const JString& value) const; 00053 int getPos(const JString& value) const; 00054 00055 JString getFirst(); 00056 JString getLast(); 00057 JString getNext(); 00058 JString getPrevious(); 00059 JString get(int pos); 00060 JString get(int pos) const; 00061 JString take(int pos); 00062 JString operator [](int pos) const; 00063 00064 bool add(const JString& value); 00065 bool addFirst(const JString& value); 00066 bool addLast(const JString& value); 00067 bool addAfter(int pos, const JString& value); 00068 bool addBefore(int pos, const JString& value); 00069 bool replace(int pos, const JString& value); 00070 int replace(const JString& oldvalue, const JString& value); 00071 int removeEntries(const JString& value); 00072 bool remove(const JString& value); 00073 bool remove(int pos); 00074 00075 bool removeNoDelete(int pos); 00076 bool removeAllNoDelete(); 00077 void noDelete(); 00078 void doDelete(); 00079 00080 }; 00081 00082 } // namespace cmlabs 00083 00084 #endif // !defined(AFX_COLLECTION_H__CA9E28D1_CE17_4E79_9147_47BC3C70087F__INCLUDED_)