diff dwt/internal/mozilla/nsStringAPI.d @ 298:eec6ddb07873

More xpcom/mozilla port
author John Reimer<terminal.node@gmail.com>
date Sun, 10 Aug 2008 22:25:43 -0700
parents 3dfa75c74ed2
children 3f4a5c7d138f
line wrap: on
line diff
--- a/dwt/internal/mozilla/nsStringAPI.d	Fri Aug 08 15:25:08 2008 +0200
+++ b/dwt/internal/mozilla/nsStringAPI.d	Sun Aug 10 22:25:43 2008 -0700
@@ -73,14 +73,14 @@
 
 struct nsAString
 {
-  static nsAString opCall(wchar[] s)
-  {
-    nsAString result;
-    NS_StringSetData(&result, cast(PRUnichar*)s, uint.max);
-    return result;
-  }
+    static nsAString opCall(wchar[] s)
+    {
+        nsAString result;
+        NS_StringSetData(&result, cast(PRUnichar*)s, uint.max);
+        return result;
+    }
 
-  static wchar[] getString16( nsAString* str )
+    static wchar[] toString16( nsAString* str )
     {
         wchar* buffer = null;
 		PRBool terminated;
@@ -88,7 +88,12 @@
 		return buffer[0 .. len].dup;
     }
     
-  private:
+    static char[] toString( nsAString* str )
+    {
+        return Utf.toString( nsAString.toString16( str ) );
+    }
+  
+    private:
     void *v;
 }
 
@@ -181,15 +186,3 @@
 
 struct nsDependentSubstring_external{}
 struct nsDependentCSubstring_external{}
-
-/******************************************************************************
-
-******************************************************************************/
-
-PRUint32 strlen_PRUnichar ( PRUnichar* str )
-{
-    PRUint32 len = 0;
-    if (str !is null) 
-        while (*(lparg0++) != 0) len++;
-    ret len;
-}
\ No newline at end of file