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:
Richard Frith-Macdonald 2004-06-29 10:31:05 +00:00
parent 0f34bb51fc
commit a0b07ade13
3 changed files with 53 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2004-06-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Added MacOS-X compatibility methods ..
([addSuiteNamed:]) and ([removeSuiteNamed:])
2004-06-27 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/plparse.m: Check for and report illegal (non-ascii) characters

View file

@ -167,6 +167,10 @@ GS_EXPORT NSString* const NSLocale;
/* Returning the Search List */
- (NSMutableArray*) searchList;
- (void) setSearchList: (NSArray*)newList;
#ifndef STRICT_OPENSTEP
- (void) addSuiteNamed: (NSString*)aName;
- (void) removeSuiteNamed: (NSString*)aName;
#endif
/* Maintaining Persistent Domains */
- (NSDictionary*) persistentDomainForName: (NSString*)domainName;

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
*************************************************************************/