Differences From Artifact [69097c8dd7]:
- File
src/OFString.m
— part of check-in
[7feac9e596]
at
2009-01-24 20:28:31
on branch trunk
— [self alloc] isn't a good idea with the new API.
The reason is that a derived class, for example derived from OFArray,
would not return an OFArray when + arrayWithItemSize is called. (user: js, size: 8738) [annotate] [blame] [check-ins using]
To Artifact [d870a955f7]:
- File
src/OFString.m
— part of check-in
[61a6ac873a]
at
2009-02-14 17:08:21
on branch trunk
— Big diff, see details.
* Add OFComparable protocol.
* Add OFInvalidArgument exception - needs that sel_getName vs.
sel_get_name stuff again, therefore reintroduce it.
* Implement proper copy method for OFString and OFArray.
* Add isEqual: and compare: for OFString and OFArray. (user: js, size: 8974) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
233 234 235 236 237 238 239 | } - (size_t)length { return length; } | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | } - (size_t)length { return length; } - (id)copy { return [OFString stringWithCString: string]; } - setTo: (OFString*)str { size_t len; |
︙ | ︙ | |||
266 267 268 269 270 271 272 | length = len; string = [self getMemWithSize: length + 1]; memcpy(string, [str cString], length + 1); return self; } | > > > > > > > > > > | > > > | | 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 | length = len; string = [self getMemWithSize: length + 1]; memcpy(string, [str cString], length + 1); return self; } - (BOOL)isEqual: (id)obj { if (![obj isKindOf: [OFString class]]) return NO; if (strcmp(string, [obj cString])) return NO; return YES; } - (int)compare: (id)obj { if (![obj isKindOf: [OFString class]]) @throw [OFInvalidArgumentException newWithClass: [self class]]; return strcmp(string, [obj cString]); } - append: (OFString*)str { return [self appendCString: [str cString]]; } |
︙ | ︙ |