diff org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d @ 48:ddbfe84d86df

[swt lin] versioned imports
author Frank Benoit <benoit@tionex.de>
date Fri, 27 Mar 2009 12:05:20 +0100
parents f713da8bc051
children 7a2dd761a8b2
line wrap: on
line diff
--- a/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d	Fri Mar 27 11:43:53 2009 +0100
+++ b/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d	Fri Mar 27 12:05:20 2009 +0100
@@ -2,7 +2,10 @@
 
 import java.lang.all;
 
+version(Tango){
 import Utf = tango.text.convert.Utf;
+} else { // Phobos
+}
 
 import org.eclipse.swt.internal.mozilla.Common;
 import org.eclipse.swt.internal.mozilla.nsStringAPI;
@@ -10,84 +13,84 @@
 
 scope class nsEmbedString
 {    
-	this(wchar[] s)
-	{
-		nsresult result;
-		result = NS_StringContainerInit2(&str, s.ptr, s.length, 0);
-		if (XPCOM.NS_FAILED(result)) 
-			throw new Exception("Init string container fail");
-	}
+    this(wchar[] s)
+    {
+        nsresult result;
+        result = NS_StringContainerInit2(&str, s.ptr, s.length, 0);
+        if (XPCOM.NS_FAILED(result)) 
+            throw new Exception("Init string container fail");
+    }
 
-	this()
-	{
-		nsresult result;
-		result = NS_StringContainerInit(&str);
-		if (XPCOM.NS_FAILED(result)) 
-			throw new Exception("Init string container fail");
-	}
+    this()
+    {
+        nsresult result;
+        result = NS_StringContainerInit(&str);
+        if (XPCOM.NS_FAILED(result)) 
+            throw new Exception("Init string container fail");
+    }
 
-	nsAString* opCast()
-	{
-		return cast(nsAString*)&str;
-	}
+    nsAString* opCast()
+    {
+        return cast(nsAString*)&str;
+    }
 
-	wchar[] toString16()
-	{
-		wchar* buffer = null;
-		PRBool terminated;
-		uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated);
-		return buffer[0 .. len].dup;
-	}
+    wchar[] toString16()
+    {
+        wchar* buffer = null;
+        PRBool terminated;
+        uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated);
+        return buffer[0 .. len].dup;
+    }
     
     char[] toString()
     {
         return Utf.toString(this.toString16());
     }
     ~this()
-	{
-		NS_StringContainerFinish(&str);
-	}
+    {
+        NS_StringContainerFinish(&str);
+    }
 private:
-	nsStringContainer str;
+    nsStringContainer str;
 }
 
 
 scope class nsEmbedCString
 {
-	this(char[] s)
-	{
-		nsresult result;
-		result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0);
-		if (XPCOM.NS_FAILED(result)) 
-			throw new Exception("Init string container fail");
-	}
+    this(char[] s)
+    {
+        nsresult result;
+        result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0);
+        if (XPCOM.NS_FAILED(result)) 
+            throw new Exception("Init string container fail");
+    }
 
-	this()
-	{
-		nsresult result;
-		result = NS_CStringContainerInit(&str);
-		if (XPCOM.NS_FAILED(result)) 
-			throw new Exception("Init string container fail");
-	}
+    this()
+    {
+        nsresult result;
+        result = NS_CStringContainerInit(&str);
+        if (XPCOM.NS_FAILED(result)) 
+            throw new Exception("Init string container fail");
+    }
 
-	nsACString* opCast()
-	{
-		return cast(nsACString*)&str;
-	}
+    nsACString* opCast()
+    {
+        return cast(nsACString*)&str;
+    }
 
-	char[] toString()
-	{
-		char* buffer = null;
-		PRBool terminated;
-		uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated);
+    char[] toString()
+    {
+        char* buffer = null;
+        PRBool terminated;
+        uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated);
         return buffer[0 .. len].dup;
-	}
+    }
 
-	~this()
-	{
-		NS_CStringContainerFinish(&str);
-	}
+    ~this()
+    {
+        NS_CStringContainerFinish(&str);
+    }
 private:
-	nsCStringContainer str;
+    nsCStringContainer str;
 }