Differences From Artifact [fdd2b6ed1c]:
- File
src/OFList.h
— part of check-in
[24ecf55297]
at
2009-06-29 12:33:59
on branch trunk
— Changes to OFDictionary, OFIterator and OFList - see details.
OFDictionary:
* More optimized way to internally store the data.
* Faster resizing of dictionaries (no rehashing anymore).OFIterator:
* Return a key/object pair rather than first the key and then the
object.OFList:
* Support for list objects with a different size so you can have your
own list object structs. (user: js, size: 3309) [annotate] [blame] [check-ins using]
To Artifact [493af3623a]:
- File src/OFList.h — part of check-in [146db53e4a] at 2009-08-26 19:40:11 on branch trunk — Improve documentation. (user: js, size: 3606) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. 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 "OFObject.h" typedef struct __of_list_object { struct __of_list_object *next; struct __of_list_object *prev; id object; } of_list_object_t; /** * The OFList class provides easy to use double-linked lists. */ @interface OFList: OFObject <OFCopying> | > > > > > > > | 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 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. 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 "OFObject.h" /** * A struct that contains a pointer to the next list object, the previous list * object and the object. */ typedef struct __of_list_object { /// A pointer to the next list object in the list struct __of_list_object *next; /// A pointer to the previous list object in the list struct __of_list_object *prev; /// The object for the list object id object; } of_list_object_t; /** * The OFList class provides easy to use double-linked lists. */ @interface OFList: OFObject <OFCopying> |
︙ | ︙ | |||
44 45 46 47 48 49 50 | * * \param listobj_size The size of a list object * \return An initialized OFList with the specified list object size */ - initWithListObjectSize: (size_t)listobj_size; /** | | | | | | 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 | * * \param listobj_size The size of a list object * \return An initialized OFList with the specified list object size */ - initWithListObjectSize: (size_t)listobj_size; /** * Initializes an already allocated OFList that does not retain/release objects * added to it. * * \return An initialized OFList */ - initWithoutRetainAndRelease; /** * \return The first list object in the list */ - (of_list_object_t*)first; /** * \return The last list object in the list */ - (of_list_object_t*)last; /** * Appends an object to the list. * * \param obj The object to append |
︙ | ︙ | |||
106 107 108 109 110 111 112 | * For example, if you want to remove an object from the list, you need * its of_list_object_t. */ - (of_list_object_t*)insert: (id)obj after: (of_list_object_t*)listobj; /** | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | * For example, if you want to remove an object from the list, you need * its of_list_object_t. */ - (of_list_object_t*)insert: (id)obj after: (of_list_object_t*)listobj; /** * Removes the object with the specified list object from the list. * * \param listobj The list object returned by append / prepend */ - remove: (of_list_object_t*)listobj; /** * Get the number of items in the list. Use with caution, as this means one * iteration through the whole list! * * \return The number of items in the list. */ - (size_t)count; @end |