dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Globalization SortKey.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Globalization SortKey.cs,NONE,1.1 _I18NCompareInfo.cs,NONE,1.1 CompareInfo.cs,1.3,1.4 CultureInfo.cs,1.9,1.10
Date: Wed, 13 Nov 2002 20:51:21 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Globalization
In directory subversions:/tmp/cvs-serv13707/runtime/System/Globalization

Modified Files:
        CompareInfo.cs CultureInfo.cs 
Added Files:
        SortKey.cs _I18NCompareInfo.cs 
Log Message:


Add some of the I18N support infrastructure for
"System.Globalization.CompareInfo".


--- NEW FILE ---
/*
 * SortKey.cs - Implementation of the
 *              "System.Globalization.SortKey" class.
 *
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Globalization
{

#if !ECMA_COMPAT

public class SortKey
{
        // Internal state.
        private byte[] keyData;
        private String origString;

        // This class has virtual methods, but it cannot be constructed
        // or inherited according to the specification!  We construct the
        // SortKey instance from "CompareInfo".
        internal SortKey(byte[] keyData, String origString)
                        {
                                this.keyData = keyData;
                                this.origString = origString;
                        }

        // Compare two sort keys.
        public static int Compare(SortKey sortkey1, SortKey sortkey2)
                        {
                                if(sortkey1 == null)
                                {
                                        throw new 
ArgumentNullException("sortkey1");
                                }
                                if(sortkey2 == null)
                                {
                                        throw new 
ArgumentNullException("sortkey2");
                                }
                                byte[] data1 = sortkey1.keyData;
                                byte[] data2 = sortkey2.keyData;
                                int minlen = ((data1.Length < data2.Length) ?
                                                                        
data1.Length : data2.Length);
                                int posn;
                                for(posn = 0; posn < minlen; ++posn)
                                {
                                        if(data1[posn] < data2[posn])
                                        {
                                                return -1;
                                        }
                                        else if(data1[posn] > data2[posn])
                                        {
                                                return 1;
                                        }
                                }
                                if(data1.Length < data2.Length)
                                {
                                        return -1;
                                }
                                else if(data1.Length > data2.Length)
                                {
                                        return 1;
                                }
                                else
                                {
                                        return 0;
                                }
                        }

        // Get the sort key data.
        public virtual byte[] KeyData
                        {
                                get
                                {
                                        return keyData;
                                }
                        }

        // Get the original string that was used to create the sort key.
        public virtual String OriginalString
                        {
                                get
                                {
                                        return origString;
                                }
                        }

        // Determine if two sort keys are equal.
        public override bool Equals(Object obj)
                        {
                                SortKey other = (obj as SortKey);
                                if(other != null)
                                {
                                        return (Compare(this, other) == 0);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return origString.GetHashCode();
                        }

        // Convert this sort key into a string.
        public override String ToString()
                        {
                                return "[Sort key for:" + origString + "]";
                        }

}; // class SortKey

#endif // !ECMA_COMPAT

}; // namespace System.Globalization

--- NEW FILE ---
/*
 * _I18NCompareInfo.cs - Implementation of the
 *              "System.Globalization._I18NCompareInfo" class.
 *
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Globalization
{

// This class exists to allow us to inherit from "CompareInfo" within
// the "I18N" code.  It must not be used in application programs.  There
// really isn't any other way of doing this because the specification
// says that "CompareInfo" does not have a public constructor.

public abstract class _I18NCompareInfo : CompareInfo
{
        // Constructors.
        public _I18NCompareInfo(int culture) : base(culture) {}

        // Compare two strings.  Note: "string1" or "string2" may be NULL
        // if "offsetX" and "lengthX" are both zero for that string.  Null
        // strings are treated like the empty string during comparisons.
        public abstract int CompareImpl(String string1, int offset1, int 
length1,
                                                                    String 
string2, int offset2, int length2,
                                                                        
CompareOptions options);

        // Get the sort key data for a string.
        public abstract byte[] GetSortKeyImpl(String source,
                                                                                
  CompareOptions options);

}; // class _I18NCompareInfo

}; // namespace System.Globalization

Index: CompareInfo.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Globalization/CompareInfo.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** CompareInfo.cs      20 Dec 2001 10:11:39 -0000      1.3
--- CompareInfo.cs      14 Nov 2002 01:51:19 -0000      1.4
***************
*** 3,7 ****
   *            "System.Globalization.CompareInfo" class.
   *
!  * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
   *
   * This program is free software; you can redistribute it and/or modify
--- 3,7 ----
   *            "System.Globalization.CompareInfo" class.
   *
!  * Copyright (C) 2001, 2002  Southern Storm Software, Pty Ltd.
   *
   * This program is free software; you can redistribute it and/or modify
***************
*** 23,39 ****
  {
  
! [TODO]
! public class CompareInfo
  {
  
! // TODO
  
        [TODO]
!       public int Compare(String string1, String string2, CompareOptions 
options)
                        {
!                               // TODO
!                               return String.Compare
!                                               (string1, string2,
!                                            (options & 
CompareOptions.IgnoreCase) != 0);
                        }
  
--- 23,654 ----
  {
  
! using System.Reflection;
! using System.Text;
! using System.Runtime.Serialization;
! 
! public class CompareInfo : IDeserializationCallback
  {
+       // Culture that this comparison object is attached to.
+       private int culture;
+ 
+       // Global compare object for the invariant culture.
+       private static CompareInfo invariantCompare;
+ 
+       // Programmers cannot create instances of this class according
+       // to the specification, even though it has virtual methods!
+       // In fact, we _can_ inherit it through "_I18NCompareInfo",
+       // but that is private to this implementation and should not be
+       // used by application programmers.
+       internal CompareInfo(int culture)
+                       {
+                               this.culture = culture;
+                       }
+ 
+       // Get the comparison information for a specific culture.
+       public static CompareInfo GetCompareInfo(int culture)
+                       {
+                               Object info;
+                               info = Encoding.InvokeI18N("GetCompareInfo", 
culture);
+                               if(info == null)
+                               {
+                                       // Try the neutral culture instead.
+                                       info = Encoding.InvokeI18N
+                                               ("GetCompareInfo", culture & 
0x00FF);
+                                       if(info == null)
+                                       {
+                                               // Return the invariant culture 
information.
+                                               lock(typeof(CompareInfo))
+                                               {
+                                                       if(invariantCompare == 
null)
+                                                       {
+                                                               
invariantCompare = new CompareInfo(0x007F);
+                                                       }
+                                                       return invariantCompare;
+                                               }
+                                       }
+                               }
+                               return (CompareInfo)info;
+                       }
+       public static CompareInfo GetCompareInfo(String culture)
+                       {
+                               if(culture == null)
+                               {
+                                       throw new 
ArgumentNullException("culture");
+                               }
+                               return 
GetCompareInfo(CultureInfo.MapNameToID(culture));
+                       }
+       public static CompareInfo GetCompareInfo(int culture, Assembly assembly)
+                       {
+                               if(assembly == null)
+                               {
+                                       throw new 
ArgumentNullException("assembly");
+                               }
+                               else if(assembly != 
typeof(Object).Module.Assembly)
+                               {
+                                       throw new ArgumentException
+                                               (_("Arg_MustBeCoreLib"), 
"assembly");
+                               }
+                               return GetCompareInfo(culture);
+                       }
+       public static CompareInfo GetCompareInfo(String culture, Assembly 
assembly)
+                       {
+                               if(assembly == null)
+                               {
+                                       throw new 
ArgumentNullException("assembly");
+                               }
+                               else if(assembly != 
typeof(Object).Module.Assembly)
+                               {
+                                       throw new ArgumentException
+                                               (_("Arg_MustBeCoreLib"), 
"assembly");
+                               }
+                               return GetCompareInfo(culture);
+                       }
  
!       // Get the identifier for this comparison object's culture.
!       public int LCID
!                       {
!                               get
!                               {
!                                       return culture;
!                               }
!                       }
  
+       // Compare two strings.
+       public virtual int Compare(String string1, String string2)
+                       {
+                               return DefaultCompare(string1, 0,
+                                                                         
((string1 != null) ? string1.Length : 0),
+                                                                         
string2, 0,
+                                                                         
((string2 != null) ? string2.Length : 0),
+                                                                         
CompareOptions.None);
+                       }
+       public virtual int Compare(String string1, String string2,
+                                                          CompareOptions 
options)
+                       {
+                               return DefaultCompare(string1, 0,
+                                                                         
((string1 != null) ? string1.Length : 0),
+                                                                         
string2, 0,
+                                                                         
((string2 != null) ? string2.Length : 0),
+                                                                         
options);
+                       }
+       public virtual int Compare(String string1, int offset1,
+                                                          String string2, int 
offset2)
+                       {
+                               return DefaultCompare(string1, offset1,
+                                                                         
((string1 != null) ?
+                                                                               
        (string1.Length - offset1) : 0),
+                                                                         
string2, offset2,
+                                                                         
((string2 != null) ?
+                                                                               
        (string2.Length - offset2) : 0),
+                                                                         
CompareOptions.None);
+                       }
+       public virtual int Compare(String string1, int offset1,
+                                                          String string2, int 
offset2,
+                                                          CompareOptions 
options)
+                       {
+                               return DefaultCompare(string1, offset1,
+                                                                         
((string1 != null) ?
+                                                                               
        (string1.Length - offset1) : 0),
+                                                                         
string2, offset2,
+                                                                         
((string2 != null) ?
+                                                                               
        (string2.Length - offset2) : 0),
+                                                                         
options);
+                       }
+       public virtual int Compare(String string1, int offset1,
+                                                          String string2, int 
offset2,
+                                                          int length)
+                       {
+                               return DefaultCompare(string1, offset1, length,
+                                                                         
string2, offset2, length,
+                                                                         
CompareOptions.None);
+                       }
+       public virtual int Compare(String string1, int offset1,
+                                                          String string2, int 
offset2,
+                                                          int length, 
CompareOptions options)
+                       {
+                               return DefaultCompare(string1, offset1, length,
+                                                                         
string2, offset2, length, options);
+                       }
+ 
+       // Default "Compare" implementation that uses I18N to do the work.
+       private int DefaultCompare(String string1, int offset1, int length1,
+                                                          String string2, int 
offset2, int length2,
+                                                          CompareOptions 
options)
+                       {
+                               if(offset1 < 0)
+                               {
+                                       throw new ArgumentOutOfRangeException
+                                               ("offset1", 
_("ArgRange_StringIndex"));
+                               }
+                               if(offset2 < 0)
+                               {
+                                       throw new ArgumentOutOfRangeException
+                                               ("offset2", 
_("ArgRange_StringIndex"));
+                               }
+                               if(length1 < 0)
+                               {
+                                       throw new ArgumentOutOfRangeException
+                                               ("length1", 
_("ArgRange_StringRange"));
+                               }
+                               if(length2 < 0)
+                               {
+                                       throw new ArgumentOutOfRangeException
+                                               ("length2", 
_("ArgRange_StringRange"));
+                               }
+                               if(string1 != null)
+                               {
+                                       if(offset1 >= string1.Length)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("offset1", 
_("ArgRange_StringIndex"));
+                                       }
+                                       if(length1 > (string1.Length - offset1))
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("length1", 
_("ArgRange_StringRange"));
+                                       }
+                               }
+                               else
+                               {
+                                       if(offset1 > 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("offset1", 
_("ArgRange_StringIndex"));
+                                       }
+                                       if(length1 > 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("length1", 
_("ArgRange_StringRange"));
+                                       }
+                               }
+                               if(string2 != null)
+                               {
+                                       if(offset2 >= string2.Length)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("offset2", 
_("ArgRange_StringIndex"));
+                                       }
+                                       if(length2 > (string2.Length - offset2))
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("length2", 
_("ArgRange_StringRange"));
+                                       }
+                               }
+                               else
+                               {
+                                       if(offset2 > 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("offset2", 
_("ArgRange_StringIndex"));
+                                       }
+                                       if(length2 > 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("length2", 
_("ArgRange_StringRange"));
+                                       }
+                               }
+                               if(this is _I18NCompareInfo)
+                               {
+                                       // Use the I18N-supplied comparison 
routine.
+                                       return 
((_I18NCompareInfo)this).CompareImpl
+                                               (string1, offset1, length1,
+                                                string2, offset2, length2, 
options);
+                               }
+                               else
+                               {
+                                       // Use the invariant comparison method 
in the engine.
+                                       return String.InternalCompare
+                                               (string1, offset1, length1,
+                                                string2, offset2, length2,
+                                                ((options & 
CompareOptions.IgnoreCase) != 0), null);
+                               }
+                       }
+ 
+       // Determine if two CompareInfo objects are equal.
+       public override bool Equals(Object obj)
+                       {
+                               CompareInfo other = (obj as CompareInfo);
+                               if(other != null)
+                               {
+                                       return (LCID == other.LCID);
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+ 
+       // Get a hash code for this object.
+       public override int GetHashCode()
+                       {
+                               return LCID;
+                       }
+ 
+       // Get the sort key for a string.
+       public virtual SortKey GetSortKey(String source)
+                       {
+                               return GetSortKey(source, CompareOptions.None);
+                       }
        [TODO]
!       public virtual SortKey GetSortKey(String source, CompareOptions options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               if(this is _I18NCompareInfo)
!                               {
!                                       // Ask the subclass for the raw sort 
key data.
!                                       return new 
SortKey(((_I18NCompareInfo)this).GetSortKeyImpl
!                                                               (source, 
options), source);
!                               }
!                               else
!                               {
!                                       // Return the invariant sort key 
information.
!                                       // TODO
!                                       return null;
!                               }
!                       }
! 
!       // Search for a specific character in a string.
!       public virtual int IndexOf(String source, char value)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, 0, source.Length,
!                                                          CompareOptions.None);
!                       }
!       public virtual int IndexOf(String source, char value,
!                                                          CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, 0, source.Length, 
options);
!                       }
!       public virtual int IndexOf(String source, char value, int startIndex)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, startIndex,
!                                                          source.Length - 
startIndex,
!                                                          CompareOptions.None);
!                       }
!       public virtual int IndexOf(String source, char value, int startIndex,
!                                                          CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, startIndex,
!                                                          source.Length - 
startIndex, options);
!                       }
!       public virtual int IndexOf(String source, char value,
!                                                          int startIndex, int 
count)
!                       {
!                               return IndexOf(source, value, startIndex, count,
!                                                          CompareOptions.None);
!                       }
!       public virtual int IndexOf(String source, char value,
!                                                          int startIndex, int 
count,
!                                                          CompareOptions 
options)
!                       {
!                               // This may be overridden in subclasses with a 
more
!                               // efficient implementation if desired.
!                               return IndexOf(source, new String(value, 1),
!                                                          startIndex, count, 
options);
!                       }
! 
!       // Search for a specific substring in a string.
!       public virtual int IndexOf(String source, String value)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, 0, source.Length,
!                                                          CompareOptions.None);
!                       }
!       public virtual int IndexOf(String source, String value,
!                                                          CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, 0, source.Length, 
options);
!                       }
!       public virtual int IndexOf(String source, String value, int startIndex)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, startIndex,
!                                                          source.Length - 
startIndex,
!                                                          CompareOptions.None);
!                       }
!       public virtual int IndexOf(String source, String value, int startIndex,
!                                                          CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return IndexOf(source, value, startIndex,
!                                                          source.Length - 
startIndex, options);
!                       }
!       public virtual int IndexOf(String source, String value,
!                                                          int startIndex, int 
count)
!                       {
!                               return IndexOf(source, value, startIndex, count,
!                                                          CompareOptions.None);
!                       }
!       public virtual int IndexOf(String source, String value,
!                                                          int startIndex, int 
count,
!                                                          CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               if(value == null)
!                               {
!                                       throw new 
ArgumentNullException("value");
!                               }
!                               if(startIndex < 0)
!                               {
!                                       throw new ArgumentOutOfRangeException
!                                               ("startIndex", 
_("ArgRange_StringIndex"));
!                               }
!                               if(count < 0 || (source.Length - startIndex) < 
count)
!                               {
!                                       throw new ArgumentOutOfRangeException
!                                               ("count", 
_("ArgRange_StringRange"));
!                               }
!                               int vlen = value.Length;
!                               while(count >= vlen)
!                               {
!                                       if(Compare(source, startIndex, value, 0,
!                                                          vlen, options) == 0)
!                                       {
!                                               return startIndex;
!                                       }
!                                       ++startIndex;
!                                       --count;
!                               }
!                               return -1;
!                       }
! 
!       // Determine if one string is a prefix of another.
!       public virtual bool IsPrefix(String source, String prefix)
!                       {
!                               return IsPrefix(source, prefix, 
CompareOptions.None);
!                       }
!       public virtual bool IsPrefix(String source, String prefix,
!                                                                CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               if(prefix == null)
!                               {
!                                       throw new 
ArgumentNullException("prefix");
!                               }
!                               if(source.Length < prefix.Length)
!                               {
!                                       return false;
!                               }
!                               else
!                               {
!                                       return (Compare(source, 0, prefix, 0,
!                                                                   
prefix.Length, options) == 0);
!                               }
!                       }
! 
!       // Determine if one string is a suffix of another.
!       public virtual bool IsSuffix(String source, String suffix)
!                       {
!                               return IsSuffix(source, suffix, 
CompareOptions.None);
!                       }
!       public virtual bool IsSuffix(String source, String suffix,
!                                                                CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               if(suffix == null)
!                               {
!                                       throw new 
ArgumentNullException("suffix");
!                               }
!                               if(source.Length < suffix.Length)
!                               {
!                                       return false;
!                               }
!                               else
!                               {
!                                       return (Compare(source, source.Length - 
suffix.Length,
!                                                                   suffix, 0, 
suffix.Length, options) == 0);
!                               }
!                       }
! 
!       // Search backwards for a specific character in a string.
!       public virtual int LastIndexOf(String source, char value)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, 0, 
source.Length,
!                                                              
CompareOptions.None);
!                       }
!       public virtual int LastIndexOf(String source, char value,
!                                                              CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, 0, 
source.Length, options);
!                       }
!       public virtual int LastIndexOf(String source, char value, int 
startIndex)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, startIndex,
!                                                              source.Length - 
startIndex,
!                                                              
CompareOptions.None);
!                       }
!       public virtual int LastIndexOf(String source, char value, int 
startIndex,
!                                                              CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, startIndex,
!                                                              source.Length - 
startIndex, options);
!                       }
!       public virtual int LastIndexOf(String source, char value,
!                                                              int startIndex, 
int count)
!                       {
!                               return LastIndexOf(source, value, startIndex, 
count,
!                                                              
CompareOptions.None);
!                       }
!       public virtual int LastIndexOf(String source, char value,
!                                                              int startIndex, 
int count,
!                                                              CompareOptions 
options)
!                       {
!                               // This may be overridden in subclasses with a 
more
!                               // efficient implementation if desired.
!                               return LastIndexOf(source, new String(value, 1),
!                                                              startIndex, 
count, options);
!                       }
! 
!       // Search backwards for a specific substring in a string.
!       public virtual int LastIndexOf(String source, String value)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, 0, 
source.Length,
!                                                              
CompareOptions.None);
!                       }
!       public virtual int LastIndexOf(String source, String value,
!                                                              CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, 0, 
source.Length, options);
!                       }
!       public virtual int LastIndexOf(String source, String value, int 
startIndex)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, startIndex,
!                                                              source.Length - 
startIndex,
!                                                              
CompareOptions.None);
!                       }
!       public virtual int LastIndexOf(String source, String value, int 
startIndex,
!                                                          CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               return LastIndexOf(source, value, startIndex,
!                                                              source.Length - 
startIndex, options);
!                       }
!       public virtual int LastIndexOf(String source, String value,
!                                                              int startIndex, 
int count)
!                       {
!                               return LastIndexOf(source, value, startIndex, 
count,
!                                                              
CompareOptions.None);
!                       }
!       public virtual int LastIndexOf(String source, String value,
!                                                              int startIndex, 
int count,
!                                                              CompareOptions 
options)
!                       {
!                               if(source == null)
!                               {
!                                       throw new 
ArgumentNullException("source");
!                               }
!                               if(value == null)
!                               {
!                                       throw new 
ArgumentNullException("value");
!                               }
!                               if(startIndex < 0)
!                               {
!                                       throw new ArgumentOutOfRangeException
!                                               ("startIndex", 
_("ArgRange_StringIndex"));
!                               }
!                               if(count < 0 || (startIndex - count) < -1)
!                               {
!                                       throw new ArgumentOutOfRangeException
!                                               ("count", 
_("ArgRange_StringRange"));
!                               }
!                               int vlen = value.Length;
!                               if(vlen == 0)
!                               {
!                                       return 0;
!                               }
!                               while(count >= vlen)
!                               {
!                                       if(Compare(source, startIndex - vlen + 
1,
!                                                  value, 0, vlen, options) == 
0)
!                                       {
!                                               return startIndex - vlen + 1;
!                                       }
!                                       --startIndex;
!                                       --count;
!                               }
!                               return -1;
!                       }
! 
!       // Implement IDeserializationCallback.
!       void IDeserializationCallback.OnDeserialization(Object sender)
!                       {
!                               // Nothing to do here.
!                       }
! 
!       // Convert this object into a string.
!       public override String ToString()
                        {
!                               return "[CompareInfo:" + culture.ToString("x") 
+ "]";
                        }
  

Index: CultureInfo.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Globalization/CultureInfo.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** CultureInfo.cs      13 Nov 2002 11:54:36 -0000      1.9
--- CultureInfo.cs      14 Nov 2002 01:51:19 -0000      1.10
***************
*** 243,253 ****
  
        // Get the comparison rules that are used by the culture.
-       [TODO]
        public virtual CompareInfo CompareInfo
                        {
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                        }
--- 243,251 ----
  
        // Get the comparison rules that are used by the culture.
        public virtual CompareInfo CompareInfo
                        {
                                get
                                {
!                                       return 
CompareInfo.GetCompareInfo(cultureID);
                                }
                        }
***************
*** 491,494 ****
--- 489,500 ----
                                        return null;
                                }
+                       }
+ 
+       // Map a culture name to an identifier.
+       [TODO]
+       internal static int MapNameToID(String name)
+                       {
+                               // TODO
+                               return 0x007F;
                        }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]