ObjFW  Check-in [925bf9f8b1]

Overview
Comment:Add -[OFDataArray dataArrayWithCapacity:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 925bf9f8b158c5893626a5053a960dd36c73b159f0e63f4ffce42be4fec4280f
User & Date: js on 2013-06-19 22:49:58
Other Links: manifest | tags
Context
2013-06-20
08:13
Add support for MessagePack extensions. check-in: 5ec11e8b56 user: js tags: trunk
2013-06-19
22:49
Add -[OFDataArray dataArrayWithCapacity:]. check-in: 925bf9f8b1 user: js tags: trunk
19:14
Implement the new MessagePack specification. check-in: cba771824e user: js tags: trunk
Changes

Modified src/OFDataArray.h from [76850fcca7] to [314b165e30].

55
56
57
58
59
60
61









62
63
64
65
66
67
68
 *	  size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @return A new autoreleased OFDataArray
 */
+ (instancetype)dataArrayWithItemSize: (size_t)itemSize;










/*!
 * @brief Creates a new OFDataArray with enough memory to hold the specified
 *	  number of items which all have the same specified size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @param capacity The initial capacity for the OFDataArray
 * @return A new autoreleased OFDataArray







>
>
>
>
>
>
>
>
>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 *	  size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @return A new autoreleased OFDataArray
 */
+ (instancetype)dataArrayWithItemSize: (size_t)itemSize;

/*!
 * @brief Creates a new OFDataArray with enough memory to hold the specified
 *	  number of items which all have an item size of 1.
 *
 * @param capacity The initial capacity for the OFDataArray
 * @return A new autoreleased OFDataArray
 */
+ (instancetype)dataArrayWithCapacity: (size_t)capacity;

/*!
 * @brief Creates a new OFDataArray with enough memory to hold the specified
 *	  number of items which all have the same specified size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @param capacity The initial capacity for the OFDataArray
 * @return A new autoreleased OFDataArray
111
112
113
114
115
116
117









118
119
120
121
122
123
124
 *	  same size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @return An initialized OFDataArray
 */
- initWithItemSize: (size_t)itemSize;










/*!
 * @brief Initializes an already allocated OFDataArray with enough memory to
 *	  hold the specified number of items which all have the same specified
 *	  size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @param capacity The initial capacity for the OFDataArray







>
>
>
>
>
>
>
>
>







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
 *	  same size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @return An initialized OFDataArray
 */
- initWithItemSize: (size_t)itemSize;

/*!
 * @brief Initializes an already allocated OFDataArray with enough memory to
 *	  hold the specified number of items which all have an item size of 1.
 *
 * @param capacity The initial capacity for the OFDataArray
 * @return An initialized OFDataArray
 */
- initWithCapacity: (size_t)capacity;

/*!
 * @brief Initializes an already allocated OFDataArray with enough memory to
 *	  hold the specified number of items which all have the same specified
 *	  size.
 *
 * @param itemSize The size of a single element in the OFDataArray
 * @param capacity The initial capacity for the OFDataArray

Modified src/OFDataArray.m from [c47726834e] to [c782595990].

60
61
62
63
64
65
66





67
68
69
70
71
72
73
	return [[[self alloc] init] autorelease];
}

+ (instancetype)dataArrayWithItemSize: (size_t)itemSize
{
	return [[[self alloc] initWithItemSize: itemSize] autorelease];
}






+ (instancetype)dataArrayWithItemSize: (size_t)itemSize
			     capacity: (size_t)capacity
{
	return [[[self alloc] initWithItemSize: itemSize
				      capacity: capacity] autorelease];
}







>
>
>
>
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
	return [[[self alloc] init] autorelease];
}

+ (instancetype)dataArrayWithItemSize: (size_t)itemSize
{
	return [[[self alloc] initWithItemSize: itemSize] autorelease];
}

+ (instancetype)dataArrayWithCapacity: (size_t)capacity
{
	return [[[self alloc] initWithCapacity: capacity] autorelease];
}

+ (instancetype)dataArrayWithItemSize: (size_t)itemSize
			     capacity: (size_t)capacity
{
	return [[[self alloc] initWithItemSize: itemSize
				      capacity: capacity] autorelease];
}
100
101
102
103
104
105
106






107
108
109
110
111
112
113
}

- initWithItemSize: (size_t)itemSize
{
	return [self initWithItemSize: itemSize
			     capacity: 0];
}







- initWithItemSize: (size_t)itemSize
	  capacity: (size_t)capacity
{
	self = [super init];

	if (itemSize == 0) {







>
>
>
>
>
>







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
}

- initWithItemSize: (size_t)itemSize
{
	return [self initWithItemSize: itemSize
			     capacity: 0];
}

- initWithCapacity: (size_t)capacity
{
	return [self initWithItemSize: 1
			     capacity: capacity];
}

- initWithItemSize: (size_t)itemSize
	  capacity: (size_t)capacity
{
	self = [super init];

	if (itemSize == 0) {