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
|
* file.
*/
#import "OFData.h"
OF_ASSUME_NONNULL_BEGIN
@class OFString;
/**
* @class OFMutableData OFMutableData.h ObjFW/OFMutableData.h
*
* @brief A class for storing and manipulating arbitrary data in an array.
*/
@interface OFMutableData: OFData
{
size_t _capacity;
OF_RESERVE_IVARS(OFMutableData, 4)
}
/**
* @brief All items of the OFMutableData as a C array.
*
* @warning The pointer is only valid until the OFMutableData is changed!
*
* Modifying the returned array directly is allowed and will change the contents
* of the data.
|
<
<
<
<
<
<
<
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
* file.
*/
#import "OFData.h"
OF_ASSUME_NONNULL_BEGIN
/**
* @class OFMutableData OFMutableData.h ObjFW/OFMutableData.h
*
* @brief A class for storing and manipulating arbitrary data in an array.
*/
@interface OFMutableData: OFData
/**
* @brief All items of the OFMutableData as a C array.
*
* @warning The pointer is only valid until the OFMutableData is changed!
*
* Modifying the returned array directly is allowed and will change the contents
* of the data.
|
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
|
/**
* @brief The last item of the OFMutableData or `NULL`.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableLastItem
OF_RETURNS_INNER_POINTER;
/**
* @brief Creates a new OFMutableData with an item size of 1.
*
* @return A new autoreleased OFMutableData
*/
+ (instancetype)data;
/**
* @brief Creates a new OFMutableData whose items all have the same specified
* size.
*
* @param itemSize The size of a single element in the OFMutableData
* @return A new autoreleased OFMutableData
*/
+ (instancetype)dataWithItemSize: (size_t)itemSize;
/**
* @brief Creates a new OFMutableData 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 OFMutableData
* @return A new autoreleased OFMutableData
*/
+ (instancetype)dataWithCapacity: (size_t)capacity;
/**
* @brief Creates a new OFMutableData 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 OFMutableData
* @param capacity The initial capacity for the OFMutableData
* @return A new autoreleased OFMutableData
*/
+ (instancetype)dataWithItemSize: (size_t)itemSize capacity: (size_t)capacity;
/**
* @brief Initializes an already allocated OFMutableData with an item size of 1.
*
* @return An initialized OFMutableData
*/
- (instancetype)init;
/**
* @brief Initializes an already allocated OFMutableData whose items all have
* the same size.
*
* @param itemSize The size of a single element in the OFMutableData
* @return An initialized OFMutableData
*/
- (instancetype)initWithItemSize: (size_t)itemSize;
/**
* @brief Initializes an already allocated OFMutableData with enough memory to
* hold the the specified number of items which all have an item size of
* 1.
*
* @param capacity The initial capacity for the OFMutableData
* @return An initialized OFMutableData
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
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
|
/**
* @brief The last item of the OFMutableData or `NULL`.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableLastItem
OF_RETURNS_INNER_POINTER;
/**
* @brief Creates a new OFMutableData 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 OFMutableData
* @return A new autoreleased OFMutableData
*/
+ (instancetype)dataWithCapacity: (size_t)capacity;
/**
* @brief Creates a new OFMutableData 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 OFMutableData
* @param capacity The initial capacity for the OFMutableData
* @return A new autoreleased OFMutableData
*/
+ (instancetype)dataWithItemSize: (size_t)itemSize capacity: (size_t)capacity;
/**
* @brief Initializes an already allocated OFMutableData with enough memory to
* hold the the specified number of items which all have an item size of
* 1.
*
* @param capacity The initial capacity for the OFMutableData
* @return An initialized OFMutableData
|