Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSScanner.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/NSScanner.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,178 @@ +/******************************************************************************* + * 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.NSScanner; + +import dwt.internal.cocoa.NSCharacterSet; +import dwt.internal.cocoa.NSDecimal; +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 NSScanner : NSObject +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public bool caseSensitive () + { + return OS.objc_msgSend(this.id, OS.sel_caseSensitive) !is null; + } + + public NSCharacterSet charactersToBeSkipped () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_charactersToBeSkipped); + return result !is null ? new NSCharacterSet(result) : null; + } + + public NSScanner initWithString (NSString string) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1, string !is null ? string.id : null); + return result !is null ? this : null; + } + + public bool isAtEnd () + { + return OS.objc_msgSend(this.id, OS.sel_isAtEnd) !is null; + } + + public id locale () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_locale); + return result !is null ? new id(result) : null; + } + + public static id localizedScannerWithString (NSString string) + { + objc.id result = OS.objc_msgSend(OS.class_NSScanner, OS.sel_localizedScannerWithString_1, string !is null ? string.id : null); + return result !is null ? new id(result) : null; + } + + public bool scanCharactersFromSet (NSCharacterSet set, objc.id** value) + { + return OS.objc_msgSend(this.id, OS.sel_scanCharactersFromSet_1intoString_1, set !is null ? set.id : null, value) !is null; + } + + public bool scanDecimal (NSDecimal* dcm) + { + return OS.objc_msgSend(this.id, OS.sel_scanDecimal_1, dcm) !is null; + } + + public bool scanDouble (double* value) + { + return OS.objc_msgSend(this.id, OS.sel_scanDouble_1, value) !is null; + } + + public bool scanFloat (float* value) + { + return OS.objc_msgSend(this.id, OS.sel_scanFloat_1, value) !is null; + } + + public bool scanHexDouble (objc.id result) + { + return OS.objc_msgSend(this.id, OS.sel_scanHexDouble_1, result) !is null; + } + + public bool scanHexFloat (objc.id result) + { + return OS.objc_msgSend(this.id, OS.sel_scanHexFloat_1, result) !is null; + } + + public bool scanHexInt (uint* value) + { + return OS.objc_msgSend(this.id, OS.sel_scanHexInt_1, value) !is null; + } + + public bool scanHexLongLong (objc.id result) + { + return OS.objc_msgSend(this.id, OS.sel_scanHexLongLong_1, result) !is null; + } + + public bool scanInt (int* value) + { + return OS.objc_msgSend(this.id, OS.sel_scanInt_1, value) !is null; + } + + public bool scanInteger (NSInteger* value) + { + return OS.objc_msgSend(this.id, OS.sel_scanInteger_1, value) !is null; + } + + public NSUInteger scanLocation () + { + return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_scanLocation); + } + + public bool scanLongLong (long* value) + { + return OS.objc_msgSend(this.id, OS.sel_scanLongLong_1, value) !is null; + } + + public bool scanString (NSString string, objc.id** value) + { + return OS.objc_msgSend(this.id, OS.sel_scanString_1intoString_1, string !is null ? string.id : null, value) !is null; + } + + public bool scanUpToCharactersFromSet (NSCharacterSet set, objc.id** value) + { + return OS.objc_msgSend(this.id, OS.sel_scanUpToCharactersFromSet_1intoString_1, set !is null ? set.id : null, value) !is null; + } + + public bool scanUpToString (NSString string, objc.id** value) + { + return OS.objc_msgSend(this.id, OS.sel_scanUpToString_1intoString_1, string !is null ? string.id : null, value) !is null; + } + + public static id scannerWithString (NSString string) + { + objc.id result = OS.objc_msgSend(OS.class_NSScanner, OS.sel_scannerWithString_1, string !is null ? string.id : null); + return result !is null ? new id(result) : null; + } + + public void setCaseSensitive (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setCaseSensitive_1, flag); + } + + public void setCharactersToBeSkipped (NSCharacterSet set) + { + OS.objc_msgSend(this.id, OS.sel_setCharactersToBeSkipped_1, set !is null ? set.id : null); + } + + public void setLocale (id locale) + { + OS.objc_msgSend(this.id, OS.sel_setLocale_1, locale !is null ? locale.id : null); + } + + public void setScanLocation (NSUInteger pos) + { + OS.objc_msgSend(this.id, OS.sel_setScanLocation_1, pos); + } + + public NSString string () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_string); + return result !is null ? new NSString(result) : null; + } + +}