Overview
Comment: | newWithFooString -> newAsFooString. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
62abf39400ad05045c76e28bbb22a21d |
User & Date: | js on 2008-10-25 22:25:50 |
Other Links: | manifest | tags |
Context
2008-10-25
| ||
22:28 | Decided we don't want @"" anyway. Thus remove our own alloc. check-in: 061e654036 user: js tags: trunk | |
22:25 | newWithFooString -> newAsFooString. check-in: 62abf39400 user: js tags: trunk | |
2008-10-22
| ||
13:32 | Reworked OFObject and added append(Wide)CString to OFString. check-in: e47ad44290 user: js tags: trunk | |
Changes
Modified src/OFCString.m from [dc3a9e9583] to [cc01727386].
︙ | ︙ | |||
41 42 43 44 45 46 47 | - (size_t)length { return length; } - (OFString*)clone { | | | | 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 71 72 73 74 | - (size_t)length { return length; } - (OFString*)clone { return [OFString newAsCString: string]; } - (int)compareTo: (OFString*)str { return strcmp(string, [str cString]); } - (OFString*)append: (OFString*)str { return [self appendCString: [str cString]]; } - (OFString*)appendCString: (const char*)str { char *newstr; size_t newlen, strlength; if (string == NULL) return [self setTo: [OFString newAsCString: (char*)str]]; strlength = strlen(str); newlen = length + strlength; newstr = [self resizeMem: string toSize: newlen + 1]; |
︙ | ︙ |
Modified src/OFConstCString.m from [1ea6deb553] to [294711f4b4].
︙ | ︙ | |||
37 38 39 40 41 42 43 | - (size_t)length { return length; } - (OFString*)clone { | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - (size_t)length { return length; } - (OFString*)clone { return [OFString newAsConstCString: string]; } - (int)compareTo: (OFString*)str { return strcmp(string, [str cString]); } @end |
Modified src/OFConstWideCString.m from [d6f7c115da] to [68175f182a].
︙ | ︙ | |||
37 38 39 40 41 42 43 | - (size_t)length { return length; } - (OFString*)clone { | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - (size_t)length { return length; } - (OFString*)clone { return [OFString newAsConstWideCString: string]; } - (int)compareTo: (OFString*)str { return wcscmp(string, [str wcString]); } @end |
Modified src/OFString.h from [19fb63cd94] to [a2a6f02dc3].
︙ | ︙ | |||
10 11 12 13 14 15 16 | */ #import <wchar.h> #import <stddef.h> #import "OFObject.h" @interface OFString: OFObject | | | | | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | */ #import <wchar.h> #import <stddef.h> #import "OFObject.h" @interface OFString: OFObject + newAsConstCString: (const char*)str; + newAsConstWideCString: (const wchar_t*)str; + newAsCString: (char*)str; + newAsWideCString: (wchar_t*)str; - (char*)cString; - (wchar_t*)wcString; - (size_t)length; - (OFString*)setTo: (OFString*)str; - (OFString*)clone; - (int)compareTo: (OFString*)str; - (OFString*)append: (OFString*)str; - (OFString*)appendCString: (const char*)str; - (OFString*)appendWideCString: (const wchar_t*)str; @end |
Modified src/OFString.m from [34596a2a5f] to [ffab6838ef].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFConstCString.h" #import "OFConstWideCString.h" #import "OFCString.h" #import "OFWideCString.h" #import "OFExceptions.h" @implementation OFString | | | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #import "OFConstCString.h" #import "OFConstWideCString.h" #import "OFCString.h" #import "OFWideCString.h" #import "OFExceptions.h" @implementation OFString + newAsConstCString: (const char*)str { return [[OFConstCString alloc] initWithConstCString: str]; } + newAsConstWideCString: (const wchar_t*)str { return [[OFConstWideCString alloc] initWithConstWideCString: str]; } + newAsCString: (char*)str { return [[OFCString alloc] initWithCString: str]; } + newAsWideCString: (wchar_t*)str { return [[OFWideCString alloc] initWithWideCString: str]; } - (char*)cString { [[OFNotImplementedException newWithObject: self |
︙ | ︙ | |||
96 97 98 99 100 101 102 | { [[OFNotImplementedException newWithObject: self andSelector: @selector(appendCString:)] raise]; return nil; } | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | { [[OFNotImplementedException newWithObject: self andSelector: @selector(appendCString:)] raise]; return nil; } - (OFString*)appendWideCString: (const wchar_t*)str { [[OFNotImplementedException newWithObject: self andSelector: @selector( appendWideCString:)] raise]; return nil; } @end |
Modified src/OFWideCString.m from [39f7445e2b] to [0d25058214].
︙ | ︙ | |||
43 44 45 46 47 48 49 | - (size_t)length { return length; } - (OFString*)clone { | | | | 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 71 72 73 74 75 76 77 | - (size_t)length { return length; } - (OFString*)clone { return [OFString newAsWideCString: string]; } - (int)compareTo: (OFString*)str { return wcscmp(string, [str wcString]); } - (OFString*)append: (OFString*)str { return [self appendWideCString: [str wcString]]; } - (OFString*)appendWideCString: (const wchar_t*)str { wchar_t *newstr; size_t newlen, strlength; if (string == NULL) return [self setTo: [OFString newAsWideCString: (wchar_t*)str]]; strlength = wcslen(str); newlen = length + strlength; newstr = [self resizeMem: string toSize: (newlen + 1) * sizeof(wchar_t)]; |
︙ | ︙ |
Modified tests/OFList/OFList.m from [1645530892] to [913aa88c30].
︙ | ︙ | |||
28 29 30 31 32 33 34 | { size_t i; OFList *list; OFListObject *iter; list = [OFList new]; | | | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | { size_t i; OFList *list; OFListObject *iter; list = [OFList new]; [list addNew: [OFString newAsConstCString: strings[0]]]; [list addNew: [OFString newAsConstCString: strings[1]]]; [list addNew: [OFString newAsConstCString: strings[2]]]; for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) if (!strcmp([(OFString*)[iter data] cString], strings[i])) printf("Element %zu is expected element. GOOD!\n", i); else { printf("Element %zu is not expected element!\n", i); return 1; |
︙ | ︙ |
Modified tests/OFString/OFString.m from [c0f30552d4] to [1ba1ce211e].
︙ | ︙ | |||
15 16 17 18 19 20 21 | #import "OFString.h" /* TODO: Do real checks */ int main() { | | | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFString.h" /* TODO: Do real checks */ int main() { OFString *s1 = [OFString newAsCString: "test"]; OFString *s2 = [OFString newAsCString: ""]; OFString *s3; OFString *s4 = [OFString newAsConstCString: NULL]; [s2 appendCString: "123"]; s3 = [s1 clone]; [s4 setTo: s2]; if (![s1 compareTo: s3]) puts("s1 and s3 match! GOOD!"); else { |
︙ | ︙ |
Modified tests/OFWideString/OFWideString.m from [1a00935b6a] to [437fd29f56].
︙ | ︙ | |||
14 15 16 17 18 19 20 | #import "OFString.h" /* TODO: Do real checks */ int main() { | | | | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFString.h" /* TODO: Do real checks */ int main() { OFString *s1 = [OFString newAsWideCString: L"test"]; OFString *s2 = [OFString newAsWideCString: L""]; OFString *s3; OFString *s4 = [OFString newAsConstWideCString: NULL]; [s2 appendWideCString: L"123"]; s3 = [s1 clone]; [s4 setTo: s2]; if (![s1 compareTo: s3]) puts("s1 and s3 match! GOOD!"); else { |
︙ | ︙ |