Overview
Comment: | Add OFCollection protocol. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ba19e68fb66e122af86880e75e59a74d |
User & Date: | js on 2010-09-05 23:33:12 |
Other Links: | manifest | tags |
Context
2010-09-05
| ||
23:36 | Update Xcode project. check-in: d2c728e2c5 user: js tags: trunk | |
23:33 | Add OFCollection protocol. check-in: ba19e68fb6 user: js tags: trunk | |
23:23 | Rename -[enumerator] to -[objectEnumerator] for consistency. check-in: ddb15601a2 user: js tags: trunk | |
Changes
Modified src/Makefile from [0b7fe42d95] to [75150cb36f].
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | OFXMLAttribute.m \ OFXMLElement.m \ OFXMLElementBuilder.m \ OFXMLParser.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ ObjFW.h \ asprintf.h \ ${ATOMIC_H} \ macros.h \ objfw-defs.h \ ${THREADING_H} | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | OFXMLAttribute.m \ OFXMLElement.m \ OFXMLElementBuilder.m \ OFXMLParser.m \ unicode.m INCLUDES := ${SRCS:.m=.h} \ OFCollection.h \ ObjFW.h \ asprintf.h \ ${ATOMIC_H} \ macros.h \ objfw-defs.h \ ${THREADING_H} |
︙ | ︙ |
Modified src/OFArray.h from [a12c7e5760] to [2a76fef6e1].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include <stdarg.h> #import "OFObject.h" #import "OFEnumerator.h" @class OFDataArray; @class OFString; #ifdef OF_HAVE_BLOCKS typedef void (^of_array_enumeration_block_t)(id obj, size_t idx, BOOL *stop); #endif /** * \brief A class for storing objects in an array. */ | > | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include <stdarg.h> #import "OFObject.h" #import "OFCollection.h" #import "OFEnumerator.h" @class OFDataArray; @class OFString; #ifdef OF_HAVE_BLOCKS typedef void (^of_array_enumeration_block_t)(id obj, size_t idx, BOOL *stop); #endif /** * \brief A class for storing objects in an array. */ @interface OFArray: OFObject <OFCopying, OFMutableCopying, OFCollection, OFFastEnumeration> { OFDataArray *array; } /** * \return A new autoreleased OFArray */ |
︙ | ︙ | |||
110 111 112 113 114 115 116 | * \param objs A C array of objects * \param len The length of the C array * \return An initialized OFArray */ - initWithCArray: (id*)objs length: (size_t)len; | < < < < < | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | * \param objs A C array of objects * \param len The length of the C array * \return An initialized OFArray */ - initWithCArray: (id*)objs length: (size_t)len; /** * \return The objects of the array as a C array */ - (id*)cArray; /** * Returns a specific object of the array. |
︙ | ︙ | |||
178 179 180 181 182 183 184 | * Creates a string by joining all objects of the array. * * \param separator The string with which the objects should be joined * \return A string containing all objects joined by the separator */ - (OFString*)componentsJoinedByString: (OFString*)separator; | < < < < < | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | * Creates a string by joining all objects of the array. * * \param separator The string with which the objects should be joined * \return A string containing all objects joined by the separator */ - (OFString*)componentsJoinedByString: (OFString*)separator; #ifdef OF_HAVE_BLOCKS /** * Executes a block for each object. * * \param block The block to execute for each object */ - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block; |
︙ | ︙ |
Added src/OFCollection.h version [d4bb05be77].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /* * Copyright (c) 2008 - 2010 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFEnumerator.h" /** * \brief A protocol with methods common for all collections. */ @protocol OFCollection #ifdef OF_HAVE_PROPERTIES @property (readonly) size_t count; #endif /** * \return The number of objects in the collection */ - (size_t)count; /** * \returns An OFEnumerator to enumerate through all objects of the collection */ - (OFEnumerator*)objectEnumerator; @end |
Modified src/OFDictionary.h from [63820ae3f4] to [5d0f2c3365].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include <stdarg.h> #import "OFObject.h" #import "OFEnumerator.h" @class OFArray; #ifdef OF_HAVE_BLOCKS typedef void (^of_dictionary_enumeration_block_t)(id key, id obj, BOOL *stop); #endif /// \cond internal struct of_dictionary_bucket { id <OFCopying> key; id object; uint32_t hash; }; /// \endcond /** * \brief A class for storing objects in a hash table. */ | > | < < < < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include <stdarg.h> #import "OFObject.h" #import "OFCollection.h" #import "OFEnumerator.h" @class OFArray; #ifdef OF_HAVE_BLOCKS typedef void (^of_dictionary_enumeration_block_t)(id key, id obj, BOOL *stop); #endif /// \cond internal struct of_dictionary_bucket { id <OFCopying> key; id object; uint32_t hash; }; /// \endcond /** * \brief A class for storing objects in a hash table. */ @interface OFDictionary: OFObject <OFCopying, OFMutableCopying, OFCollection, OFFastEnumeration> { struct of_dictionary_bucket **data; uint32_t size; size_t count; } /** * Creates a new OFDictionary. * * \return A new autoreleased OFDictionary */ + dictionary; |
︙ | ︙ | |||
152 153 154 155 156 157 158 | * reasons! * * \param key The key whose object should be returned * \return The object for the given key or nil if the key was not found */ - (id)objectForKey: (id)key; | < < < < < < < < < < | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | * reasons! * * \param key The key whose object should be returned * \return The object for the given key or nil if the key was not found */ - (id)objectForKey: (id)key; /** * \return An OFEnumerator to enumerate through the dictionary's keys */ - (OFEnumerator*)keyEnumerator; #ifdef OF_HAVE_BLOCKS /** |
︙ | ︙ |