picofuse-objc

NXData.h
Go to the documentation of this file.
1 
5 #pragma once
6 #include "NXHashAlgorithm.h"
7 #include <stddef.h>
8 #include <stdint.h>
9 
21 @interface NXData : NXObject {
22 @private
23  uint8_t *_bytes;
24  size_t _length;
25  size_t _capacity;
26  uintptr_t _changing;
27 }
28 
32 + (id)data;
33 
38 + (id)dataWithCapacity:(size_t)capacity;
39 
47 + (id)dataWithBytes:(const void *)bytes length:(size_t)length;
48 
55 + (id)dataWithBase64String:(NXString *)string;
56 
63 + (id)dataWithString:(NXString *)string;
64 
68 - (id)initWithCapacity:(size_t)capacity;
69 
73 - (id)initWithBytes:(const void *)bytes length:(size_t)length;
74 
78 - (id)initWithBase64String:(NXString *)string;
79 
83 - (size_t)length;
84 
88 - (size_t)capacity;
89 
94 - (const void *)bytes;
95 
101 - (BOOL)appendBytes:(const void *)bytes length:(size_t)length;
102 
107 - (BOOL)appendData:(NXData *)data;
108 
114 
120 - (NXData *)hashWithAlgorithm:(NXHashAlgorithm)algorithm;
121 
125 - (BOOL)isEqual:(id)anObject;
126 
130 - (uintptr_t)hash;
131 
136 - (id)copy;
137 
141 - (NXString *)description;
142 
143 @end
id copy()
Returns new data with the same bytes, or nil if there isn&#39;t enough memory.
Defines the NXHashAlgorithm type, for algorithms which hash data.
size_t capacity()
Returns the number of bytes there&#39;s room for, before more memory is needed.
size_t length()
Returns the number of bytes.
NXString * base64String()
Returns the bytes encoded in base64, in the standard alphabet of RFC 4648 with "=" padding...
NXHashAlgorithm
Algorithms which hash data.
NXString * description()
Returns the bytes in hexadecimal, such as "<0a1b2c>".
bool BOOL
A Boolean value.
Definition: runtime.h:60
const void * bytes()
Returns the bytes, which are only valid until the data is changed or deallocated, or NULL if there ar...
uintptr_t hash()
Returns a hash of the bytes, which is the same for equal data.
A string of UTF-8 text.
Definition: NXString.h:53
The base class for objects in the Foundation framework.
Definition: NXObject.h:28
id data()
Returns empty data.
struct objc_object * id
A pointer to an instance of a class.
Definition: runtime.h:18
Bytes, which can be added to.
Definition: NXData.h:21