List.h

00001 //
00002 // $Id: List.h,v 1.34 2007/03/06 20:42:19 will_mason Exp $
00003 //
00004 // vi: set ft=objc:
00005 
00006 /*
00007  * ObjectiveLib - a library of containers and algorithms for Objective-C
00008  *
00009  * Copyright (c) 2004-2007
00010  * Will Mason
00011  *
00012  * Portions:
00013  *
00014  * Copyright (c) 1994
00015  * Hewlett-Packard Company
00016  *
00017  * Copyright (c) 1996,1997
00018  * Silicon Graphics Computer Systems, Inc.
00019  *
00020  * Copyright (c) 1997
00021  * Moscow Center for SPARC Technology
00022  *
00023  * Copyright (c) 1999 
00024  * Boris Fomitchev
00025  *
00026  * This library is free software; you can redistribute it and/or
00027  * modify it under the terms of the GNU Lesser General Public
00028  * License as published by the Free Software Foundation; either
00029  * version 2.1 of the License, or (at your option) any later version.
00030  *
00031  * This library is distributed in the hope that it will be useful,
00032  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00033  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00034  * Lesser General Public License for more details.
00035  *
00036  * You should have received a copy of the GNU Lesser General Public
00037  * License along with this library; if not, write to the Free Software
00038  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00039  *
00040  * You may contact the author at will_mason@users.sourceforge.net.
00041  */
00042 
00043 #if !defined(LIST_OL_GUARD)
00044 #define LIST_OL_GUARD
00045 
00046 #include <ObjectiveLib/Functional.h>
00047 #include <ObjectiveLib/Iterator.h>
00048 
00052 @class OLListNode;
00053 
00064 @interface OLListIterator : OLBidirectionalIterator
00065 {
00066 @private
00071     OLListNode*     node;
00072 }
00073 
00074 - (id) advance;
00075 - (id) assign: (id)object;
00076 #if defined(OL_NO_OPENSTEP)
00077 - (id) copy;
00078 #else
00079 - (id) copyWithZone: (NSZone*)zone;
00080 #endif
00081 - (id) dereference;
00082 - (BOOL) isEqual: (id)object;
00083 - (id) reverse;
00084 
00085 @end
00086 
00103 @interface OLList :
00104 #if defined(OL_NO_OPENSTEP)
00105     Object <OLBackInserter, OLFrontInserter, OLInserter, OLStreamable>
00106 #else
00107     NSObject <OLBackInserter, OLFrontInserter, OLInserter, OLStreamable, NSCopying, NSCoding>
00108 #endif
00109 {
00110 @protected
00114     OLListNode*     node;
00115 }
00116 
00125 + (id) list;
00126 
00138 + (id) listFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00139 
00150 + (id) listWithList: (OLList*)right;
00151 
00163 + (id) listWithSize: (unsigned)size filledWith: (id)value;
00164 
00168 /* @{ */
00174 - (id) init;
00175 
00184 - (id) initFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00185 
00186 #if !defined(OL_NO_OPENSTEP)
00187 
00197 - (id) initWithCoder: (NSCoder*)decoder;
00198 #endif
00199 
00207 - (id) initWithList: (OLList*)list;
00208 
00209 - (id) initWithObjectInStream: (OLObjectInStream*)stream;
00210 
00219 - (id) initWithSize: (unsigned)size filledWith: (id)value;
00220 
00224 #if defined(OL_NO_OPENSTEP)
00225 - (id) free;
00226 #else
00227 - (void) dealloc;
00228 #endif
00229 /* @} */
00230 
00238 - (void) assign: (unsigned)count filledWith: (id)value;
00239 
00248 - (void) assignFrom: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00249 
00258 - (id) back;
00259 
00268 - (OLListIterator*) begin;
00269 
00273 - (void) clear;
00274 
00284 - (int) compare: (id)other;
00285 
00286 #if defined(OL_NO_OPENSTEP)
00287 
00292 - (id) copy;
00293 #else
00294 
00300 - (id) copyWithZone: (NSZone*)zone;
00301 #endif
00302 
00308 - (BOOL) empty;
00309 
00310 #if !defined(OL_NO_OPENSTEP)
00311 
00317 - (void) encodeWithCoder: (NSCoder*)encoder;
00318 #endif
00319 
00328 - (OLListIterator*) end;
00329 
00341 - (OLListIterator*) erase: (OLListIterator*)where;
00342 
00357 - (OLListIterator*) eraseFrom: (OLListIterator*)first to: (OLListIterator*)last;
00358 
00367 - (id) front;
00368 
00380 - (void) insertAt: (OLListIterator*)where count: (unsigned)num filledWith: (id)value;
00381 
00391 - (void) insertAt: (OLListIterator*)where from: (OLForwardIterator*)first to: (OLForwardIterator*)last;
00392 
00407 - (OLListIterator*) insertAt: (OLListIterator*)where value: (id)object;
00408 
00417 - (BOOL) isEqual: (id)object;
00418 
00427 - (unsigned) maxSize;
00428 
00439 - (void) merge: (OLList*)right;
00440 
00450 - (void) merge: (OLList*)right withOrder: (id<OLBoolBinaryFunction>)pred;
00451 
00458 - (void) popBack;
00459 
00466 - (void) popFront;
00467 
00473 - (void) pushBack: (id)object;
00474 
00480 - (void) pushFront: (id)object;
00481 
00492 - (OLReverseBidiIterator*) rbegin;
00493 
00503 - (void) remove: (id)object;
00504 
00513 - (void) removeIf: (id<OLBoolUnaryFunction>)pred;
00514 
00525 - (OLReverseBidiIterator*) rend;
00526 
00536 - (void) resize: (unsigned)count filledWith: (id)value;
00537 
00541 - (void) reverse;
00542 
00548 - (unsigned) size;
00549 
00554 - (void) sort;
00555 
00562 - (void) sortWith: (id<OLBoolBinaryFunction>)pred;
00563 
00573 - (void) spliceAt: (OLListIterator*)where list: (OLList*)right;
00574 
00586 - (void) spliceAt: (OLListIterator*)where list: (OLList*)right from: (OLListIterator*)first;
00587 
00601 - (void) spliceAt: (OLListIterator*)where list: (OLList*)right from: (OLListIterator*)first to: (OLListIterator*)last;
00602 
00609 - (void) swap: (OLList*)right;
00610 
00616 - (void) unique;
00617 
00625 - (void) uniqueWith: (id<OLBoolBinaryFunction>)pred;
00626 
00627 - (void) writeSelfToStream: (OLObjectOutStream*)stream;
00628 
00629 @end
00630 
00631 #endif

ObjectiveLibGenerated Sun Apr 22 15:17:59 2007, © 2004-2007 Will Mason
SourceForge.net Logo