mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Performance improvments.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4209 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
265ba163de
commit
0680feafc6
5 changed files with 719 additions and 516 deletions
|
@ -34,6 +34,10 @@
|
|||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSGString.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSCharacterSet.h>
|
||||
#include <base/IndexedCollection.h>
|
||||
#include <base/IndexedCollectionPrivate.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
@ -44,6 +48,12 @@
|
|||
#include <base/fast.x>
|
||||
#include <base/Unicode.h>
|
||||
|
||||
/*
|
||||
* Include property-list parsing code configured for unicode characters.
|
||||
*/
|
||||
#define GSPLUNI 1
|
||||
#include "propList.h"
|
||||
|
||||
|
||||
@implementation NSGString
|
||||
|
||||
|
@ -312,6 +322,53 @@
|
|||
return [NSNumber numberWithChar: unitochar(_contents_chars[index])];
|
||||
}
|
||||
|
||||
- (id) propertyList
|
||||
{
|
||||
id result;
|
||||
pldata data;
|
||||
|
||||
data.ptr = _contents_chars;
|
||||
data.pos = 0;
|
||||
data.end = _count;
|
||||
data.lin = 1;
|
||||
data.err = nil;
|
||||
|
||||
if (plInit == 0)
|
||||
setupPl([NSGString class]);
|
||||
|
||||
result = parsePlItem(&data);
|
||||
|
||||
if (result == nil && data.err != nil)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%@ at line %u", data.err, data.lin];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSDictionary*) propertyListFromStringsFileFormat
|
||||
{
|
||||
id result;
|
||||
pldata data;
|
||||
|
||||
data.ptr = _contents_chars;
|
||||
data.pos = 0;
|
||||
data.end = _count;
|
||||
data.lin = 1;
|
||||
data.err = nil;
|
||||
|
||||
if (plInit == 0)
|
||||
setupPl([NSGString class]);
|
||||
|
||||
result = parseSfItem(&data);
|
||||
if (result == nil && data.err != nil)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%@ at line %u", data.err, data.lin];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue