ObjFW  Check-in [881cfff24e]

Overview
Comment:Add ARC type qualifiers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 881cfff24ece8371fbd56cc596ab38bba9131f89273bc50defd9e69c4b740041
User & Date: js on 2012-08-03 18:45:44
Other Links: manifest | tags
Context
2012-08-03
20:49
Add class_isMetaClass(). check-in: c50d4f7837 user: js tags: trunk
18:45
Add ARC type qualifiers. check-in: 881cfff24e user: js tags: trunk
2012-08-01
11:48
PLATFORMS.md: Add Windows. check-in: 8b0f7b5394 user: js tags: trunk
Changes

Modified src/OFArray.h from [01516d5008] to [96960c00c0].

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

/**
 * \brief Copies the objects at the specified range to the specified buffer.
 *
 * \param buffer The buffer to copy the objects to
 * \param range The range to copy
 */
- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range;

/**
 * \brief Returns the objects of the array as a C array.
 *
 * \return The objects of the array as a C array
 */







|







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

/**
 * \brief Copies the objects at the specified range to the specified buffer.
 *
 * \param buffer The buffer to copy the objects to
 * \param range The range to copy
 */
- (void)getObjects: (__unsafe_unretained id*)buffer
	   inRange: (of_range_t)range;

/**
 * \brief Returns the objects of the array as a C array.
 *
 * \return The objects of the array as a C array
 */

Modified src/OFDataArray.h from [4922f55b79] to [2fa85a1a7b].

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
 * \warning The pointer is only valid until the OFDataArray is changed!
 *
 * Modifying the returned array directly is allowed and will change the contents
 * of the data array.
 *
 * \return All elements of the OFDataArray as a C array
 */
- (void*)cArray;

/**
 * \brief Returns a specific item of the OFDataArray.
 *
 * \param index The number of the item to return
 * \return The specified item of the OFDataArray
 */
- (void*)itemAtIndex: (size_t)index;

/**
 * \brief Returns the first item of the OFDataArray.
 *
 * \return The first item of the OFDataArray or NULL
 */
- (void*)firstItem;

/**
 * \brief Returns the last item of the OFDataArray.
 *
 * \return The last item of the OFDataArray or NULL
 */
- (void*)lastItem;

/**
 * \brief Adds an item to the OFDataArray.
 *
 * \param item A pointer to an arbitrary item
 */
- (void)addItem: (const void*)item;







|







|






|






|







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
 * \warning The pointer is only valid until the OFDataArray is changed!
 *
 * Modifying the returned array directly is allowed and will change the contents
 * of the data array.
 *
 * \return All elements of the OFDataArray as a C array
 */
- (void*)cArray OF_RETURNS_INNER_POINTER;

/**
 * \brief Returns a specific item of the OFDataArray.
 *
 * \param index The number of the item to return
 * \return The specified item of the OFDataArray
 */
- (void*)itemAtIndex: (size_t)index OF_RETURNS_INNER_POINTER;

/**
 * \brief Returns the first item of the OFDataArray.
 *
 * \return The first item of the OFDataArray or NULL
 */
- (void*)firstItem OF_RETURNS_INNER_POINTER;

/**
 * \brief Returns the last item of the OFDataArray.
 *
 * \return The last item of the OFDataArray or NULL
 */
- (void*)lastItem OF_RETURNS_INNER_POINTER;

/**
 * \brief Adds an item to the OFDataArray.
 *
 * \param item A pointer to an arbitrary item
 */
- (void)addItem: (const void*)item;

Modified src/OFEnumerator.h from [3141f48de1] to [7994a3a6fa].

86
87
88
89
90
91
92
93
94
95
 * \param state Context information for the enumeration
 * \param objects A pointer to an array where to put the objects
 * \param count The number of objects that can be stored at objects
 * \return The number of objects returned in objects or 0 when the enumeration
 *	   finished.
 */
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count;
@end







|


86
87
88
89
90
91
92
93
94
95
 * \param state Context information for the enumeration
 * \param objects A pointer to an array where to put the objects
 * \param count The number of objects that can be stored at objects
 * \return The number of objects returned in objects or 0 when the enumeration
 *	   finished.
 */
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (__unsafe_unretained id*)objects
			     count: (int)count;
@end

Modified src/OFObject.h from [98f274a22b] to [263d460557].

33
34
35
36
37
38
39
40



41
42
43
44
45
46














47
48
49
50
51
52
53
# import <objc/objc.h>
#endif

#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>
#endif

#ifdef __has_feature



# if __has_feature(objc_bool)
#  undef YES
#  define YES __objc_yes
#  undef NO
#  define NO __objc_no
# endif














#endif

#define OF_RETAIN_COUNT_MAX UINT_MAX
#define OF_INVALID_INDEX SIZE_MAX

/**
 * \brief A result of a comparison.







|
>
>
>
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







33
34
35
36
37
38
39
40
41
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
# import <objc/objc.h>
#endif

#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>
#endif

#ifndef __has_feature
# define __has_feature(x) 0
#endif

#if __has_feature(objc_bool)
# undef YES
# define YES __objc_yes
# undef NO
# define NO __objc_no
#endif

#if __has_feature(objc_arc)
# define OF_RETURNS_RETAINED __attribute__((ns_returns_retained))
# define OF_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
# define OF_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer))
# define OF_CONSUMED __attribute__((ns_consumed))
# define OF_WEAK_UNAVAILABLE __attribute__((objc_arc_weak_unavailable))
#else
# define OF_RETURNS_RETAINED
# define OF_RETURNS_NOT_RETAINED
# define OF_RETURNS_INNER_POINTER
# define OF_CONSUMED
# define OF_WEAK_UNAVAILABLE
# define __unsafe_unretained
#endif

#define OF_RETAIN_COUNT_MAX UINT_MAX
#define OF_INVALID_INDEX SIZE_MAX

/**
 * \brief A result of a comparison.

Modified src/OFString.h from [1edda5da97] to [b5ebcdbbc4].

528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547

548
549
550
551
552
553
554
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The OFString as a UTF-8 encoded C string
 */
- (const char*)UTF8String;

/**
 * \brief Returns the OFString as a C string in the specified encoding.
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \param encoding The encoding for the C string
 * \return The OFString as a C string in the specified encoding
 */
- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding;;


/**
 * \brief Returns the length of the string in Unicode characters.
 *
 * \return The length of the string in Unicode characters
 */
- (size_t)length;







|











|
>







528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The OFString as a UTF-8 encoded C string
 */
- (const char*)UTF8String OF_RETURNS_INNER_POINTER;

/**
 * \brief Returns the OFString as a C string in the specified encoding.
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \param encoding The encoding for the C string
 * \return The OFString as a C string in the specified encoding
 */
- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding
    OF_RETURNS_INNER_POINTER;

/**
 * \brief Returns the length of the string in Unicode characters.
 *
 * \return The length of the string in Unicode characters
 */
- (size_t)length;
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The string as an array of Unicode characters
 */
- (const of_unichar_t*)unicodeString;

/**
 * \brief Returns the string in big endian UTF-16 encoding.
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The string in big endian UTF-16 encoding
 */
- (const uint16_t*)UTF16String;

/**
 * \brief Writes the string into the specified file using UTF-8 encoding.
 *
 * \param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;







|










|







836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The string as an array of Unicode characters
 */
- (const of_unichar_t*)unicodeString OF_RETURNS_INNER_POINTER;

/**
 * \brief Returns the string in big endian UTF-16 encoding.
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The string in big endian UTF-16 encoding
 */
- (const uint16_t*)UTF16String OF_RETURNS_INNER_POINTER;

/**
 * \brief Writes the string into the specified file using UTF-8 encoding.
 *
 * \param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;

Modified src/runtime/runtime.h from [50de71845f] to [db1c5610a1].

13
14
15
16
17
18
19






20
21
22
23
24
25
26
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#ifndef __OBJFW_RUNTIME_H__
#define __OBJFW_RUNTIME_H__
#include <stdint.h>







typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;
typedef signed char BOOL;
typedef id (*IMP)(id, SEL, ...);








>
>
>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#ifndef __OBJFW_RUNTIME_H__
#define __OBJFW_RUNTIME_H__
#include <stdint.h>

#if defined(__has_feature) && __has_feature(objc_arc)
# define OBJC_BRIDGE __bridge
#else
# define OBJC_BRIDGE
#endif

typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;
typedef signed char BOOL;
typedef id (*IMP)(id, SEL, ...);

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209


210
extern void* objc_autoreleasePoolPush(void);
extern void objc_autoreleasePoolPop(void*);
extern id _objc_rootAutorelease(id);

static inline Class
object_getClass(id obj_)
{
	struct objc_object *obj = (struct objc_object*)obj_;

	return obj->isa;
}

static inline Class
object_setClass(id obj_, Class cls)
{
	struct objc_object *obj = (struct objc_object*)obj_;
	Class old = obj->isa;

	obj->isa = cls;

	return old;
}

static inline const char*
object_getClassName(id obj)
{
	return class_getName(object_getClass(obj));
}



#endif







|







|













>
>

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
extern void* objc_autoreleasePoolPush(void);
extern void objc_autoreleasePoolPop(void*);
extern id _objc_rootAutorelease(id);

static inline Class
object_getClass(id obj_)
{
	struct objc_object *obj = (OBJC_BRIDGE struct objc_object*)obj_;

	return obj->isa;
}

static inline Class
object_setClass(id obj_, Class cls)
{
	struct objc_object *obj = (OBJC_BRIDGE struct objc_object*)obj_;
	Class old = obj->isa;

	obj->isa = cls;

	return old;
}

static inline const char*
object_getClassName(id obj)
{
	return class_getName(object_getClass(obj));
}

#undef OBJC_BRIDGE

#endif