diff dwt/internal/cocoa/NSMutableString.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/NSMutableString.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.NSMutableString;
+
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSMutableString : NSString
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void appendFormat (NSString appendFormat)
+    {
+        OS.objc_msgSend(this.id, OS.sel_appendFormat_1, appendFormat !is null ? appendFormat.id : null);
+    }
+
+    public void appendString (NSString aString)
+    {
+        OS.objc_msgSend(this.id, OS.sel_appendString_1, aString !is null ? aString.id : null);
+    }
+
+    public void deleteCharactersInRange (NSRange range)
+    {
+        OS.objc_msgSend(this.id, OS.sel_deleteCharactersInRange_1, range);
+    }
+
+    public NSMutableString initWithCapacity (NSUInteger capacity)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithCapacity_1, capacity);
+        return result !is null ? this : null;
+    }
+
+    public void insertString (NSString aString, NSUInteger loc)
+    {
+        OS.objc_msgSend(this.id, OS.sel_insertString_1atIndex_1, aString !is null ? aString.id : null, loc);
+    }
+
+    public void replaceCharactersInRange (NSRange range, NSString aString)
+    {
+        OS.objc_msgSend(this.id, OS.sel_replaceCharactersInRange_1withString_1, range, aString !is null ? aString.id : null);
+    }
+
+    public NSUInteger replaceOccurrencesOfString (NSString target, NSString replacement, int options, NSRange searchRange)
+    {
+        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_replaceOccurrencesOfString_1withString_1options_1range_1, target !is null ? target.id : null,
+                replacement !is null ? replacement.id : null, options, searchRange);
+    }
+
+    public void setString (NSString aString)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setString_1, aString !is null ? aString.id : null);
+    }
+
+    public static id stringWithCapacity (NSUInteger capacity)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSMutableString, OS.sel_stringWithCapacity_1, capacity);
+        return result !is null ? new id(result) : null;
+    }
+
+}