ObjFW
Loading...
Searching...
No Matches
OFMutableData.h
1/*
2 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3.0 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * version 3.0 for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * version 3.0 along with this program. If not, see
17 * <https://www.gnu.org/licenses/>.
18 */
19
20#import "OFData.h"
21
22OF_ASSUME_NONNULL_BEGIN
23
38@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableItems
39 OF_RETURNS_INNER_POINTER;
40
44@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableFirstItem
45 OF_RETURNS_INNER_POINTER;
46
50@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableLastItem
51 OF_RETURNS_INNER_POINTER;
52
60+ (instancetype)dataWithCapacity: (size_t)capacity;
61
70+ (instancetype)dataWithItemSize: (size_t)itemSize capacity: (size_t)capacity;
71
80- (instancetype)initWithCapacity: (size_t)capacity;
81
91- (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity;
92
102- (void *)mutableItemAtIndex: (size_t)index OF_RETURNS_INNER_POINTER;
103
109- (void)addItem: (const void *)item;
110
117- (void)insertItem: (const void *)item atIndex: (size_t)index;
118
125- (void)addItems: (const void *)items count: (size_t)count;
126
134- (void)insertItems: (const void *)items
135 atIndex: (size_t)index
136 count: (size_t)count;
137
144- (void)increaseCountBy: (size_t)count;
145
151- (void)removeItemAtIndex: (size_t)index;
152
158- (void)removeItemsInRange: (OFRange)range;
159
163- (void)removeLastItem;
164
168- (void)removeAllItems;
169
173- (void)makeImmutable;
174@end
175
176OF_ASSUME_NONNULL_END
A class for storing arbitrary data in an array.
Definition OFData.h:46
A class for storing and manipulating arbitrary data in an array.
Definition OFMutableData.h:30
void removeAllItems()
Removes all items.
Definition OFMutableData.m:280
void * mutableItems
All items of the OFMutableData as a C array.
Definition OFMutableData.h:39
void makeImmutable()
Converts the mutable data to an immutable data.
Definition OFMutableData.m:292
void removeLastItem()
Removes the last item.
Definition OFMutableData.m:270
void * mutableFirstItem
The first item of the OFMutableData or NULL.
Definition OFMutableData.h:45
void * mutableLastItem
The last item of the OFMutableData or NULL.
Definition OFMutableData.h:51
A range.
Definition OFObject.h:110