]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
8f6c56a5 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
1c79356b A |
27 | */ |
28 | /* IOCollectionIterator.h created by gvdl on Fri 1998-10-30 */ | |
29 | ||
30 | #ifndef _OS_OSCOLLECTIONITERATOR_H | |
31 | #define _OS_OSCOLLECTIONITERATOR_H | |
32 | ||
33 | #include <libkern/c++/OSIterator.h> | |
34 | ||
35 | class OSCollection; | |
36 | ||
37 | /*! | |
38 | @class OSCollectionIterator | |
39 | @discussion | |
40 | OSCollectionIterator objects provide a consistent mechanism to iterate through all OSCollection derived collections. | |
41 | */ | |
42 | class OSCollectionIterator : public OSIterator | |
43 | { | |
44 | OSDeclareDefaultStructors(OSCollectionIterator) | |
45 | ||
46 | protected: | |
47 | const OSCollection *collection; | |
48 | void *collIterator; | |
49 | unsigned int initialUpdateStamp; | |
50 | bool valid; | |
51 | ||
52 | public: | |
53 | /*! | |
54 | @function withCollection | |
55 | @abstract A static constructor function which creates and initializes an instance of OSCollectionIterator for the provided collection object. | |
56 | @param inColl The OSCollection derived collection object to be iteratated. | |
57 | @result Returns a new instance of OSCollection or 0 on failure. | |
58 | */ | |
59 | static OSCollectionIterator *withCollection(const OSCollection *inColl); | |
60 | ||
61 | /*! | |
62 | @function withCollection | |
63 | @abstract A member function to initialize the intance of OSCollectionIterator with the provided colleciton object. | |
64 | @param inColl The OSCollection derived collection object to be iteratated. | |
65 | @result Returns true if the initialization was successful or false on failure. | |
66 | */ | |
67 | virtual bool initWithCollection(const OSCollection *inColl); | |
68 | /*! | |
69 | @function free | |
70 | @abstract A member function to release and deallocate all resources created or used by the OSCollectionIterator object. | |
71 | @discussion This function should not be called directly, use release() instead. | |
72 | */ | |
73 | virtual void free(); | |
74 | ||
75 | /*! | |
76 | @function reset | |
77 | @abstract A member function which resets the iterator to begin the next iteration from the beginning of the collection. | |
78 | */ | |
79 | virtual void reset(); | |
80 | ||
81 | /*! | |
82 | @function isValid | |
83 | @abstract A member function for determining if the collection was modified during iteration. | |
84 | */ | |
85 | virtual bool isValid(); | |
86 | ||
87 | /*! | |
88 | @function getNextObject | |
89 | @abstract A member function to get the next object in the collection being iterated. | |
90 | @result Returns the next object in the collection or 0 when the end has been reached. | |
91 | */ | |
92 | virtual OSObject *getNextObject(); | |
93 | }; | |
94 | ||
95 | #endif /* !_OS_OSCOLLECTIONITERATOR_H */ |