ObjFW  Check-in [23ad67cdf7]

Overview
Comment:Add -[OFDataArray description].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 23ad67cdf744f4fdcca44c8a69b18a4cc7bbd009613ddcb676e643b22944ccb0
User & Date: js on 2012-10-05 09:54:34
Other Links: manifest | tags
Context
2012-10-05
12:10
OFDataArray: Support for string representations. check-in: 39c5a46ea5 user: js tags: trunk
09:54
Add -[OFDataArray description]. check-in: 23ad67cdf7 user: js tags: trunk
2012-10-03
15:47
Move ObjC feature checks to OFObject.h. check-in: 2edae50b86 user: js tags: trunk
Changes

Modified src/OFDataArray.m from [1e6261bd38] to [31a910dc3b].

423
424
425
426
427
428
429





















430
431
432
433
434
435
436
	OF_HASH_INIT(hash);
	for (i = 0; i < count * itemSize; i++)
		OF_HASH_ADD(hash, ((char*)data)[i]);
	OF_HASH_FINALIZE(hash);

	return hash;
}






















- (OFString*)stringByBase64Encoding
{
	return of_base64_encode(data, count * itemSize);
}

- (void)writeToFile: (OFString*)path







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
	OF_HASH_INIT(hash);
	for (i = 0; i < count * itemSize; i++)
		OF_HASH_ADD(hash, ((char*)data)[i]);
	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{
	OFMutableString *ret = [OFMutableString stringWithString: @"<"];
	size_t i;

	for (i = 0; i < count; i++) {
		size_t j;

		if (i > 0)
			[ret appendString: @" "];

		for (j = 0; j < itemSize; j++)
			[ret appendFormat: @"%02x", data[i * itemSize + j]];
	}

	[ret appendString: @">"];

	[ret makeImmutable];
	return ret;
}

- (OFString*)stringByBase64Encoding
{
	return of_base64_encode(data, count * itemSize);
}

- (void)writeToFile: (OFString*)path