#include <assert.h>
#include "Hash.h"
#include "Dictionary.h"
#include "URLRequest.h"
Go to the source code of this file.
◆ _Class
◆ _URLRequest()
| Class * _URLRequest |
( |
void |
| ) |
|
Definition at line 204 of file URLRequest.c.
204 {
207
210 .name = "URLRequest",
213 .interfaceOffset = offsetof(
URLRequest, interface),
214 .interfaceSize = sizeof(URLRequestInterface),
216 });
217 });
218
219 return clazz;
220}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
static void initialize(Class *clazz)
#define do_once(once, block)
Executes the given block at most one time.
ClassDefs are passed to _initialize via an archetype to initialize a Class.
The runtime representation of a Class.
A protocol-agnostic abstraction for requesting resources via URLs.
◆ copy()
- See also
- Object::copy(const Object *)
Definition at line 37 of file URLRequest.c.
37 {
38
40
42
43 if (this->httpBody) {
45 }
46
47 if (this->httpHeaders) {
49 }
50
52
54}
#define alloc(type)
Allocate and initialize and instance of type.
static URLRequest * initWithURL(URLRequest *self, URL *url)
static Object * copy(const Object *self)
Object is the root Class of The Objectively Class hierarchy.
HTTPMethod httpMethod
The HTTP request method.
Dictionary * httpHeaders
The HTTP request headers.
Data * httpBody
The HTTP request body, sent as POST or PUT data.
◆ dealloc()
| static void dealloc |
( |
Object * |
self | ) |
|
|
static |
- See also
- Object::dealloc(Object *)
Definition at line 59 of file URLRequest.c.
59 {
60
62
66
68}
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
#define super(type, obj, method,...)
static void dealloc(Object *self)
◆ hash()
| static int hash |
( |
const Object * |
self | ) |
|
|
static |
- See also
- Object::hash(const Object *)
Definition at line 73 of file URLRequest.c.
73 {
74
76
81
82 if (this->httpHeaders) {
83
86
87 int headersHash = 0;
88 for (
size_t i = 0; i < keys->
count; i++) {
89
92
96
97 headersHash += pairHash;
98 }
99
101
104 }
105
107}
static ident objectAtIndex(const Array *self, size_t index)
static Array * allKeys(const Dictionary *self)
static ident objectForKey(const Dictionary *self, const ident key)
int HashForInteger(int hash, const long integer)
Accumulates the hash value of integer into hash.
int HashForObject(int hash, const ident obj)
Accumulates the hash value of object into hash.
#define HASH_SEED
The hash seed value.
void * ident
The identity type, similar to Objective-C id.
static int hash(const Object *self)
size_t count
The count of elements.
◆ initialize()
| static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 189 of file URLRequest.c.
189 {
190
195
198}
static void setValueForHTTPHeaderField(URLRequest *self, const char *value, const char *field)
static bool isEqual(const Object *self, const Object *other)
ident interface
The interface of the Class.
int hash(const Object *self)
void setValueForHTTPHeaderField(URLREquest *self, const char *value, const char *field)
◆ initWithURL()
Definition at line 150 of file URLRequest.c.
150 {
151
152 assert(url);
153
155 if (self) {
158
160 }
161
162 return self;
163}
static Array * init(Array *self)
ident retain(ident obj)
Atomically increment the given Object's reference count.
◆ isEqual()
| static bool isEqual |
( |
const Object * |
self, |
|
|
const Object * |
other |
|
) |
| |
|
static |
- See also
- Object::isEqual(const Object *, const Object *)
Definition at line 124 of file URLRequest.c.
124 {
125
127 return true;
128 }
129
131
134
139 }
140
141 return false;
142}
static bool isKindOfClass(const Object *self, const Class *clazz)
static bool objectEquals(const Object *self, const Object *other)
Tests equality of two Objects, accounting for NULL.
Class * _URLRequest(void)
◆ objectEquals()
| static bool objectEquals |
( |
const Object * |
self, |
|
|
const Object * |
other |
|
) |
| |
|
static |
Tests equality of two Objects, accounting for NULL.
Definition at line 112 of file URLRequest.c.
112 {
113
114 if (self) {
115 return other && $(self,
isEqual, other);
116 }
117
118 return other == NULL;
119}
◆ setValueForHTTPHeaderField()
| static void setValueForHTTPHeaderField |
( |
URLRequest * |
self, |
|
|
const char * |
value, |
|
|
const char * |
field |
|
) |
| |
|
static |
Definition at line 169 of file URLRequest.c.
169 {
170
173 }
174
177
179
182}
static void setObjectForKey(Dictionary *self, const ident obj, const ident key)
String * str(const char *fmt,...)