Added a couple of MacOS-X compatibility methods.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19651 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-06-29 10:31:05 +00:00
parent 85935d3662
commit a843b058ca
3 changed files with 53 additions and 0 deletions

View file

@ -908,6 +908,32 @@ static NSString *pathForUser(NSString *user)
return desc;
}
/**
* Adds the domain names aName to the search list of the receiver.<br />
* The domain is added after the application domain.<br />
* Suites may be removed using the -removeSuiteName: method.
*/
- (void) addSuiteNamed: (NSString*)aName
{
unsigned index;
if (aName == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to add suite with nil name"];
}
[_lock lock];
DESTROY(_dictionaryRep);
if (self == sharedDefaults) invalidatedLanguages = YES;
[_searchList removeObject: aName];
index = [_searchList indexOfObject: processName];
index++; // NSNotFound wraps to zero ... insert at start.
aName = [aName copy];
[_searchList insertObject: aName atIndex: index];
[_lock unlock];
RELEASE(aName);
}
/**
* Looks up a value for a specified default using -objectForKey:
* and checks that it is an NSArray object. Returns nil if it is not.
@ -1758,6 +1784,24 @@ static BOOL isPlistObject(id o)
[_lock unlock];
}
/**
* Removes the named domain from the serach list of the receiver.<br />
* Suites may be added using the -addSuiteName: method.
*/
- (void) removeSuiteNamed: (NSString*)aName
{
if (aName == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to remove suite with nil name"];
}
[_lock lock];
DESTROY(_dictionaryRep);
if (self == sharedDefaults) invalidatedLanguages = YES;
[_searchList removeObject: aName];
[_lock unlock];
}
/*************************************************************************
*** Accessing the User Defaults database
*************************************************************************/