ObjFW
src/OFEnumerator.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011, 2012
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #import "OFObject.h"
00018 
00019 @class OFEnumerator;
00020 
00024 @protocol OFEnumerating
00031 - (OFEnumerator*)objectEnumerator;
00032 @end
00033 
00037 @interface OFEnumerator: OFObject
00043 - (id)nextObject;
00044 
00049 - (void)reset;
00050 @end
00051 
00052 /*
00053  * This needs to be exactly like this because it's hardcoded in the compiler.
00054  *
00055  * We need this bad check to see if we already imported Cocoa, which defines
00056  * this as well.
00057  */
00058 #define of_fast_enumeration_state_t NSFastEnumerationState
00059 #ifndef NSINTEGER_DEFINED
00060 
00063 typedef struct of_fast_enumeration_state_t {
00065         unsigned long state;
00067         id *itemsPtr;
00069         unsigned long *mutationsPtr;
00071         unsigned long extra[5];
00072 } of_fast_enumeration_state_t;
00073 #endif
00074 
00081 @protocol OFFastEnumeration
00092 - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
00093                            objects: (id*)objects
00094                              count: (int)count;
00095 @end
 All Classes Functions Variables Properties