ObjFW  Check-in [2011b7b91c]

Overview
Comment:-[className] and +[className] now return an OFString.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2011b7b91cf7d24e44cc7f571b29b16ac56963e4eee92e663acb7fbb47f79c27
User & Date: js on 2010-11-16 00:40:42
Other Links: manifest | tags
Context
2010-11-16
00:49
objfw-compile uses rpath now. check-in: 56838a4124 user: js tags: trunk
00:40
-[className] and +[className] now return an OFString. check-in: 2011b7b91c user: js tags: trunk
2010-11-15
23:20
Fix forgotten call to -[description] in -[componentsJoinedByString]. check-in: 1a68929cbb user: js tags: trunk
Changes

Modified src/OFObject.h from [82b71eb5d5] to [2a51330d11].

83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97







-
+







 * \return The class
 */
+ (Class)class;

/**
 * \return The name of the class as a C string
 */
+ (const char*)className;
+ (OFString*)className;

/**
 * \param class_ The class which is checked for being a superclass
 * \return A boolean whether the class class is a subclass of the specified
 *	   class
 */
+ (BOOL)isSubclassOfClass: (Class)class_;
191
192
193
194
195
196
197
198

199
200

201
202
203
204
205
206
207
191
192
193
194
195
196
197

198
199

200
201
202
203
204
205
206
207







-
+

-
+








/**
 * \return The class of the object
 */
- (Class)class;

/**
 * \return The name of the object's class as a C string
 * \return The name of the object's class.
 */
- (const char*)className;
- (OFString*)className;

/**
 * \param class_ The class whose kind is checked
 * \return A boolean whether the object is of the specified kind
 */
- (BOOL)isKindOfClass: (Class)class_;

Modified src/OFObject.m from [115db6d7a7] to [5ec7131f1a].

161
162
163
164
165
166
167
168

169
170

171
172
173
174
175
176
177
161
162
163
164
165
166
167

168
169

170
171
172
173
174
175
176
177







-
+

-
+







}

+ (Class)class
{
	return self;
}

+ (const char*)className
+ (OFString*)className
{
	return class_getName(self);
	return [OFString stringWithCString: class_getName(self)];
}

+ (BOOL)isSubclassOfClass: (Class)class
{
	Class iter;

	for (iter = self; iter != Nil; iter = class_getSuperclass(iter))
261
262
263
264
265
266
267
268

269
270
271
272
273
274
275
261
262
263
264
265
266
267

268
269
270
271
272
273
274
275







-
+








	return ret;
#endif
}

+ (OFString*)description
{
	return [OFString stringWithCString: [self className]];
	return [self className];
}

+ (IMP)setImplementation: (IMP)newimp
	  forClassMethod: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	if (newimp == (IMP)0 || !class_respondsToSelector(self->isa, selector))
392
393
394
395
396
397
398
399

400
401
402

403
404

405
406
407
408
409
410
411
392
393
394
395
396
397
398

399
400
401

402
403

404
405
406
407
408
409
410
411







-
+


-
+

-
+







}

- (Class)class
{
	return isa;
}

- (const char*)className
- (OFString*)className
{
#ifdef OF_GNU_RUNTIME
	return object_get_class_name(self);
	return [OFString stringWithCString: object_get_class_name(self)];
#else
	return class_getName(isa);
	return [OFString stringWithCString: class_getName(isa)];
#endif
}

- (BOOL)isKindOfClass: (Class)class
{
	Class iter;

485
486
487
488
489
490
491
492


493
494
495
496
497
498
499
485
486
487
488
489
490
491

492
493
494
495
496
497
498
499
500







-
+
+







	/* Classes containing data should reimplement this! */
	return (uint32_t)(uintptr_t)self;
}

- (OFString*)description
{
	/* Classes containing data should reimplement this! */
	return [OFString stringWithFormat: @"<%s: %p>", [self className], self];
	return [OFString stringWithFormat: @"<%s: %p>",
					   [[self className] cString], self];
}

- (void)addMemoryToPool: (void*)ptr
{
	void **memchunks;
	size_t memchunks_size;