Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSUserDefaults.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D Programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSUserDefaults; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSData; import dwt.internal.cocoa.NSDictionary; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSUserDefaults : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public void addSuiteNamed (NSString suiteName) { OS.objc_msgSend(this.id, OS.sel_addSuiteNamed_1, suiteName !is null ? suiteName.id : null); } public NSArray arrayForKey (NSString defaultName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_arrayForKey_1, defaultName !is null ? defaultName.id : null); return result !is null ? new NSArray(result) : null; } public bool boolForKey (NSString defaultName) { return OS.objc_msgSend(this.id, OS.sel_boolForKey_1, defaultName !is null ? defaultName.id : null) !is null; } public NSData dataForKey (NSString defaultName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_dataForKey_1, defaultName !is null ? defaultName.id : null); return result !is null ? new NSData(result) : null; } public NSDictionary dictionaryForKey (NSString defaultName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_dictionaryForKey_1, defaultName !is null ? defaultName.id : null); return result !is null ? new NSDictionary(result) : null; } public NSDictionary dictionaryRepresentation () { objc.id result = OS.objc_msgSend(this.id, OS.sel_dictionaryRepresentation); return result !is null ? new NSDictionary(result) : null; } public double doubleForKey (NSString defaultName) { return cast(double) OS.objc_msgSend_fpret(this.id, OS.sel_doubleForKey_1, defaultName !is null ? defaultName.id : null); } public float floatForKey (NSString defaultName) { return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_floatForKey_1, defaultName !is null ? defaultName.id : null); } public id initWithUser (NSString username) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithUser_1, username !is null ? username.id : null); return result !is null ? new id(result) : null; } public NSInteger integerForKey (NSString defaultName) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_integerForKey_1, defaultName !is null ? defaultName.id : null); } public id objectForKey (NSString defaultName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_objectForKey_1, defaultName !is null ? defaultName.id : null); return result !is null ? new id(result) : null; } public bool objectIsForcedForKey_ (NSString key) { return OS.objc_msgSend(this.id, OS.sel_objectIsForcedForKey_1, key !is null ? key.id : null) !is null; } public bool objectIsForcedForKey_inDomain_ (NSString key, NSString domain) { return OS.objc_msgSend(this.id, OS.sel_objectIsForcedForKey_1inDomain_1, key !is null ? key.id : null, domain !is null ? domain.id : null) !is null; } public NSDictionary persistentDomainForName (NSString domainName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_persistentDomainForName_1, domainName !is null ? domainName.id : null); return result !is null ? new NSDictionary(result) : null; } public NSArray persistentDomainNames () { objc.id result = OS.objc_msgSend(this.id, OS.sel_persistentDomainNames); return result !is null ? new NSArray(result) : null; } public void registerDefaults (NSDictionary registrationDictionary) { OS.objc_msgSend(this.id, OS.sel_registerDefaults_1, registrationDictionary !is null ? registrationDictionary.id : null); } public void removeObjectForKey (NSString defaultName) { OS.objc_msgSend(this.id, OS.sel_removeObjectForKey_1, defaultName !is null ? defaultName.id : null); } public void removePersistentDomainForName (NSString domainName) { OS.objc_msgSend(this.id, OS.sel_removePersistentDomainForName_1, domainName !is null ? domainName.id : null); } public void removeSuiteNamed (NSString suiteName) { OS.objc_msgSend(this.id, OS.sel_removeSuiteNamed_1, suiteName !is null ? suiteName.id : null); } public void removeVolatileDomainForName (NSString domainName) { OS.objc_msgSend(this.id, OS.sel_removeVolatileDomainForName_1, domainName !is null ? domainName.id : null); } public static void resetStandardUserDefaults () { OS.objc_msgSend(OS.class_NSUserDefaults, OS.sel_resetStandardUserDefaults); } public void setBool (bool value, NSString defaultName) { OS.objc_msgSend(this.id, OS.sel_setBool_1forKey_1, value, defaultName !is null ? defaultName.id : null); } public void setDouble (double value, NSString defaultName) { OS.objc_msgSend(this.id, OS.sel_setDouble_1forKey_1, value, defaultName !is null ? defaultName.id : null); } public void setFloat (float value, NSString defaultName) { OS.objc_msgSend(this.id, OS.sel_setFloat_1forKey_1, value, defaultName !is null ? defaultName.id : null); } public void setInteger (NSInteger value, NSString defaultName) { OS.objc_msgSend(this.id, OS.sel_setInteger_1forKey_1, value, defaultName !is null ? defaultName.id : null); } public void setObject (id value, NSString defaultName) { OS.objc_msgSend(this.id, OS.sel_setObject_1forKey_1, value !is null ? value.id : null, defaultName !is null ? defaultName.id : null); } public void setPersistentDomain (NSDictionary domain, NSString domainName) { OS.objc_msgSend(this.id, OS.sel_setPersistentDomain_1forName_1, domain !is null ? domain.id : null, domainName !is null ? domainName.id : null); } public void setVolatileDomain (NSDictionary domain, NSString domainName) { OS.objc_msgSend(this.id, OS.sel_setVolatileDomain_1forName_1, domain !is null ? domain.id : null, domainName !is null ? domainName.id : null); } public static NSUserDefaults standardUserDefaults () { objc.id result = OS.objc_msgSend(OS.class_NSUserDefaults, OS.sel_standardUserDefaults); return result !is null ? new NSUserDefaults(result) : null; } public NSArray stringArrayForKey (NSString defaultName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_stringArrayForKey_1, defaultName !is null ? defaultName.id : null); return result !is null ? new NSArray(result) : null; } public NSString stringForKey (NSString defaultName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_stringForKey_1, defaultName !is null ? defaultName.id : null); return result !is null ? new NSString(result) : null; } public bool synchronize () { return OS.objc_msgSend(this.id, OS.sel_synchronize) !is null; } public NSDictionary volatileDomainForName (NSString domainName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_volatileDomainForName_1, domainName !is null ? domainName.id : null); return result !is null ? new NSDictionary(result) : null; } public NSArray volatileDomainNames () { objc.id result = OS.objc_msgSend(this.id, OS.sel_volatileDomainNames); return result !is null ? new NSArray(result) : null; } }