Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SequenceableCollection.h

Go to the documentation of this file.
00001 /*
00002  * SequenceableCollection.h
00003  *
00004  * Smalltalk like class library for C++
00005  * Abstract index-accessible collection. Header.
00006  *
00007  * Copyright (c) 2003 Milan Cermak
00008  */
00009 /*
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  */
00024 #ifndef __SEQUENCEABLECOLLECTION_H
00025 #define __SEQUENCEABLECOLLECTION_H
00026 
00027 #include <stlib/Collection.h>
00028 
00029 namespace Core {
00030 
00031 class Array;
00032 class ByteArray;
00033 class CollectionIterator;
00034 class String;
00035 class ReadStream;
00036 class ReadAppendStream;
00037 class WriteStream;
00038 
00039 class SequenceableCollection : public Collection
00040 {
00041   public:
00042     /* Accessing protocol */
00043     virtual Object *any(void);
00044     virtual Object *at(int index) const abstract;
00045     virtual void put(int index, Object *obj) abstract;
00046     virtual long size(void) const abstract;
00047     virtual Object *first(void);
00048     virtual Object *last(void);
00049     virtual void replace(long start, long stop,
00050                          const SequenceableCollection *collection);
00051     virtual void replace(long start, long stop,
00052                          const SequenceableCollection *collection, long startIndex);
00053     virtual void replaceAll(Object *element, Object *replacement);
00054     virtual void replaceAll(Object *element, Object *replacement,
00055                             long startIndex, long stopIndex);
00056 
00060     virtual long indexOf(Object *element) const;
00064     virtual long lastIndexOf(Object *element) const;
00065     virtual long nextIndexOf(Object *element, long startIndex, long stopIndex) const;
00066     virtual long prevIndexOf(Object *element, long startIndex, long stopIndex) const;
00067 
00068     virtual long indexOfSubCollection(SequenceableCollection *coll) const;
00069     virtual long indexOfSubCollection(SequenceableCollection *coll,
00070                                       long startIndex) const;
00071 
00072     /* Adding protocol */
00073     virtual void changeSize(long newSize) abstract;
00074     virtual void grow(void);
00075     virtual void growToAtLeast(long items);
00076 
00077     /* Converting protocol */
00078     virtual Array *asArray(void);
00079     virtual ByteArray *asByteArray(void);
00080     virtual String *asString(void);
00081     virtual ReadStream *readStream(void);
00082     virtual ReadAppendStream *readAppendStream(void);
00083     virtual WriteStream *writeStream(void);
00084 
00085     /* Copying protocol */
00086     virtual Object *copy(void) abstract;
00087     virtual Object *copy(long from, long to);
00088     virtual SequenceableCollection *copyReplace(long from, long to,
00089                                                 SequenceableCollection *replacement);
00090     virtual SequenceableCollection &operator+(SequenceableCollection &collection);
00091 
00092     /* Removing protocol */
00093     virtual Object *remove(Object *);
00094 
00095     /* Testing protocol */
00096     virtual bool includesSubcollection(SequenceableCollection *coll) const;
00097     virtual bool isSequenceable(void) const;
00098     virtual bool startsWith(SequenceableCollection *coll) const;
00099     virtual bool endsWith(SequenceableCollection *coll) const;
00100 
00101   protected:
00102     /* Enumeration protocol */
00103     virtual Object *privNextForIterator(CollectionIterator *iter) const;
00104 };
00105 
00106 };
00107 
00108 #endif /* __SEQUENCEABLECOLLECTION_H */

Generated on Mon Nov 27 09:47:55 2006 for Smalltalk like C++ Class Library by  doxygen 1.4.2