Overview
Comment: | Add compare: for strings. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
24ce530f56fbad4f3af03b1e9869ee3a |
User & Date: | js on 2008-09-15 10:23:39 |
Other Links: | manifest | tags |
Context
2008-09-15
| ||
11:02 | API change. check-in: c7f702cc69 user: js tags: trunk | |
10:23 | Add compare: for strings. check-in: 24ce530f56 user: js tags: trunk | |
2008-09-14
| ||
20:30 | Same again. check-in: 1df0de873b user: js tags: trunk | |
Changes
Modified src/OFConstString.h from [f6b02d3f44] to [8a959a6c98].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 | } + new: (const char*)str; - init; - init: (const char*)str; - (const char*)cString; - (size_t)length; @end | > | 19 20 21 22 23 24 25 26 27 | } + new: (const char*)str; - init; - init: (const char*)str; - (const char*)cString; - (size_t)length; - (int)compare: (OFConstString*)str; @end |
Modified src/OFConstString.m from [76ce673d4c] to [59a339f3e5].
︙ | ︙ | |||
42 43 44 45 46 47 48 49 | return string; } - (size_t)length { return length; } @end | > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 | return string; } - (size_t)length { return length; } - (int)compare: (OFConstString*)str { return strcmp(string, [str cString]); } @end |
Modified src/OFConstWideString.h from [d4d5fd756d] to [03dfdece23].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 | } + new: (const wchar_t*)wstr; - init; - init: (const wchar_t*)wstr; - (const wchar_t*)wcString; - (size_t)length; @end | > | 20 21 22 23 24 25 26 27 28 | } + new: (const wchar_t*)wstr; - init; - init: (const wchar_t*)wstr; - (const wchar_t*)wcString; - (size_t)length; - (int)compare: (OFConstWideString*)str; @end |
Modified src/OFConstWideString.m from [a6b7bf4dc0] to [c0a8ed45c4].
︙ | ︙ | |||
42 43 44 45 46 47 48 49 | return wstring; } - (size_t)length { return length; } @end | > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 | return wstring; } - (size_t)length { return length; } - (int)compare: (OFConstWideString*)str { return wcscmp(wstring, [str wcString]); } @end |
Modified src/OFString.h from [362876c1c2] to [669d4151c7].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 | - init; - init: (const char*)str; - (char*)cString; - (size_t)length; - (OFString*)setTo: (const char*)str; - (OFString*)clone; - (OFString*)append: (const char*)str; @end | > | 22 23 24 25 26 27 28 29 30 | - init; - init: (const char*)str; - (char*)cString; - (size_t)length; - (OFString*)setTo: (const char*)str; - (OFString*)clone; - (OFString*)append: (const char*)str; - (int)compare: (OFString*)str; @end |
Modified src/OFString.m from [c2a52dd320] to [b274f069db].
︙ | ︙ | |||
99 100 101 102 103 104 105 106 | memcpy(newstr + length, str, strlength + 1); length = newlen; string = newstr; return self; } @end | > > > > > | 99 100 101 102 103 104 105 106 107 108 109 110 111 | memcpy(newstr + length, str, strlength + 1); length = newlen; string = newstr; return self; } - (int)compare: (OFString*)str { return strcmp(string, [str cString]); } @end |
Modified src/OFWideString.h from [1f0b56cce2] to [ca4e9f67ee].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 | - init; - init: (const wchar_t*)wstr; - (wchar_t*)wcString; - (size_t)length; - (OFWideString*)setTo: (const wchar_t*)wstr; - (OFWideString*)clone; - (OFWideString*)append: (const wchar_t*)wstr; @end | > | 23 24 25 26 27 28 29 30 31 | - init; - init: (const wchar_t*)wstr; - (wchar_t*)wcString; - (size_t)length; - (OFWideString*)setTo: (const wchar_t*)wstr; - (OFWideString*)clone; - (OFWideString*)append: (const wchar_t*)wstr; - (int)compare: (OFWideString*)str; @end |
Modified src/OFWideString.m from [0504ce8d16] to [1b2ac19bc0].
︙ | ︙ | |||
100 101 102 103 104 105 106 107 | memcpy(newstr + length, wstr, (strlength + 1) * sizeof(wchar_t)); length = newlen; wstring = newstr; return self; } @end | > > > > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 | memcpy(newstr + length, wstr, (strlength + 1) * sizeof(wchar_t)); length = newlen; wstring = newstr; return self; } - (int)compare: (OFWideString*)str { return wcscmp(wstring, [str wcString]); } @end |
Modified tests/OFString/OFString.m from [38ab25865c] to [1fdb086bd4].
︙ | ︙ | |||
25 26 27 28 29 30 31 | OFString *s4 = [OFString new]; [s2 append: "123"]; s3 = [s1 clone]; [s4 setTo: [s2 cString]]; | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | OFString *s4 = [OFString new]; [s2 append: "123"]; s3 = [s1 clone]; [s4 setTo: [s2 cString]]; if (![s1 compare: s3]) puts("s1 and s3 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (![s2 compare: s4]) puts("s2 and s4 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (!strcmp([[s1 append: [s2 cString]] cString], "test123")) |
︙ | ︙ |
Modified tests/OFWideString/OFWideString.m from [19d2fc16c9] to [c00b389041].
︙ | ︙ | |||
24 25 26 27 28 29 30 | OFWideString *s4 = [OFWideString new]; [s2 append: L"123"]; s3 = [s1 clone]; [s4 setTo: [s2 wcString]]; | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | OFWideString *s4 = [OFWideString new]; [s2 append: L"123"]; s3 = [s1 clone]; [s4 setTo: [s2 wcString]]; if (![s1 compare: s3]) puts("s1 and s3 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (![s2 compare: s4]) puts("s2 and s4 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (!wcscmp([[s1 append: [s2 wcString]] wcString], L"test123")) |
︙ | ︙ |