ObjFW  Check-in [8e995a13e7]

Overview
Comment:Rename -[{upper,lower}] to -[{upper,lower}case].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8e995a13e797cd2dd6eab8b3a030e5c3b789afbf6c461a069011d28899f00fc6
User & Date: js on 2012-07-04 22:50:41
Other Links: manifest | tags
Context
2012-07-06
15:00
Add -[OFString capitalizedString]. check-in: 9a2430abfc user: js tags: trunk
2012-07-04
22:50
Rename -[{upper,lower}] to -[{upper,lower}case]. check-in: 8e995a13e7 user: js tags: trunk
20:31
Fix a bug in -[initWithContentsOfURL:encoding:]. check-in: ba0a921534 user: js tags: trunk
Changes

Modified src/OFMutableString.h from [dc84b0036c] to [5224ad3044].

107
108
109
110
111
112
113
114

115
116
117
118
119

120
121
122
123
124
125
126
107
108
109
110
111
112
113

114
115
116
117
118

119
120
121
122
123
124
125
126







-
+




-
+







 * \brief Reverses the OFMutableString.
 */
- (void)reverse;

/**
 * \brief Converts the OFMutableString to uppercase.
 */
- (void)upper;
- (void)uppercase;

/**
 * \brief Converts the OFMutableString to lowercase.
 */
- (void)lower;
- (void)lowercase;

/**
 * \brief Inserts a string at the specified index.
 *
 * \param string The string to insert
 * \param index The index
 */

Modified src/OFMutableString.m from [5ef83f0de3] to [9288f5195e].

376
377
378
379
380
381
382
383

384
385
386
387
388
389

390
391
392
393
394
395
396
376
377
378
379
380
381
382

383
384
385
386
387
388

389
390
391
392
393
394
395
396







-
+





-
+







		[self setCharacter: [self characterAtIndex: i]
			   atIndex: j];
		[self setCharacter: tmp
			   atIndex: i];
	}
}

- (void)upper
- (void)uppercase
{
	[self _applyTable: of_unicode_uppercase_table
		 withSize: OF_UNICODE_UPPERCASE_TABLE_SIZE];
}

- (void)lower
- (void)lowercase
{
	[self _applyTable: of_unicode_lowercase_table
		 withSize: OF_UNICODE_LOWERCASE_TABLE_SIZE];
}

- (void)insertString: (OFString*)string
	     atIndex: (size_t)index

Modified src/OFString.m from [a7f2176e75] to [7e10de457a].

1462
1463
1464
1465
1466
1467
1468
1469

1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480

1481
1482
1483
1484
1485
1486
1487
1462
1463
1464
1465
1466
1467
1468

1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479

1480
1481
1482
1483
1484
1485
1486
1487







-
+










-
+







	return new;
}

- (OFString*)uppercaseString
{
	OFMutableString *new = [[self mutableCopy] autorelease];

	[new upper];
	[new uppercase];

	[new makeImmutable];

	return new;
}

- (OFString*)lowercaseString
{
	OFMutableString *new = [[self mutableCopy] autorelease];

	[new lower];
	[new lowercase];

	[new makeImmutable];

	return new;
}

- (OFString*)stringByDeletingLeadingWhitespaces

Modified src/OFXMLParser.m from [a3d968177a] to [4119684e10].

434
435
436
437
438
439
440
441

442
443
444
445
446
447
448
434
435
436
437
438
439
440

441
442
443
444
445
446
447
448







-
+







					  length: i - last];

			if ([attribute isEqual: @"version"])
				if (![value hasPrefix: @"1."])
					return NO;

			if ([attribute isEqual: @"encoding"]) {
				[value lower];
				[value lowercase];

				if ([value isEqual: @"utf-8"])
					encoding = OF_STRING_ENCODING_UTF_8;
				else if ([value isEqual: @"iso-8859-1"])
					encoding =
					    OF_STRING_ENCODING_ISO_8859_1;
				else if ([value isEqual: @"iso-8859-15"])

Modified tests/OFStringTests.m from [662f8e8a22] to [49a0aabf35].

127
128
129
130
131
132
133

134
135


136

137
138


139
140
141
142
143

144
145
146
147
148
149
150
127
128
129
130
131
132
133
134


135
136
137
138


139
140
141
142
143
144

145
146
147
148
149
150
151
152







+
-
-
+
+

+
-
-
+
+




-
+







	EXPECT_EXCEPTION(@"Detect out of range in -[characterAtIndex:]",
	    OFOutOfRangeException, [s[0] characterAtIndex: 7])

	TEST(@"-[reverse]", R([s[0] reverse]) && [s[0] isEqual: @"3𝄞1€sät"])

	s[1] = [OFMutableString stringWithString: @"abc"];

	TEST(@"-[uppercase]", R([s[0] uppercase]) &&
	TEST(@"-[upper]", R([s[0] upper]) && [s[0] isEqual: @"3𝄞1€SÄT"] &&
	    R([s[1] upper]) && [s[1] isEqual: @"ABC"])
	    [s[0] isEqual: @"3𝄞1€SÄT"] &&
	    R([s[1] uppercase]) && [s[1] isEqual: @"ABC"])

	TEST(@"-[lowercase]", R([s[0] lowercase]) &&
	TEST(@"-[lower]", R([s[0] lower]) && [s[0] isEqual: @"3𝄞1€sät"] &&
	    R([s[1] lower]) && [s[1] isEqual: @"abc"])
	    [s[0] isEqual: @"3𝄞1€sät"] &&
	    R([s[1] lowercase]) && [s[1] isEqual: @"abc"])

	TEST(@"-[uppercaseString]",
	    [[s[0] uppercaseString] isEqual: @"3𝄞1€SÄT"])

	TEST(@"-[lowercaseString]", R([s[0] upper]) &&
	TEST(@"-[lowercaseString]", R([s[0] uppercase]) &&
	    [[s[0] lowercaseString] isEqual: @"3𝄞1€sät"])

	TEST(@"+[stringWithUTF8String:length:]",
	    (s[0] = [OFMutableString stringWithUTF8String: "\xEF\xBB\xBF"
							   "foobar"
						   length: 6]) &&
	    [s[0] isEqual: @"foo"])