1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
|
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
default:
@throw [OFNotImplementedException exceptionWithSelector: _cmd
object: self];
}
}
- (size_t)getCString: (char *)cString
maxLength: (size_t)maxLength
encoding: (OFStringEncoding)encoding
{
|
|
<
|
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
|
@throw [OFInvalidEncodingException exception];
cString[length] = '\0';
return length;
#endif
default:
@throw [OFInvalidArgumentException exception];
}
}
- (size_t)getCString: (char *)cString
maxLength: (size_t)maxLength
encoding: (OFStringEncoding)encoding
{
|
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
|
} @catch (id e) {
OFFreeMemory(cString);
@throw e;
}
break;
default:
@throw [OFInvalidEncodingException exception];
}
@try {
ret = [[OFData dataWithItemsNoCopy: cString
count: cStringLength + 1
freeWhenDone: true] items];
} @catch (id e) {
|
|
|
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
|
} @catch (id e) {
OFFreeMemory(cString);
@throw e;
}
break;
default:
@throw [OFInvalidArgumentException exception];
}
@try {
ret = [[OFData dataWithItemsNoCopy: cString
count: cStringLength + 1
freeWhenDone: true] items];
} @catch (id e) {
|
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
|
case OFStringEncodingCodepage850:
case OFStringEncodingCodepage858:
case OFStringEncodingMacRoman:
case OFStringEncodingKOI8R:
case OFStringEncodingKOI8U:
return self.length;
default:
@throw [OFInvalidEncodingException exception];
}
}
- (size_t)UTF8StringLength
{
return [self cStringLengthWithEncoding: OFStringEncodingUTF8];
}
|
|
|
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
|
case OFStringEncodingCodepage850:
case OFStringEncodingCodepage858:
case OFStringEncodingMacRoman:
case OFStringEncodingKOI8R:
case OFStringEncodingKOI8U:
return self.length;
default:
@throw [OFInvalidArgumentException exception];
}
}
- (size_t)UTF8StringLength
{
return [self cStringLengthWithEncoding: OFStringEncodingUTF8];
}
|