Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSDictionary.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSDictionary.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,330 @@ +/******************************************************************************* + * 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.NSDictionary; + + +import dwt.internal.c.carboncore.MacTypes : OSType; +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSArray; +import dwt.internal.cocoa.NSDate; +import dwt.internal.cocoa.NSEnumerator; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSNumber; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSURL; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + + +public class NSDictionary : NSObject +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public NSArray allKeys () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_allKeys); + return result !is null ? new NSArray(result) : null; + } + + public NSArray allKeysForObject (id anObject) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_allKeysForObject_1, anObject !is null ? anObject.id : null); + return result !is null ? new NSArray(result) : null; + } + + public NSArray allValues () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_allValues); + return result !is null ? new NSArray(result) : null; + } + + public NSUInteger count () + { + return OS.objc_msgSend(this.id, OS.sel_count); + } + + public NSString description () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_description); + return result !is null ? new NSString(result) : null; + } + + public NSString descriptionInStringsFileFormat () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionInStringsFileFormat); + return result !is null ? new NSString(result) : null; + } + + public NSString descriptionWithLocale_ (id locale) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1, locale !is null ? locale.id : null); + return result !is null ? new NSString(result) : null; + } + + public NSString descriptionWithLocale_indent_ (id locale, NSUInteger level) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptionWithLocale_1indent_1, locale !is null ? locale.id : null, level); + return result !is null ? new NSString(result) : null; + } + + public static id dictionary () + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionary); + return result !is null ? new id(result) : null; + } + + public static id dictionaryWithContentsOfFile (NSString path) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithContentsOfFile_1, path !is null ? path.id : null); + return result !is null ? new id(result) : null; + } + + public static id dictionaryWithContentsOfURL (NSURL url) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithContentsOfURL_1, url !is null ? url.id : null); + return result !is null ? new id(result) : null; + } + + public static id dictionaryWithDictionary (NSDictionary dict) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithDictionary_1, dict !is null ? dict.id : null); + return result !is null ? new id(result) : null; + } + + public static id dictionaryWithObject (id object, id key) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithObject_1forKey_1, object !is null ? object.id : null, + key !is null ? key.id : null); + return result !is null ? new id(result) : null; + } + + public static id static_dictionaryWithObjects_forKeys_ (NSArray objects, NSArray keys) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithObjects_1forKeys_1, objects !is null ? objects.id : null, + keys !is null ? keys.id : null); + return result !is null ? new id(result) : null; + } + + public static id static_dictionaryWithObjects_forKeys_count_ (objc.id* objects, objc.id* keys, NSUInteger cnt) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithObjects_1forKeys_1count_1, objects, keys, cnt); + return result !is null ? new id(result) : null; + } + + public static id dictionaryWithObjectsAndKeys (id dictionaryWithObjectsAndKeys) + { + objc.id result = OS.objc_msgSend(OS.class_NSDictionary, OS.sel_dictionaryWithObjectsAndKeys_1, + dictionaryWithObjectsAndKeys !is null ? dictionaryWithObjectsAndKeys.id : null); + return result !is null ? new id(result) : null; + } + + public NSDate fileCreationDate () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileCreationDate); + return result !is null ? new NSDate(result) : null; + } + + public bool fileExtensionHidden () + { + return OS.objc_msgSend(this.id, OS.sel_fileExtensionHidden) !is null; + } + + public NSNumber fileGroupOwnerAccountID () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileGroupOwnerAccountID); + return result !is null ? new NSNumber(result) : null; + } + + public NSString fileGroupOwnerAccountName () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileGroupOwnerAccountName); + return result !is null ? new NSString(result) : null; + } + + public OSType fileHFSCreatorCode () + { + return OS.objc_msgSend(this.id, OS.sel_fileHFSCreatorCode); + } + + public OSType fileHFSTypeCode () + { + return OS.objc_msgSend(this.id, OS.sel_fileHFSTypeCode); + } + + public bool fileIsAppendOnly () + { + return OS.objc_msgSend(this.id, OS.sel_fileIsAppendOnly) !is null; + } + + public bool fileIsImmutable () + { + return OS.objc_msgSend(this.id, OS.sel_fileIsImmutable) !is null; + } + + public NSDate fileModificationDate () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileModificationDate); + return result !is null ? new NSDate(result) : null; + } + + public NSNumber fileOwnerAccountID () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileOwnerAccountID); + return result !is null ? new NSNumber(result) : null; + } + + public NSString fileOwnerAccountName () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileOwnerAccountName); + return result !is null ? new NSString(result) : null; + } + + public NSUInteger filePosixPermissions () + { + return OS.objc_msgSend(this.id, OS.sel_filePosixPermissions); + } + + public ulong fileSize () + { + return cast(ulong) OS.objc_msgSend(this.id, OS.sel_fileSize); + } + + public NSUInteger fileSystemFileNumber () + { + return OS.objc_msgSend(this.id, OS.sel_fileSystemFileNumber); + } + + public NSInteger fileSystemNumber () + { + return OS.objc_msgSend(this.id, OS.sel_fileSystemNumber); + } + + public NSString fileType () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_fileType); + return result !is null ? new NSString(result) : null; + } + + public void getObjects (objc.id* objects, objc.id* keys) + { + OS.objc_msgSend(this.id, OS.sel_getObjects_1andKeys_1, objects, keys); + } + + public id initWithContentsOfFile (NSString path) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_1, path !is null ? path.id : null); + return result !is null ? new id(result) : null; + } + + public id initWithContentsOfURL (NSURL url) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfURL_1, url !is null ? url.id : null); + return result !is null ? new id(result) : null; + } + + public id initWithDictionary_ (NSDictionary otherDictionary) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDictionary_1, otherDictionary !is null ? otherDictionary.id : null); + return result !is null ? new id(result) : null; + } + + public id initWithDictionary_copyItems_ (NSDictionary otherDictionary, bool flag) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDictionary_1copyItems_1, otherDictionary !is null ? otherDictionary.id : null, flag); + return result !is null ? new id(result) : null; + } + + public id initWithObjects_forKeys_ (NSArray objects, NSArray keys) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithObjects_1forKeys_1, objects !is null ? objects.id : null, + keys !is null ? keys.id : null); + return result !is null ? new id(result) : null; + } + + public id initWithObjects_forKeys_count_ (objc.id* objects, objc.id* keys, NSUInteger cnt) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithObjects_1forKeys_1count_1, objects, keys, cnt); + return result !is null ? new id(result) : null; + } + + public id initWithObjectsAndKeys (id initWithObjectsAndKeys) + { + objc.id + result = OS.objc_msgSend(this.id, OS.sel_initWithObjectsAndKeys_1, initWithObjectsAndKeys !is null ? initWithObjectsAndKeys.id : null); + return result !is null ? new id(result) : null; + } + + public bool isEqualToDictionary (NSDictionary otherDictionary) + { + return OS.objc_msgSend(this.id, OS.sel_isEqualToDictionary_1, otherDictionary !is null ? otherDictionary.id : null) !is null; + } + + public NSEnumerator keyEnumerator () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_keyEnumerator); + return result !is null ? new NSEnumerator(result) : null; + } + + public NSArray keysSortedByValueUsingSelector (objc.SEL comparator) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_keysSortedByValueUsingSelector_1, comparator); + return result !is null ? new NSArray(result) : null; + } + + public NSEnumerator objectEnumerator () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_objectEnumerator); + return result !is null ? new NSEnumerator(result) : null; + } + + public id objectForKey (id aKey) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_objectForKey_1, aKey !is null ? aKey.id : null); + return result !is null ? new id(result) : null; + } + + public NSArray objectsForKeys (NSArray keys, id marker) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_objectsForKeys_1notFoundMarker_1, keys !is null ? keys.id : null, + marker !is null ? marker.id : null); + return result !is null ? new NSArray(result) : null; + } + + public id valueForKey (NSString key) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_valueForKey_1, key !is null ? key.id : null); + return result !is null ? new id(result) : null; + } + + public bool writeToFile (NSString path, bool useAuxiliaryFile) + { + return OS.objc_msgSend(this.id, OS.sel_writeToFile_1atomically_1, path !is null ? path.id : null, useAuxiliaryFile) !is null; + } + + public bool writeToURL (NSURL url, bool atomically) + { + return OS.objc_msgSend(this.id, OS.sel_writeToURL_1atomically_1, url !is null ? url.id : null, atomically) !is null; + } + +}