Comment: | More documentation improvements. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8490c927d2a9469ce7421627fe9acf8d |
User & Date: | js on 2011-05-05 21:17:19 |
Other Links: | manifest | tags |
2011-05-08
| ||
13:10 | Fix a typo in OFMD5Hash.m. check-in: b8052b3f65 user: js tags: trunk | |
2011-05-05
| ||
21:17 | More documentation improvements. check-in: 8490c927d2 user: js tags: trunk | |
2011-05-04
| ||
22:35 | Improve Doxyfile. check-in: 8588bd03b2 user: js tags: trunk | |
Modified src/OFApplication.h from [abd0f46934] to [530227dea1].
︙ | ︙ | |||
34 35 36 37 38 39 40 | */ #ifndef OF_APPLICATION_M @protocol OFApplicationDelegate <OFObject> #else @protocol OFApplicationDelegate #endif /** | | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | */ #ifndef OF_APPLICATION_M @protocol OFApplicationDelegate <OFObject> #else @protocol OFApplicationDelegate #endif /** * \brief A method which is called when the application was initialized and is * running now. */ - (void)applicationDidFinishLaunching; #ifdef OF_HAVE_OPTIONAL_PROTOCOLS @optional #endif /** * \brief A method which is called when the application will terminate. */ - (void)applicationWillTerminate; @end /** * \brief Represents the application as an object. */ |
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | @property (readonly, copy) OFString *programName; @property (readonly, copy) OFArray *arguments; @property (readonly, copy) OFDictionary *environment; @property (retain) id <OFApplicationDelegate> delegate; #endif /** * \return The only OFApplication instance in the application */ + sharedApplication; /** * \return The name of the program (argv[0]) */ + (OFString*)programName; /** * \return The arguments passed to the application */ + (OFArray*)arguments; /** * \return The environment of the application */ + (OFDictionary*)environment; /** | > > > > > > > > | | | | | > > > > > > > > | | > > | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | @property (readonly, copy) OFString *programName; @property (readonly, copy) OFArray *arguments; @property (readonly, copy) OFDictionary *environment; @property (retain) id <OFApplicationDelegate> delegate; #endif /** * \brief Returns the only OFApplication instance in the application. * * \return The only OFApplication instance in the application */ + sharedApplication; /** * \brief Returns the name of the program (argv[0]). * * \return The name of the program (argv[0]) */ + (OFString*)programName; /** * \brief Returns the arguments passed to the application. * * \return The arguments passed to the application */ + (OFArray*)arguments; /** * \brief Returns the environment of the application. * * \return The environment of the application */ + (OFDictionary*)environment; /** * \brief Terminates the application. */ + (void)terminate; /** * \brief Terminates the application with the specified status. * * \param status The status with which the application will terminate */ + (void)terminateWithStatus: (int)status; /** * \brief Sets argc and argv. * * You should not call this directly, but use OF_APPLICATION_DELEGATE instead! * * \param argc The number of arguments * \param argv The argument values */ - (void)setArgumentCount: (int*)argc andArgumentValues: (char**[])argv; /** * \brief Gets args and argv. * * \param argc A pointer where a pointer to argc should be stored * \param argv A pointer where a pointer to argv should be stored */ - (void)getArgumentCount: (int**)argc andArgumentValues: (char***[])argv; /** * \brief Returns the name of the program (argv[0]). * * \return The name of the program (argv[0]) */ - (OFString*)programName; /** * \brief Returns the arguments passed to the application. * * \return The arguments passed to the application */ - (OFArray*)arguments; /** * \brief Returns the environment of the application. * * \return The environment of the application */ - (OFDictionary*)environment; /** * \brief Returns the delegate of the application. * * \return The delegate of the application */ - (id <OFApplicationDelegate>)delegate; /** * \brief Sets the delegate of the application. * * \param delegate The delegate for the application */ - (void)setDelegate: (id <OFApplicationDelegate>)delegate; /** * \brief Starts the application after everything has been initialized. * * You should not call this directly, but use OF_APPLICATION_DELEGATE instead! */ - (void)run; /** * \brief Terminates the application. */ - (void)terminate; /** * \brief Terminates the application with the specified status. * * \param status The status with which the application will terminate */ - (void)terminateWithStatus: (int)status; @end @interface OFObject (OFApplicationDelegate) <OFApplicationDelegate> |
︙ | ︙ |
Modified src/OFApplication.m from [f78cb5e637] to [af28ed9259].
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFAutoreleasePool.h" #import "OFNotImplementedException.h" #ifndef __MACH__ extern char **environ; #endif static OFApplication *app = nil; static void | > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFAutoreleasePool.h" #import "OFNotImplementedException.h" #import "macros.h" #ifndef __MACH__ extern char **environ; #endif static OFApplication *app = nil; static void |
︙ | ︙ | |||
185 186 187 188 189 190 191 | { *argc_ = argc; *argv_ = argv; } - (OFString*)programName { | | | | | < < | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | { *argc_ = argc; *argv_ = argv; } - (OFString*)programName { OF_GETTER(programName, YES) } - (OFArray*)arguments { OF_GETTER(arguments, YES) } - (OFDictionary*)environment { OF_GETTER(environment, YES) } - (id <OFApplicationDelegate>)delegate { OF_GETTER(delegate, YES) } - (void)setDelegate: (id <OFApplicationDelegate>)delegate_ { OF_SETTER(delegate, delegate_, YES, NO) } - (void)run { [delegate applicationDidFinishLaunching]; } |
︙ | ︙ |
Modified src/OFArray.h from [acc0282c12] to [ef89fea76a].
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 | @interface OFArray: OFObject <OFCopying, OFMutableCopying, OFCollection, OFFastEnumeration> { OFDataArray *array; } /** * \return A new autoreleased OFArray */ + array; /** | > > | | | | | | | | | | | > > | | | | | | | | | | > | | | | | | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | @interface OFArray: OFObject <OFCopying, OFMutableCopying, OFCollection, OFFastEnumeration> { OFDataArray *array; } /** * \brief Creates a new OFArray. * * \return A new autoreleased OFArray */ + array; /** * \brief Creates a new OFArray with the specified object. * * \param object An object * \return A new autoreleased OFArray */ + arrayWithObject: (id)object; /** * \brief Creates a new OFArray with the specified objects, terminated by nil. * * \param firstObject The first object in the array * \return A new autoreleased OFArray */ + arrayWithObjects: (id)firstObject, ...; /** * \brief Creates a new OFArray with the objects from the specified C array. * * \param objects A C array of objects, terminated with nil * \return A new autoreleased OFArray */ + arrayWithCArray: (id*)objects; /** * \brief Creates a new OFArray with the objects from the specified C array of * the specified length. * * \param objects A C array of objects * \param length The length of the C array * \return A new autoreleased OFArray */ + arrayWithCArray: (id*)objects length: (size_t)length; /** * \brief Initializes an OFArray with the specified object. * * \param object An object * \return An initialized OFArray */ - initWithObject: (id)object; /** * \brief Initializes an OFArray with the specified objects. * * \param firstObject The first object * \return An initialized OFArray */ - initWithObjects: (id)firstObject, ...; /** * \brief Initializes an OFArray with the specified object and a va_list. * * \param firstObject The first object * \param arguments A va_list * \return An initialized OFArray */ - initWithObject: (id)firstObject arguments: (va_list)arguments; /** * \brief Initializes an OFArray with the objects from the specified C array. * * \param objects A C array of objects, terminated with nil * \return An initialized OFArray */ - initWithCArray: (id*)objects; /** * \brief Initializes an OFArray with the objects from the specified C array of * the specified length. * * \param objects A C array of objects * \param length The length of the C array * \return An initialized OFArray */ - initWithCArray: (id*)objects length: (size_t)length; /** * \brief Returns the objects of the array as a C array. * * \return The objects of the array as a C array */ - (id*)cArray; /** * \brief Returns a specified object of the array. * * The returned object is <i>not</i> retained and autoreleased for performance * reasons! * * \param index The number of the object to return * \return The specified object of the OFArray */ - (id)objectAtIndex: (size_t)index; /** * \brief Returns the index of the first object that is equivalent to the * specified object or OF_INVALID_INDEX if it was not found. * * \param object The object whose index is returned * \return The index of the first object equivalent to the specified object * or OF_INVALID_INDEX if it was not found */ - (size_t)indexOfObject: (id)object; /** * \brief Returns the index of the first object that has the same address as the * specified object or OF_INVALID_INDEX if it was not found. * * \param object The object whose index is returned * \return The index of the first object that has the same aaddress as * the specified object or OF_INVALID_INDEX if it was not found */ - (size_t)indexOfObjectIdenticalTo: (id)object; /** * \brief Returns the first object of the array or nil. * * The returned object is <i>not</i> retained and autoreleased for performance * reasons! * * \return The first object of the array or nil */ - (id)firstObject; /** * \brief Returns the last object of the array or nil. * * The returned object is <i>not</i> retained and autoreleased for performance * reasons! * * \return The last object of the array or nil */ - (id)lastObject; /** * \brief Returns the objects from the specified index to the specified index as * a new OFArray. * * \param start The index where the subarray starts * \param end The index where the subarray ends. * This points BEHIND the last object! * \return The subarray as a new autoreleased OFArray */ - (OFArray*)objectsFromIndex: (size_t)start toIndex: (size_t)end; /** * \brief Returns the objects in the specified range as a new OFArray. * * \param range The range for the subarray * \return The subarray as a new autoreleased OFArray */ - (OFArray*)objectsInRange: (of_range_t)range; /** * \brief 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; /** * \brief Performs the specified selector on all objects in the array. * * \param selector The selector to perform on all objects in the array */ - (void)makeObjectsPerformSelector: (SEL)selector; /** * \brief Performs the specified selector on all objects in the array with the * specified object. * * \param selector The selector to perform on all objects in the array * \param object The object to perform the selector with on all objects in the * array */ - (void)makeObjectsPerformSelector: (SEL)selector withObject: (id)object; #ifdef OF_HAVE_BLOCKS /** * \brief Executes a block for each object. * * \param block The block to execute for each object */ - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block; /** * \brief Returns a new array, mapping each object using the specified block. * * \param block A block which maps an object for each object * \return A new, autoreleased OFArray */ - (OFArray*)mappedArrayUsingBlock: (of_array_map_block_t)block; /** * \brief Returns a new array, only containing the objects for which the block * returns YES. * * \param block A block which determines if the object should be in the new * array * \return A new, autoreleased OFArray */ - (OFArray*)filteredArrayUsingBlock: (of_array_filter_block_t)block; #endif |
︙ | ︙ |
Modified src/OFAutoreleasePool.h from [a9ab0a42bf] to [490a0d1357].
︙ | ︙ | |||
22 23 24 25 26 27 28 | * The OFAutoreleasePool class is a class that keeps track of objects that will * be released when the autorelease pool is released. * * Every thread has its own stack of autorelease pools. */ @interface OFAutoreleasePool: OFObject { | | | | | | > > | | | | | | | | 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | * The OFAutoreleasePool class is a class that keeps track of objects that will * be released when the autorelease pool is released. * * Every thread has its own stack of autorelease pools. */ @interface OFAutoreleasePool: OFObject { OFAutoreleasePool *nextPool, *previousPool; id *objects; size_t count, size; } /** * \brief Adds an object to the autorelease pool at the top of the * thread-specific autorelease pool stack. * * \param object The object to add to the autorelease pool */ + (void)addObject: (id)object; /// \cond internal + (void)releaseAll; /// \endcond /** * \brief Adds an object to the specific autorelease pool. * * \param obj The object to add to the autorelease pool */ - (void)addObject: (id)object; /** * \brief Releases all objects in the autorelease pool. * * This does not free the memory allocated to store pointers to the objects in * the pool, so reusing the pool does not allocate any memory until the previous * number of objects is exceeded. It behaves this way to optimize loops that * always work with the same or similar number of objects and call relaseObjects * at the end of the loop, which is propably the most common case for * releaseObjects. * * If a garbage collector is added in the future, it will tell the GC that now * is a good time to clean up, as this is often used after a lot of objects * have been added to the pool that should be released before the next iteration * of a loop, which adds objects again. Thus, it is usually a clean up call. */ - (void)releaseObjects; /** * \brief Releases all objects in the autorelease pool and deallocates the pool. */ - (void)release; /** * \brief Tells the garbage collector that now is a good time to clean up. * * If there is no garbage collector, calling drain is equivalent to calling * release. */ - (void)drain; @end |
Modified src/OFAutoreleasePool.m from [152777f944] to [9d07df10aa].
︙ | ︙ | |||
22 23 24 25 26 27 28 | #import "OFArray.h" #import "OFInitializationFailedException.h" #import "OFNotImplementedException.h" #ifdef OF_THREADS # import "threading.h" | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | #import "OFArray.h" #import "OFInitializationFailedException.h" #import "OFNotImplementedException.h" #ifdef OF_THREADS # import "threading.h" static of_tlskey_t firstKey, lastKey; #else static OFAutoreleasePool *firstPool = nil, *lastPool = nil; #endif #define GROW_SIZE 16 @implementation OFAutoreleasePool #ifdef OF_THREADS + (void)initialize { if (self != [OFAutoreleasePool class]) return; if (!of_tlskey_new(&firstKey) || !of_tlskey_new(&lastKey)) @throw [OFInitializationFailedException newWithClass: self]; } #endif + (void)addObject: (id)object { #ifdef OF_THREADS id lastPool = of_tlskey_get(lastKey); #endif if (lastPool == nil) { @try { [[self alloc] init]; } @catch (id e) { [object release]; @throw e; } #ifdef OF_THREADS lastPool = of_tlskey_get(lastKey); #endif } if (lastPool == nil) { [object release]; @throw [OFInitializationFailedException newWithClass: self]; } @try { [lastPool addObject: object]; } @catch (id e) { [object release]; @throw e; } } + (void)releaseAll { #ifdef OF_THREADS [of_tlskey_get(firstKey) release]; #else [firstPool release]; #endif } - init { self = [super init]; @try { #ifdef OF_THREADS id firstPool = of_tlskey_get(firstKey); previousPool = of_tlskey_get(lastKey); if (!of_tlskey_set(lastKey, self)) @throw [OFInitializationFailedException newWithClass: isa]; #else previousPool = lastPool; lastPool = self; #endif if (firstPool == nil) { #ifdef OF_THREADS if (!of_tlskey_set(firstKey, self)) { of_tlskey_set(lastKey, previousPool); @throw [OFInitializationFailedException newWithClass: isa]; } #else firstPool = self; #endif } if (previousPool != nil) previousPool->nextPool = self; size = GROW_SIZE; objects = [self allocMemoryForNItems: GROW_SIZE withSize: sizeof(id)]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)addObject: (id)object { if (count + 1 > size) { objects = [self resizeMemory: objects toNItems: size + GROW_SIZE withSize: sizeof(id)]; size += GROW_SIZE; } objects[count] = object; count++; } - (void)releaseObjects { size_t i; [nextPool releaseObjects]; for (i = 0; i < count; i++) [objects[i] release]; count = 0; } |
︙ | ︙ | |||
164 165 166 167 168 169 170 | [self dealloc]; } - (void)dealloc { size_t i; | | | | | | | | | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | [self dealloc]; } - (void)dealloc { size_t i; [nextPool dealloc]; for (i = 0; i < count; i++) [objects[i] release]; /* * If of_tlskey_set fails, this is a real problem. The best we can do * is to not change the pool below the current pool and stop * deallocation. This way, new objects will be added to the current * pool, but released when the pool below gets released - and maybe * the pool itself will be released as well then, because maybe * of_tlskey_set will work this time. */ #ifdef OF_THREADS if (!of_tlskey_set(lastKey, previousPool)) return; #else lastPool = previousPool; #endif if (previousPool != nil) previousPool->nextPool = nil; /* * If of_tlskey_set fails here, this is even worse, as this will * definitely be a memory leak. But this should never happen anyway. */ #ifdef OF_THREADS if (of_tlskey_get(firstKey) == self) if (!of_tlskey_set(firstKey, nil)) return; #else if (firstPool == self) firstPool = nil; #endif [super dealloc]; } - retain { |
︙ | ︙ |
Modified src/OFBlock.h from [9fe373d7f9] to [bf2b3b26d3].
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #ifndef Block_copy # define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x))) #endif #ifndef Block_release # define Block_release(x) _Block_release((const void*)(x)) #endif @interface OFBlock: OFObject @end @interface OFStackBlock: OFBlock @end @interface OFGlobalBlock: OFBlock @end @interface OFMallocBlock: OFBlock @end | > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #ifndef Block_copy # define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x))) #endif #ifndef Block_release # define Block_release(x) _Block_release((const void*)(x)) #endif /** * \brief The class for all blocks, since all blocks are also objects. */ @interface OFBlock: OFObject @end @interface OFStackBlock: OFBlock @end @interface OFGlobalBlock: OFBlock @end @interface OFMallocBlock: OFBlock @end |
Modified src/OFCollection.h from [68e0dd67a3] to [6f614eaec7].
︙ | ︙ | |||
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 | */ @protocol OFCollection <OFObject> #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; /** * \param The object which is checked for being in the collection * \return A boolean whether the collection contains the specified object */ - (BOOL)containsObject: (id)object; /** * \param The object which is checked for being in the collection * \return A boolean whether the collection contains an object with the * specified address. */ - (BOOL)containsObjectIdenticalTo: (id)object; @end | > > > > > > > > > > > | 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 51 52 53 54 55 56 57 58 59 60 | */ @protocol OFCollection <OFObject> #ifdef OF_HAVE_PROPERTIES @property (readonly) size_t count; #endif /** * \brief Returns the number of objects in the collection. * * \return The number of objects in the collection */ - (size_t)count; /** * \brief Returns an OFEnumerator to enumerate through all objects of the * collection. * * \returns An OFEnumerator to enumerate through all objects of the collection */ - (OFEnumerator*)objectEnumerator; /** * \brief Checks whether the collection contains an object equal to the * specified object. * * \param The object which is checked for being in the collection * \return A boolean whether the collection contains the specified object */ - (BOOL)containsObject: (id)object; /** * \brief Checks whether the collection contains an object with the specified * address. * * \param The object which is checked for being in the collection * \return A boolean whether the collection contains an object with the * specified address. */ - (BOOL)containsObjectIdenticalTo: (id)object; @end |
Modified src/OFDataArray+Hashing.h from [de4d700a3e] to [2c45f510bc].
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 | /** * The OFDataArray (Hashing) category provides methods to calculate hashes for * data arrays. */ @interface OFDataArray (Hashing) /** * \return The MD5 hash of the data array as an autoreleased OFString */ - (OFString*)MD5Hash; /** | > > > > | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /** * The OFDataArray (Hashing) category provides methods to calculate hashes for * data arrays. */ @interface OFDataArray (Hashing) /** * \brief Returns the MD5 hash of the data array as an autoreleased OFString. * * \return The MD5 hash of the data array as an autoreleased OFString */ - (OFString*)MD5Hash; /** * \brief Returns the SHA-1 hash of the data array as an autoreleased OFString. * * \return The SHA-1 hash of the data array as an autoreleased OFString */ - (OFString*)SHA1Hash; @end |
Modified src/OFDataArray.h from [820a9e7684] to [6bb4b3ad3c].
︙ | ︙ | |||
34 35 36 37 38 39 40 | #ifdef OF_HAVE_PROPERTIES @property (readonly) size_t count; @property (readonly) size_t itemSize; #endif /** | | | | | | | | | | | | | | | | | | > > > > > > | > > > > | | | | | | | > > | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | #ifdef OF_HAVE_PROPERTIES @property (readonly) size_t count; @property (readonly) size_t itemSize; #endif /** * \brief Creates a new OFDataArray with an item size of 1. * * \return A new autoreleased OFDataArray */ + dataArray; /** * \brief Creates a new OFDataArray whose items all have the same size. * * \param itemSize The size of each element in the OFDataArray * \return A new autoreleased OFDataArray */ + dataArrayWithItemSize: (size_t)itemSize; /** * \brief Creates a new OFDataArary with an item size of 1, containing the data * of the specified file. * * \param path The path of the file * \return A new autoreleased OFDataArray */ + dataArrayWithContentsOfFile: (OFString*)path; /** * \brief Creates a new OFDataArray with an item size of 1, containing the data * of the specified URL. * * \param URL The URL to the contents for the OFDataArray * \return A new autoreleased OFDataArray */ + dataArrayWithContentsOfURL: (OFURL*)URL; /** * \brief Creates a new OFDataArray with an item size of 1, containing the data * of the Base64-encoded string. * * \param string The string with the Base64-encoded data * \return A new autoreleased OFDataArray */ + dataArrayWithBase64EncodedString: (OFString*)string; /** * \brief Initializes an already allocated OFDataArray with an item size of 1. * * \return A initialized OFDataArray */ - init; /** * \brief Initializes an already allocated OFDataArray whose items all have the * same size. * * \param itemSize The size of each element in the OFDataArray * \return An initialized OFDataArray */ - initWithItemSize: (size_t)itemSize; /** * \brief Initializes an already allocated OFDataArray with an item size of 1, * containing the data of the specified file. * * \param path The path of the file * \return An initialized OFDataArray */ - initWithContentsOfFile: (OFString*)path; /** * \brief Initializes an already allocated OFDataArray with an item size of 1, * containing the data of the specified URL. * * \param URL The URL to the contents for the OFDataArray * \return A new autoreleased OFDataArray */ - initWithContentsOfURL: (OFURL*)URL; /** * \brief Initializes an already allocated OFDataArray with an item size of 1, * containing the data of the Base64-encoded string. * * \param string The string with the Base64-encoded data * \return A initialized OFDataArray */ - initWithBase64EncodedString: (OFString*)string; /** * \brief Returns the number of items in the OFDataArray. * * \return The number of items in the OFDataArray */ - (size_t)count; /** * \brief Returns the size of each item in the OFDataArray in bytes. * * \return The size of each item in the OFDataArray in bytes */ - (size_t)itemSize; /** * \brief Returns all elements of the OFDataArray as a C array. * * \return All elements of the OFDataArray as a C array */ - (void*)cArray; /** * \brief Returns a specific item of the OFDataArray. * * \param index The number of the item to return * \return The specified item of the OFDataArray */ - (void*)itemAtIndex: (size_t)index; /** * \brief Returns the first item of the OFDataArray. * * \return The first item of the OFDataArray or NULL */ - (void*)firstItem; /** * \brief Returns the last item of the OFDataArray. * * \return The last item of the OFDataArray or NULL */ - (void*)lastItem; /** * \brief Adds an item to the OFDataArray. * * \param item A pointer to an arbitrary item */ - (void)addItem: (const void*)item; /** * \brief Adds an item to the OFDataArray at the specified index. * * \param item A pointer to an arbitrary item * \param index The index where the item should be added */ - (void)addItem: (const void*)item atIndex: (size_t)index; /** * \brief Adds items from a C array to the OFDataArray. * * \param nItems The number of items to add * \param cArray A C array containing the items to add */ - (void)addNItems: (size_t)nItems fromCArray: (const void*)cArray; /** * \brief Adds items from a C array to the OFDataArray at the specified index. * * \param nItems The number of items to add * \param cArray A C array containing the items to add * \param index The index where the items should be added */ - (void)addNItems: (size_t)nItems fromCArray: (const void*)cArray atIndex: (size_t)index; /** * \brief Removes the item at the specified index. * * \param index The index of the item to remove */ - (void)removeItemAtIndex: (size_t)index; /** * \brief Removes the specified amount of items from the end of the OFDataArray. * * \param nItems The number of items to remove */ - (void)removeNItems: (size_t)nItems; /** * \brief Removes the specified amount of items at the specified index. * * \param nItems The number of items to remove * \param index The index at which the items are removed */ - (void)removeNItems: (size_t)nItems atIndex: (size_t)index; /** * \brief Returns a string containing the data in Base64 encoding. * * \return A string containing the data in Base64 encoding */ - (OFString*)stringByBase64Encoding; /** * \brief Writes the OFDataArray into the specified file. * * \param path The path of the file to write to */ - (void)writeToFile: (OFString*)path; @end /** |
︙ | ︙ |
Modified src/OFDate.h from [94535e3a6e] to [501c2125ce].
︙ | ︙ | |||
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 51 52 53 54 55 56 57 58 59 60 61 62 63 | @interface OFDate: OFObject <OFCopying, OFComparing> { int64_t seconds; uint32_t microseconds; } /** * \return A new, autoreleased OFDate with the current date and time */ + date; /** * \param seconds The seconds since 1970-01-01T00:00:00Z * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSince1970: (int64_t)seconds; /** * \param seconds The seconds since 1970-01-01T00:00:00Z * \param microseconds The microsecond part of the time * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSince1970: (int64_t)seconds microseconds: (uint32_t)microseconds; /** * \param seconds The seconds since now * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSinceNow: (int64_t)seconds; /** * \param seconds The seconds since now * \param microseconds The microsecond part of the time * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSinceNow: (int64_t)seconds microseconds: (uint32_t)microseconds; /** | > > > > > > > > > > > > | > > | > > | > | > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > | | | 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | @interface OFDate: OFObject <OFCopying, OFComparing> { int64_t seconds; uint32_t microseconds; } /** * \brief Creates a new OFDate with the current date and time. * * \return A new, autoreleased OFDate with the current date and time */ + date; /** * \brief Creates a new OFDate with the specified date and time since * 1970-01-01T00:00:00Z. * * \param seconds The seconds since 1970-01-01T00:00:00Z * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSince1970: (int64_t)seconds; /** * \brief Creates a new OFDate with the specified date and time since * 1970-01-01T00:00:00Z. * * \param seconds The seconds since 1970-01-01T00:00:00Z * \param microseconds The microsecond part of the time * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSince1970: (int64_t)seconds microseconds: (uint32_t)microseconds; /** * \brief Creates a new OFDate with the specified date and time since now. * * \param seconds The seconds since now * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSinceNow: (int64_t)seconds; /** * \brief Creates a new OFDate with the specified date and time since now. * * \param seconds The seconds since now * \param microseconds The microsecond part of the time * \return A new, autoreleased OFDate with the specified date and time */ + dateWithTimeIntervalSinceNow: (int64_t)seconds microseconds: (uint32_t)microseconds; /** * \brief Returns a date in the distant future. * * The date is system-dependant. * * \return A date in the distant future */ + distantFuture; /** * \brief Returns a date in the distant past. * * The date is system-dependant. * * \return A date in the distant past */ + distantPast; /** * \brief Initializes an already allocated OFDate with the specified date and * time since 1970-01-01T00:00:00Z. * * \param seconds The seconds since 1970-01-01T00:00:00Z * \return An initialized OFDate with the specified date and time */ - initWithTimeIntervalSince1970: (int64_t)seconds; /** * \brief Initializes an already allocated OFDate with the specified date and * time since 1970-01-01T00:00:00Z. * * \param seconds The seconds since 1970-01-01T00:00:00Z * \param microseconds The microsecond part of the time * \return An initialized OFDate with the specified date and time */ - initWithTimeIntervalSince1970: (int64_t)seconds microseconds: (uint32_t)microseconds; /** * \brief Initializes an already allocated OFDate with the specified date and * time since now. * * \param seconds The seconds since now * \return A new, autoreleased OFDate with the specified date and time */ - initWithTimeIntervalSinceNow: (int64_t)seconds; /** * \brief Initializes an already allocated OFDate with the specified date and * time since now. * * \param seconds The seconds since now * \param microseconds The microsecond part of the time * \return A new, autoreleased OFDate with the specified date and time */ - initWithTimeIntervalSinceNow: (int64_t)seconds microseconds: (uint32_t)microseconds; /** * \brief Returns the microsecond of the date. * * \return The microsecond of the date */ - (uint32_t)microsecond; /** * \brief Returns the second of the date. * * \return The second of the date */ - (uint8_t)second; /** * \brief Returns the minute of the date. * * \return The minute of the date */ - (uint8_t)minute; /** * \brief Returns the hour of the date. * * \return The hour of the date */ - (uint8_t)hour; /** * \brief Returns the hour of the date in local time. * * \return The hour of the date in local time */ - (uint8_t)localHour; /** * \brief Returns the day of the month. * * \return The day of the month of the date */ - (uint8_t)dayOfMonth; /** * \brief Returns the day of the month of the date in local time. * * \return The day of the month of the date in local time */ - (uint8_t)localDayOfMonth; /** * \brief Returns the month of the year of the date. * * \return The month of the year of the date */ - (uint8_t)monthOfYear; /** * \brief Returns the month of the year of the date in local time. * * \return The month of the year of the date in local time */ - (uint8_t)localMonthOfYear; /** * \brief Returns the year of the date. * * \return The year of the date */ - (uint16_t)year; /** * \brief Returns the day of the week of the date. * * \return The day of the week of the date */ - (uint8_t)dayOfWeek; /** * \brief Returns the day of the week of the date in local time. * * \return The day of the week of the date in local time */ - (uint8_t)localDayOfWeek; /** * \brief Returns the day of the year of the date. * * \return The day of the year of the date */ - (uint16_t)dayOfYear; /** * \brief Returns the day of the year of the date in local time. * * \return The day of the year of the date in local time */ - (uint16_t)localDayOfYear; /** * \brief Creates a string of the date with the specified format. * * See the manpage for strftime for information on the format. * * \param fmt The format for the date string * \return A new, autoreleased OFString */ - (OFString*)dateStringWithFormat: (OFString*)fmt; /** * \brief Creates a string of the local date with the specified format. * * See the manpage for strftime for information on the format. * * \param fmt The format for the date string * \return A new, autoreleased OFString */ - (OFString*)localDateStringWithFormat: (OFString*)fmt; /** * \brief Returns the earlier of the two dates. * * \param date Another date * \return The earlier date of the two dates */ - (OFDate*)earlierDate: (OFDate*)otherDate; /** * \brief Returns the later of the two dates. * * \param date Another date * \return The later date of the two dates */ - (OFDate*)laterDate: (OFDate*)otherDate; /** * \brief Returns the seconds since 1970-01-01T00:00:00Z. * * \return The seconds since 1970-01-01T00:00:00Z */ - (int64_t)timeIntervalSince1970; /** * \brief Returns the microseconds part of the seconds since * 1970-01-01T00:00:00Z. * * \return The microseconds part of the seconds since 1970-01-01T00:00:00Z */ - (uint32_t)microsecondsOfTimeIntervalSince1970; /** * \brief Returns the seconds the receiver is after the date. * * \return The seconds the receiver is after the date. */ - (int64_t)timeIntervalSinceDate: (OFDate*)otherDate; /** * \brief Returns the microseconds part of the seconds the receiver is after the * date. * * \return The microseconds part of the seconds the receiver is after the date */ - (uint32_t)microsecondsOfTimeIntervalSinceDate: (OFDate*)otherDate; /** * \brief Returns a new date with the specified time interval added. * * \param seconds The seconds after the date * \return A new, autoreleased OFDate */ - (OFDate*)dateByAddingTimeInterval: (int64_t)seconds; /** * \brief Returns a new date with the specified time interval added. * * \param seconds The seconds after the date * \param microseconds The microseconds after the date * \return A new, autoreleased OFDate */ - (OFDate*)dateByAddingTimeInterval: (int64_t)seconds withMicroseconds: (uint32_t)microseconds; @end |
Modified src/OFDictionary.h from [21642e8123] to [2c4b841ea9].
︙ | ︙ | |||
44 45 46 47 48 49 50 | { struct of_dictionary_bucket **data; uint32_t size; size_t count; } /** | | | | | | | | | | | | | | | | | | > > | | > | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | { struct of_dictionary_bucket **data; uint32_t size; size_t count; } /** * \brief Creates a new OFDictionary. * * \return A new autoreleased OFDictionary */ + dictionary; /** * \brief Creates a new OFDictionary with the specified dictionary. * * \param dictionary An OFDictionary * \return A new autoreleased OFDictionary */ + dictionaryWithDictionary: (OFDictionary*)dictionary; /** * \brief Creates a new OFDictionary with the specified key and object. * * \param key The key * \param object The object * \return A new autoreleased OFDictionary */ + dictionaryWithObject: (id)object forKey: (id <OFCopying>)key; /** * \brief Creates a new OFDictionary with the specified keys and objects. * * \param keys An array of keys * \param objects An array of objects * \return A new autoreleased OFDictionary */ + dictionaryWithObjects: (OFArray*)objects forKeys: (OFArray*)keys; /** * \brief Creates a new OFDictionary with the specified keys objects. * * \param firstKey The first key * \return A new autoreleased OFDictionary */ + dictionaryWithKeysAndObjects: (id <OFCopying>)firstKey, ...; /** * \brief Initializes an already allocated OFDictionary. * * \return An initialized OFDictionary */ - init; /** * \brief Initializes an already allocated OFDictionary with the specified * OFDictionary. * * \param dictionary An OFDictionary * \return An initialized OFDictionary */ - initWithDictionary: (OFDictionary*)dictionary; /** * \brief Initializes an already allocated OFDictionary with the specified key * and object. * * \param key The key * \param object The object * \return A new initialized OFDictionary */ - initWithObject: (id)object forKey: (id <OFCopying>)key; /** * \brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * \param keys An array of keys * \param objects An array of objects * \return A new initialized OFDictionary */ - initWithObjects: (OFArray*)objects forKeys: (OFArray*)keys; /** * \brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * \param firstKey The first key * \return A new initialized OFDictionary */ - initWithKeysAndObjects: (id <OFCopying>)firstKey, ...; /** * \brief Initializes an already allocated OFDictionary with the specified key * and va_list. * * \param firstKey The first key * \param arguments A va_list of the other arguments * \return A new initialized OFDictionary */ - initWithKey: (id <OFCopying>)firstKey arguments: (va_list)arguments; /** * \brief Returns the object for the given key or nil if the key was not found. * * The returned object is <i>not</i> retained and autoreleased for performance * 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; /** * \brief Returns an OFEnumerator to enumerate through the dictionary's keys. * * \return An OFEnumerator to enumerate through the dictionary's keys */ - (OFEnumerator*)keyEnumerator; #ifdef OF_HAVE_BLOCKS /** * \brief Executes a block for each key / object pair. * * \param block The block to execute for each key / object pair. */ - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block; /** * \brief Returns a new dictionary, mapping each object using the specified * block. * * \param block A block which maps an object for each object * \return A new, autorelease OFDictionary */ - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block; /** * \brief Returns a new dictionary, only containing the objects for which the * block returns YES. * * \param block A block which determines if the object should be in the new * dictionary * \return A new, autoreleased OFDictionary */ - (OFDictionary*)filteredDictionaryUsingBlock: (of_dictionary_filter_block_t)block; |
︙ | ︙ |
Modified src/OFEnumerator.h from [ce902d7cb6] to [49a8f37445].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 | #import "OFObject.h" /** * \brief A class which provides methods to enumerate through collections. */ @interface OFEnumerator: OFObject /** * \return The next object */ - (id)nextObject; /** | > > | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #import "OFObject.h" /** * \brief A class which provides methods to enumerate through collections. */ @interface OFEnumerator: OFObject /** * \brief Returns the next object. * * \return The next object */ - (id)nextObject; /** * \brief Resets the enumerator, so the next call to nextObject returns the * first object again. */ - (void)reset; @end /* * This needs to be exactly like this because it's hardcoded in the compiler. * |
︙ | ︙ |