diff dwtx/dwtxhelper/mangoicu/UString.d @ 91:11e8159caf7a

make the mango icu fork work.
author Frank Benoit <benoit@tionex.de>
date Mon, 07 Jul 2008 15:53:07 +0200
parents 040da1cb0d76
children f05207c07a98
line wrap: on
line diff
--- a/dwtx/dwtxhelper/mangoicu/UString.d	Sun Jul 06 23:30:07 2008 +0200
+++ b/dwtx/dwtxhelper/mangoicu/UString.d	Mon Jul 07 15:53:07 2008 +0200
@@ -82,11 +82,11 @@
 
 *******************************************************************************/
 
-module dwtx.dwthelper.mangoicu.UString;
+module dwtx.dwtxhelper.mangoicu.UString;
 
-private import  dwtx.dwthelper.mangoicu.ICU,
-                dwtx.dwthelper.mangoicu.UChar,
-                dwtx.dwthelper.mangoicu.ULocale;
+private import  dwtx.dwtxhelper.mangoicu.ICU,
+                dwtx.dwtxhelper.mangoicu.UChar,
+                dwtx.dwtxhelper.mangoicu.ULocale;
 
 /*******************************************************************************
 
@@ -109,7 +109,7 @@
         }
      else
         {
-        private import  dwtx.dwthelper.mangoicu.UMango;
+        private import  dwtx.dwtxhelper.mangoicu.UMango;
 
         private import  mango.io.model.IReader,
                         mango.io.model.IWriter;
@@ -155,7 +155,7 @@
 
 *******************************************************************************/
 
-class UString : UText, IStringOther
+class UString : UStringView, IStringOther
 {
         alias opCat             append;
         alias opIndexAssign     setCharAt;
@@ -188,12 +188,12 @@
 
         /***********************************************************************
 
-                Create a UString via the content of a UText. Note that the
+                Create a UString via the content of a UStringView. Note that the
                 default is to assume the content is immutable (read-only).
 
         ***********************************************************************/
 
-        this (UText other, bool mutable = false)
+        this (UStringView other, bool mutable = false)
         {
                 this (other.get, mutable);
         }
@@ -295,7 +295,7 @@
 
                         To be safe, we ask the allocator in use whether
                         the content it provided can be mutated or not.
-                        Note that this is not necessary for UText, since
+                        Note that this is not necessary for UStringView, since
                         that is a read-only construct.
 
                 ***************************************************************/
@@ -356,7 +356,7 @@
 
         ***********************************************************************/
 
-        UString opCat (UText other)
+        UString opCat (UStringView other)
         {
                 return opCat (other.get);
         }
@@ -367,7 +367,7 @@
 
         ***********************************************************************/
 
-        UString opCat (UText other, uint start, uint len=uint.max)
+        UString opCat (UStringView other, uint start, uint len=uint.max)
         {
                 other.pinIndices (start, len);
                 return opCat (other.content [start..start+len]);
@@ -403,7 +403,7 @@
 
         UString opCat (char[] chars)
         {
-                uint fmt (wchar* dst, uint len, inout Error e)
+                uint fmt (wchar* dst, uint len, inout UErrorCode e)
                 {
                         uint x;
 
@@ -459,7 +459,7 @@
 
         ***********************************************************************/
 
-        UString setTo (UText other, bool mutable = true)
+        UString setTo (UStringView other, bool mutable = true)
         {
                 return setTo (other.get, mutable);
         }
@@ -474,7 +474,7 @@
 
         ***********************************************************************/
 
-        UString setTo (UText other, uint start, uint len, bool mutable = true)
+        UString setTo (UStringView other, uint start, uint len, bool mutable = true)
         {
                 other.pinIndices (start, len);
                 return setTo (other.content [start..start+len], mutable);
@@ -621,11 +621,11 @@
 
         ***********************************************************************/
 
-        typedef uint delegate (wchar* dst, uint len, inout Error e) Formatter;
+        typedef uint delegate (wchar* dst, uint len, inout UErrorCode e) Formatter;
 
         package final UString format (Formatter format, char[] msg)
         {
-                Error   e;
+                UErrorCode   e;
                 uint    length;
 
                 while (true)
@@ -653,11 +653,11 @@
 
 *******************************************************************************/
 
-class UText : ICU, ITextOther
+class UStringView : ICU, ITextOther
 {
         alias opIndex   charAt;
 
-        // the core of the UText and UString attributes. The name 'len'
+        // the core of the UStringView and UString attributes. The name 'len'
         // is used rather than the more obvious 'length' since there is
         // a collision with the silly array[length] syntactic sugar ...
         package uint    len;
@@ -666,7 +666,7 @@
         // this should probably be in UString only, but there seems to
         // be a compiler bug where it doesn't get initialised correctly,
         // and it's perhaps useful to have here for when a UString is
-        // passed as a UText argument.
+        // passed as a UStringView argument.
         private bool    mutable;
 
         // toFolded() argument
@@ -715,7 +715,7 @@
 
         /***********************************************************************
 
-                Return the valid content from this UText
+                Return the valid content from this UStringView
 
         ***********************************************************************/
 
@@ -726,13 +726,13 @@
 
         /***********************************************************************
 
-                Is this UText equal to another?
+                Is this UStringView equal to another?
 
         ***********************************************************************/
 
         final override int opEquals (Object o)
         {
-                UText other = cast(UText) o;
+                UStringView other = cast(UStringView) o;
 
                 if (other)
                     return (other is this || compare (other) == 0);
@@ -741,13 +741,13 @@
 
         /***********************************************************************
 
-                Compare this UText to another.
+                Compare this UStringView to another.
 
         ***********************************************************************/
 
         final override int opCmp (Object o)
         {
-                UText other = cast(UText) o;
+                UStringView other = cast(UStringView) o;
 
                 if (other is this)
                     return 0;
@@ -759,7 +759,7 @@
 
         /***********************************************************************
 
-                Hash this UText
+                Hash this UStringView
 
         ***********************************************************************/
 
@@ -770,7 +770,7 @@
 
         /***********************************************************************
 
-                Clone this UText into a UString
+                Clone this UStringView into a UString
 
         ***********************************************************************/
 
@@ -781,7 +781,7 @@
 
         /***********************************************************************
 
-                Clone a section of this UText into a UString
+                Clone a section of this UStringView into a UString
 
         ***********************************************************************/
 
@@ -859,7 +859,7 @@
 
         ***********************************************************************/
 
-        final int compare (UText other, bool codePointOrder=false)
+        final int compare (UStringView other, bool codePointOrder=false)
         {
                 return compare (other.get, codePointOrder);
         }
@@ -895,7 +895,7 @@
 
         ***********************************************************************/
 
-        final int compareFolded (UText other, CaseOption option = CaseOption.Default)
+        final int compareFolded (UStringView other, CaseOption option = CaseOption.Default)
         {
                 return compareFolded (other.content, option);
         }
@@ -920,18 +920,18 @@
 
         /***********************************************************************
 
-                Does this UText start with specified string?
+                Does this UStringView start with specified string?
 
         ***********************************************************************/
 
-        final bool startsWith (UText other)
+        final bool startsWith (UStringView other)
         {
                 return startsWith (other.get);
         }
 
         /***********************************************************************
 
-                Does this UText start with specified string?
+                Does this UStringView start with specified string?
 
         ***********************************************************************/
 
@@ -944,18 +944,18 @@
 
         /***********************************************************************
 
-                Does this UText end with specified string?
+                Does this UStringView end with specified string?
 
         ***********************************************************************/
 
-        final bool endsWith (UText other)
+        final bool endsWith (UStringView other)
         {
                 return endsWith (other.get);
         }
 
         /***********************************************************************
 
-                Does this UText end with specified string?
+                Does this UStringView end with specified string?
 
         ***********************************************************************/
 
@@ -995,7 +995,7 @@
 
         ***********************************************************************/
 
-        final uint indexOf (UText other, uint start=0)
+        final uint indexOf (UStringView other, uint start=0)
         {
                 return indexOf (other.get, start);
         }
@@ -1046,7 +1046,7 @@
 
         ***********************************************************************/
 
-        final uint lastIndexOf (UText other, uint start=uint.max)
+        final uint lastIndexOf (UStringView other, uint start=uint.max)
         {
                 return lastIndexOf (other.get, start);
         }
@@ -1103,7 +1103,7 @@
 
         final UString toLower (UString dst, inout ULocale locale)
         {
-                uint lower (wchar* dst, uint length, inout Error e)
+                uint lower (wchar* dst, uint length, inout UErrorCode e)
                 {
                         return u_strToLower (dst, length, content.ptr, len, ICU.toString(locale.name), e);
                 }
@@ -1143,7 +1143,7 @@
 
         final UString toUpper (UString dst, inout ULocale locale)
         {
-                uint upper (wchar* dst, uint length, inout Error e)
+                uint upper (wchar* dst, uint length, inout UErrorCode e)
                 {
                         return u_strToUpper (dst, length, content.ptr, len, ICU.toString(locale.name), e);
                 }
@@ -1169,7 +1169,7 @@
 
         final UString toFolded (UString dst, CaseOption option = CaseOption.Default)
         {
-                uint fold (wchar* dst, uint length, inout Error e)
+                uint fold (wchar* dst, uint length, inout UErrorCode e)
                 {
                         return u_strFoldCase (dst, length, content.ptr, len, option, e);
                 }
@@ -1195,7 +1195,7 @@
         final char[] toUtf8 (char[] dst = null)
         {
                 uint    x;
-                Error   e;
+                UErrorCode   e;
 
                 if (! cast(char*) dst)
                       dst = new char[len * 4];
@@ -1207,12 +1207,12 @@
 
         /***********************************************************************
 
-                Remove leading and trailing whitespace from this UText.
+                Remove leading and trailing whitespace from this UStringView.
                 Note that we slice the content to remove leading space.
 
         ***********************************************************************/
 
-        UText trim ()
+        UStringView trim ()
         {
                 wchar   c;
                 uint    i = len;
@@ -1410,7 +1410,7 @@
 
         final private int compareFolded (wchar[] s1, wchar[] s2, CaseOption option = CaseOption.Default)
         {
-                Error e;
+                UErrorCode e;
 
                 int x = u_strCaseCompare (s1.ptr, s1.length, s2.ptr, s2.length, option, e);
                 testError (e, "compareFolded failed");
@@ -1439,14 +1439,14 @@
                 wchar* function (wchar*, wchar, uint) u_memchr;
                 wchar* function (wchar*, wchar, uint) u_memrchr;
                 int    function (wchar*, uint, wchar*, uint, bool) u_strCompare;
-                int    function (wchar*, uint, wchar*, uint, uint, inout Error) u_strCaseCompare;
+                int    function (wchar*, uint, wchar*, uint, uint, inout UErrorCode) u_strCaseCompare;
                 dchar  function (CharAt, uint*, uint, void*) u_unescapeAt;
                 uint   function (wchar*, uint) u_countChar32;
-                uint   function (wchar*, uint, wchar*, uint, char*, inout Error) u_strToUpper;
-                uint   function (wchar*, uint, wchar*, uint, char*, inout Error) u_strToLower;
-                uint   function (wchar*, uint, wchar*, uint, uint, inout Error) u_strFoldCase;
-                wchar* function (wchar*, uint, uint*, char*, uint, inout Error) u_strFromUTF8;
-                char*  function (char*, uint, uint*, wchar*, uint, inout Error) u_strToUTF8;
+                uint   function (wchar*, uint, wchar*, uint, char*, inout UErrorCode) u_strToUpper;
+                uint   function (wchar*, uint, wchar*, uint, char*, inout UErrorCode) u_strToLower;
+                uint   function (wchar*, uint, wchar*, uint, uint, inout UErrorCode) u_strFoldCase;
+                wchar* function (wchar*, uint, uint*, char*, uint, inout UErrorCode) u_strFromUTF8;
+                char*  function (char*, uint, uint*, wchar*, uint, inout UErrorCode) u_strToUTF8;
         }
 
         /***********************************************************************