ObjFW  Diff

Differences From Artifact [78a81eb330]:

To Artifact [b5feba23f0]:


18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32







-
+







#import "OFMessagePackRepresentation.h"

/*! @file */

OF_ASSUME_NONNULL_BEGIN

@class OFString;
@class OFURL;
@class OFURI;

/**
 * @brief Options for searching in data.
 *
 * This is a bit mask.
 */
typedef enum {
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
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







-
+

-
+


-
+







+
+









+
+







 * @return A new autoreleased OFData
 */
+ (instancetype)dataWithContentsOfFile: (OFString *)path;
#endif

/**
 * @brief Creates a new OFData with an item size of 1, containing the data of
 *	  the specified URL.
 *	  the specified URI.
 *
 * @param URL The URL to the contents for the OFData
 * @param URI The URI to the contents for the OFData
 * @return A new autoreleased OFData
 */
+ (instancetype)dataWithContentsOfURL: (OFURL *)URL;
+ (instancetype)dataWithContentsOfURI: (OFURI *)URI;

/**
 * @brief Creates a new OFData with an item size of 1, containing the data of
 *	  the hex string representation.
 *
 * @param string The hex string representation of the data
 * @return A new autoreleased OFData
 * @throw OFInvalidFormatException The specified string is not correctly
 *				   formatted
 */
+ (instancetype)dataWithStringRepresentation: (OFString *)string;

/**
 * @brief Creates a new OFData 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 OFData
 * @throw OFInvalidFormatException The specified string is not correctly
 *				   formatted
 */
+ (instancetype)dataWithBase64EncodedString: (OFString *)string;

/**
 * @brief Initializes an already allocated OFData with the specified `count`
 *	  items of size 1.
 *
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
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







-
+

-
+


-
+







+
+









+
+







 * @return An initialized OFData
 */
- (instancetype)initWithContentsOfFile: (OFString *)path;
#endif

/**
 * @brief Initializes an already allocated OFData with an item size of 1,
 *	  containing the data of the specified URL.
 *	  containing the data of the specified URI.
 *
 * @param URL The URL to the contents for the OFData
 * @param URI The URI to the contents for the OFData
 * @return A new autoreleased OFData
 */
- (instancetype)initWithContentsOfURL: (OFURL *)URL;
- (instancetype)initWithContentsOfURI: (OFURI *)URI;

/**
 * @brief Initializes an already allocated OFData with an item size of 1,
 *	  containing the data of the hex string representation.
 *
 * @param string The hex string representation of the data
 * @return A new autoreleased OFData
 * @throw OFInvalidFormatException The specified string is not correctly
 *				   formatted
 */
- (instancetype)initWithStringRepresentation: (OFString *)string;

/**
 * @brief Initializes an already allocated OFData with an item size of 1,
 *	  containing the data of the Base64-encoded string.
 *
 * @param string The string with the Base64-encoded data
 * @return An initialized OFData
 * @throw OFInvalidFormatException The specified string is not correctly
 *				   formatted
 */
- (instancetype)initWithBase64EncodedString: (OFString *)string;

/**
 * @brief Compares the data to other data.
 *
 * @param data Data to compare the data to
334
335
336
337
338
339
340
341

342
343

344
345

346
347
348
349
350
351
352
353
342
343
344
345
346
347
348

349
350

351
352

353
354
355
356
357
358
359
360
361







-
+

-
+

-
+








 *
 * @param path The path of the file to write to
 */
- (void)writeToFile: (OFString *)path;
#endif

/**
 * @brief Writes the OFData to the specified URL.
 * @brief Writes the OFData to the specified URI.
 *
 * @param URL The URL to write to
 * @param URI The URI to write to
 */
- (void)writeToURL: (OFURL *)URL;
- (void)writeToURI: (OFURI *)URI;
@end

OF_ASSUME_NONNULL_END

#import "OFMutableData.h"
#import "OFData+ASN1DERParsing.h"
#import "OFData+CryptographicHashing.h"
#import "OFData+MessagePackParsing.h"