You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -1,41 +0,0 @@
|
||||
// ::MONO
|
||||
//
|
||||
// System.Globalization.CalendarAlgorithmType.cs
|
||||
//
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public enum CalendarAlgorithmType
|
||||
{
|
||||
Unknown = 0,
|
||||
SolarCalendar = 1,
|
||||
LunarCalendar = 2,
|
||||
LunisolarCalendar = 3,
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// ::MONO
|
||||
//
|
||||
// System.Globalization.CalendarWeekRule.cs
|
||||
//
|
||||
// Copyright (C) Wictor Wilén 2001 (wictor@iBizkit.se)
|
||||
//
|
||||
// Contributors: Wictor Wilén
|
||||
//
|
||||
// Revisions
|
||||
// 2001-09-14: First draft
|
||||
// 2001-09-15: First release
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
/// <summary>
|
||||
/// The System.Globalization.CalendarWeekRule enumeration
|
||||
/// </summary>
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
[System.Serializable]
|
||||
public enum CalendarWeekRule
|
||||
{
|
||||
FirstDay = 0,
|
||||
FirstFullWeek = 1,
|
||||
FirstFourDayWeek = 2
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
// CompareOptions.cs
|
||||
//
|
||||
// This code was automatically generated from
|
||||
// ECMA CLI XML Library Specification.
|
||||
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
|
||||
// Created: Wed, 5 Sep 2001 06:34:52 UTC
|
||||
// Source file: all.xml
|
||||
// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
[System.Serializable]
|
||||
[Flags]
|
||||
public enum CompareOptions {
|
||||
None = 0,
|
||||
IgnoreCase = 1,
|
||||
IgnoreNonSpace = 2,
|
||||
IgnoreSymbols = 4,
|
||||
IgnoreKanaType = 8,
|
||||
IgnoreWidth = 16,
|
||||
|
||||
StringSort = 0x20000000,
|
||||
Ordinal = 0x40000000,
|
||||
OrdinalIgnoreCase = 0x10000000
|
||||
} // CompareOptions
|
||||
|
||||
} // System.Globalization
|
||||
@@ -60,10 +60,10 @@ namespace System.Globalization
|
||||
int default_calendar_type;
|
||||
bool m_useUserOverride;
|
||||
[NonSerialized]
|
||||
volatile NumberFormatInfo numInfo;
|
||||
internal volatile NumberFormatInfo numInfo;
|
||||
internal volatile DateTimeFormatInfo dateTimeInfo;
|
||||
volatile TextInfo textInfo;
|
||||
private string m_name;
|
||||
internal string m_name;
|
||||
|
||||
[NonSerialized]
|
||||
private string englishname;
|
||||
@@ -84,6 +84,16 @@ namespace System.Globalization
|
||||
[NonSerialized]
|
||||
private unsafe readonly void *textinfo_data;
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
struct Data {
|
||||
public int ansi;
|
||||
public int ebcdic;
|
||||
public int mac;
|
||||
public int oem;
|
||||
public bool right_to_left;
|
||||
public byte list_sep;
|
||||
}
|
||||
|
||||
int m_dataItem; // MS.NET serializes this.
|
||||
#pragma warning restore 169, 649
|
||||
|
||||
@@ -401,10 +411,7 @@ namespace System.Globalization
|
||||
public override bool Equals (object value)
|
||||
{
|
||||
CultureInfo b = value as CultureInfo;
|
||||
|
||||
if (b != null)
|
||||
return b.cultureID == cultureID;
|
||||
return false;
|
||||
return b != null && b.cultureID == cultureID && b.m_name == m_name;
|
||||
}
|
||||
|
||||
public static CultureInfo[] GetCultures(CultureTypes types)
|
||||
@@ -424,12 +431,19 @@ namespace System.Globalization
|
||||
|
||||
for (; i < infos.Length; ++i) {
|
||||
var ci = infos [i];
|
||||
infos [i].m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
|
||||
var ti = ci.GetTextInfoData ();
|
||||
infos [i].m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.number_index, ci.iso2lang,
|
||||
ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString ());
|
||||
}
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
unsafe Data GetTextInfoData ()
|
||||
{
|
||||
return *(Data*) textinfo_data;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return cultureID.GetHashCode ();
|
||||
@@ -495,15 +509,10 @@ namespace System.Globalization
|
||||
|
||||
public virtual NumberFormatInfo NumberFormat {
|
||||
get {
|
||||
if (!constructed) Construct ();
|
||||
CheckNeutral ();
|
||||
if (numInfo == null){
|
||||
lock (this){
|
||||
if (numInfo == null) {
|
||||
numInfo = new NumberFormatInfo (m_isReadOnly);
|
||||
construct_number_format ();
|
||||
}
|
||||
}
|
||||
if (numInfo == null) {
|
||||
NumberFormatInfo temp = new NumberFormatInfo(this.m_cultureData);
|
||||
temp.isReadOnly = m_isReadOnly;
|
||||
numInfo = temp;
|
||||
}
|
||||
|
||||
return numInfo;
|
||||
@@ -606,9 +615,6 @@ namespace System.Globalization
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static CultureInfo [] internal_get_cultures (bool neutral, bool specific, bool installed);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern void construct_number_format ();
|
||||
|
||||
private void ConstructInvariant (bool read_only)
|
||||
{
|
||||
cultureID = InvariantCultureId;
|
||||
@@ -633,7 +639,9 @@ namespace System.Globalization
|
||||
|
||||
private unsafe TextInfo CreateTextInfo (bool readOnly)
|
||||
{
|
||||
return new TextInfo (this, cultureID, this.textinfo_data, readOnly);
|
||||
TextInfo tempTextInfo = new TextInfo (this.m_cultureData);
|
||||
tempTextInfo.SetReadOnlyState (readOnly);
|
||||
return tempTextInfo;
|
||||
}
|
||||
|
||||
public CultureInfo (int culture) : this (culture, true) {}
|
||||
@@ -653,8 +661,8 @@ namespace System.Globalization
|
||||
|
||||
if (culture == InvariantCultureId) {
|
||||
/* Short circuit the invariant culture */
|
||||
ConstructInvariant (read_only);
|
||||
m_cultureData = CultureData.Invariant;
|
||||
ConstructInvariant (read_only);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -666,7 +674,9 @@ namespace System.Globalization
|
||||
throw new CultureNotFoundException ("culture", msg);
|
||||
}
|
||||
|
||||
m_cultureData = CultureData.GetCultureData (m_name, m_useUserOverride, datetime_index, CalendarType, iso2lang);
|
||||
var ti = GetTextInfoData ();
|
||||
m_cultureData = CultureData.GetCultureData (m_name, m_useUserOverride, datetime_index, CalendarType, number_index, iso2lang,
|
||||
ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString ());
|
||||
}
|
||||
|
||||
public CultureInfo (string name) : this (name, true) {}
|
||||
@@ -686,8 +696,8 @@ namespace System.Globalization
|
||||
|
||||
if (name.Length == 0) {
|
||||
/* Short circuit the invariant culture */
|
||||
ConstructInvariant (read_only);
|
||||
m_cultureData = CultureData.Invariant;
|
||||
ConstructInvariant (read_only);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -695,7 +705,9 @@ namespace System.Globalization
|
||||
throw CreateNotFoundException (name);
|
||||
}
|
||||
|
||||
m_cultureData = CultureData.GetCultureData (m_name, useUserOverride, datetime_index, CalendarType, iso2lang);
|
||||
var ti = GetTextInfoData ();
|
||||
m_cultureData = CultureData.GetCultureData (m_name, useUserOverride, datetime_index, CalendarType, number_index, iso2lang,
|
||||
ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString ());
|
||||
}
|
||||
|
||||
// This is used when creating by specific name and creating by
|
||||
@@ -812,7 +824,10 @@ namespace System.Globalization
|
||||
if (ci.IsNeutralCulture)
|
||||
ci = CreateSpecificCultureFromNeutral (ci.Name);
|
||||
|
||||
ci.m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
|
||||
var ti = ci.GetTextInfoData ();
|
||||
|
||||
ci.m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.number_index, ci.iso2lang,
|
||||
ti.ansi, ti.oem, ti.mac, ti.ebcdic, ti.right_to_left, ((char)ti.list_sep).ToString ());
|
||||
return ci;
|
||||
}
|
||||
|
||||
@@ -1053,6 +1068,12 @@ namespace System.Globalization
|
||||
}
|
||||
}
|
||||
|
||||
internal string SortName {
|
||||
get {
|
||||
return m_name;
|
||||
}
|
||||
}
|
||||
|
||||
#region reference sources
|
||||
// TODO:
|
||||
internal static readonly bool IsTaiwanSku;
|
||||
@@ -1076,6 +1097,35 @@ namespace System.Globalization
|
||||
Contract.EndContractBlock();
|
||||
}
|
||||
|
||||
// For resource lookup, we consider a culture the invariant culture by name equality.
|
||||
// We perform this check frequently during resource lookup, so adding a property for
|
||||
// improved readability.
|
||||
internal bool HasInvariantCultureName
|
||||
{
|
||||
get { return Name == CultureInfo.InvariantCulture.Name; }
|
||||
}
|
||||
|
||||
internal static bool VerifyCultureName(String cultureName, bool throwException)
|
||||
{
|
||||
// This function is used by ResourceManager.GetResourceFileName().
|
||||
// ResourceManager searches for resource using CultureInfo.Name,
|
||||
// so we should check against CultureInfo.Name.
|
||||
|
||||
for (int i=0; i<cultureName.Length; i++) {
|
||||
char c = cultureName[i];
|
||||
//
|
||||
|
||||
if (Char.IsLetterOrDigit(c) || c=='-' || c=='_') {
|
||||
continue;
|
||||
}
|
||||
if (throwException) {
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidResourceCultureName", cultureName));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
//
|
||||
// System.Globalization.CultureNotFoundException.cs
|
||||
//
|
||||
// Authors:
|
||||
// Gonzalo Paniagua Javier (gonzalo@novell.com)
|
||||
//
|
||||
// Copyright (c) 2010 Novell (http://www.novell.com)
|
||||
//
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Globalization {
|
||||
[Serializable]
|
||||
[ComVisible (true)]
|
||||
public class CultureNotFoundException : ArgumentException, ISerializable {
|
||||
string invalid_culture_name;
|
||||
int? invalid_culture_id;
|
||||
|
||||
public CultureNotFoundException () : base ("Culture not found")
|
||||
{
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string message) : base (message)
|
||||
{
|
||||
}
|
||||
|
||||
protected CultureNotFoundException (SerializationInfo info, StreamingContext context)
|
||||
: base (info, context)
|
||||
{
|
||||
invalid_culture_name = (string) info.GetValue ("invalid_culture_name", typeof (string));
|
||||
invalid_culture_id = (int?) info.GetValue ("invalid_culture_id", typeof (int?));
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string message, Exception innerException)
|
||||
: base (message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string paramName, string message)
|
||||
: base (message, paramName)
|
||||
{
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string message, int invalidCultureId, Exception innerException)
|
||||
: base (message, innerException)
|
||||
{
|
||||
invalid_culture_id = invalidCultureId;
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string paramName, int invalidCultureId, string message)
|
||||
: base (message, paramName)
|
||||
{
|
||||
invalid_culture_id = invalidCultureId;
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string message, string invalidCultureName, Exception innerException)
|
||||
: base (message, innerException)
|
||||
{
|
||||
invalid_culture_name = invalidCultureName;
|
||||
}
|
||||
|
||||
public CultureNotFoundException (string paramName, string invalidCultureName, string message)
|
||||
: base (message, paramName)
|
||||
{
|
||||
invalid_culture_name = invalidCultureName;
|
||||
}
|
||||
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException ("info");
|
||||
|
||||
base.GetObjectData (info, context);
|
||||
info.AddValue ("invalid_culture_name", invalid_culture_name, typeof (string));
|
||||
info.AddValue ("invalid_culture_id", invalid_culture_id, typeof (int?));
|
||||
}
|
||||
|
||||
public virtual int? InvalidCultureId {
|
||||
get { return invalid_culture_id; }
|
||||
}
|
||||
|
||||
public virtual string InvalidCultureName {
|
||||
get { return invalid_culture_name; }
|
||||
}
|
||||
|
||||
public override string Message {
|
||||
get {
|
||||
if (invalid_culture_name == null && invalid_culture_id.HasValue == false)
|
||||
return base.Message;
|
||||
|
||||
if (invalid_culture_name != null)
|
||||
return String.Format ("Culture name {0} is invalid", invalid_culture_name);
|
||||
return String.Format ("Culture ID {0} is invalid", invalid_culture_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
// CultureTypes.cs
|
||||
//
|
||||
// This code was automatically generated from
|
||||
// ECMA CLI XML Library Specification.
|
||||
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
|
||||
// Created: Wed, 5 Sep 2001 06:35:02 UTC
|
||||
// Source file: all.xml
|
||||
// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
[System.Serializable]
|
||||
public enum CultureTypes {
|
||||
NeutralCultures = 1,
|
||||
SpecificCultures = 2,
|
||||
InstalledWin32Cultures = 4,
|
||||
AllCultures = 7,
|
||||
UserCustomCulture = 8,
|
||||
ReplacementCultures = 16,
|
||||
[Obsolete]
|
||||
WindowsOnlyCultures = 32,
|
||||
[Obsolete]
|
||||
FrameworkCultures = 64,
|
||||
} // CultureTypes
|
||||
|
||||
} // System.Globalization
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// System.Globalization.DateTimeFormatInfo.cs
|
||||
//
|
||||
// Authors:
|
||||
// Martin Weindel (martin.weindel@t-online.de)
|
||||
// Marek Safar (marek.safar@gmail.com)
|
||||
//
|
||||
// (C) Martin Weindel (martin.weindel@t-online.de)
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
public sealed partial class DateTimeFormatInfo : ICloneable, IFormatProvider
|
||||
{
|
||||
[NonSerialized]
|
||||
private string m_fullTimeSpanPositivePattern;
|
||||
internal String FullTimeSpanPositivePattern {
|
||||
get {
|
||||
if (m_fullTimeSpanPositivePattern == null) {
|
||||
String decimalSeparator = Culture.NumberFormat.NumberDecimalSeparator;
|
||||
|
||||
m_fullTimeSpanPositivePattern = "d':'h':'mm':'ss'" + decimalSeparator + "'FFFFFFF";
|
||||
}
|
||||
|
||||
return m_fullTimeSpanPositivePattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// DateTimeStyles.cs
|
||||
//
|
||||
// This code was automatically generated from
|
||||
// ECMA CLI XML Library Specification.
|
||||
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
|
||||
// Created: Fri, 7 Sep 2001 16:32:07 UTC
|
||||
// Source file: AllTypes.xml
|
||||
// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
[Flags]
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public enum DateTimeStyles {
|
||||
None = 0x00000000,
|
||||
AllowLeadingWhite = 0x00000001,
|
||||
AllowTrailingWhite = 0x00000002,
|
||||
AllowInnerWhite = 0x00000004,
|
||||
AllowWhiteSpaces = AllowLeadingWhite | AllowTrailingWhite | AllowInnerWhite,
|
||||
NoCurrentDateDefault = 0x00000008,
|
||||
AdjustToUniversal = 0x00000010,
|
||||
AssumeLocal = 0x00000020,
|
||||
AssumeUniversal = 0x00000040,
|
||||
RoundtripKind = 0x00000080,
|
||||
} // DateTimeStyles
|
||||
|
||||
} // System.Globalization
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum DigitShapes {
|
||||
Context = 0,
|
||||
None = 1,
|
||||
NativeNational = 2
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
// GregorianCalendarTypes.cs
|
||||
//
|
||||
// This code was automatically generated from
|
||||
// ECMA CLI XML Library Specification.
|
||||
// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
|
||||
// Created: Wed, 5 Sep 2001 06:35:19 UTC
|
||||
// Source file: all.xml
|
||||
// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
[System.Serializable]
|
||||
public enum GregorianCalendarTypes {
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
Localized = 1,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
USEnglish = 2,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
MiddleEastFrench = 9,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
Arabic = 10,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
TransliteratedEnglish = 11,
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
TransliteratedFrench = 12,
|
||||
} // GregorianCalendarTypes
|
||||
|
||||
} // System.Globalization
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// System.Globalization.NumberStyles.cs
|
||||
//
|
||||
// Copyright (C) 2001 Michael Lambert, All Rights Reserved
|
||||
//
|
||||
// Author: Michael Lambert, michaellambert@email.com
|
||||
// Created: Thu 07/18/2001
|
||||
//
|
||||
// Modified: 7/20/01, Derek Holden (dholden@draper.com)
|
||||
// Added ECMA values for allows and masks for data types
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
[Flags]
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public enum NumberStyles {
|
||||
None = 0x00000000,
|
||||
AllowLeadingWhite = 0x00000001,
|
||||
AllowTrailingWhite = 0x00000002,
|
||||
AllowLeadingSign = 0x00000004,
|
||||
AllowTrailingSign = 0x00000008,
|
||||
AllowParentheses = 0x00000010,
|
||||
AllowDecimalPoint = 0x00000020,
|
||||
AllowThousands = 0x00000040,
|
||||
AllowExponent = 0x00000080,
|
||||
AllowCurrencySymbol = 0x00000100,
|
||||
AllowHexSpecifier = 0x00000200,
|
||||
|
||||
Integer = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign ),
|
||||
HexNumber = ( AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier ),
|
||||
Number = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
|
||||
AllowTrailingSign | AllowDecimalPoint | AllowThousands ),
|
||||
Float = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
|
||||
AllowDecimalPoint | AllowExponent ),
|
||||
Currency = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
|
||||
AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
|
||||
AllowThousands | AllowCurrencySymbol ),
|
||||
Any = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
|
||||
AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
|
||||
AllowThousands | AllowExponent | AllowCurrencySymbol ),
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
@@ -42,11 +42,11 @@ namespace System.Globalization {
|
||||
public partial class RegionInfo {
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
extern static string monotouch_get_locale_country_code ();
|
||||
extern static string xamarin_get_locale_country_code ();
|
||||
|
||||
static RegionInfo CreateFromNSLocale ()
|
||||
{
|
||||
return new RegionInfo (monotouch_get_locale_country_code ());
|
||||
return new RegionInfo (xamarin_get_locale_country_code ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// SortVersion.cs
|
||||
//
|
||||
// Authors:
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class SortVersion : IEquatable<SortVersion>
|
||||
{
|
||||
public SortVersion (int fullVersion, Guid sortId)
|
||||
{
|
||||
FullVersion = fullVersion;
|
||||
SortId = sortId;
|
||||
}
|
||||
|
||||
public Guid SortId { get; private set; }
|
||||
|
||||
public int FullVersion { get; private set; }
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
return Equals (obj as SortVersion);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return FullVersion.GetHashCode ();
|
||||
}
|
||||
|
||||
public bool Equals (SortVersion other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return FullVersion == other.FullVersion && SortId == other.SortId;
|
||||
}
|
||||
|
||||
public static bool operator == (SortVersion left, SortVersion right)
|
||||
{
|
||||
if (left != null)
|
||||
return left.Equals (right);
|
||||
|
||||
return right == null || right.Equals (left);
|
||||
}
|
||||
|
||||
public static bool operator != (SortVersion left, SortVersion right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
//
|
||||
// System.Globalization.StringInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Dick Porter (dick@ximian.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc.
|
||||
// (C) 2004 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
[Serializable]
|
||||
[ComVisible(true)]
|
||||
public class StringInfo {
|
||||
|
||||
public StringInfo () : this (string.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
string s;
|
||||
int length;
|
||||
|
||||
public StringInfo (string value)
|
||||
{
|
||||
// Argument check in property
|
||||
String = value;
|
||||
}
|
||||
|
||||
[ComVisible (false)]
|
||||
public override bool Equals (object value)
|
||||
{
|
||||
StringInfo other = value as StringInfo;
|
||||
return other != null && s == other.s;
|
||||
}
|
||||
|
||||
[ComVisible (false)]
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return s.GetHashCode ();
|
||||
}
|
||||
|
||||
public int LengthInTextElements {
|
||||
get {
|
||||
if (length < 0) {
|
||||
length = 0;
|
||||
for (int idx = 0; idx < s.Length; length++)
|
||||
idx += GetNextTextElementLength (s, idx);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
public string String {
|
||||
get { return s; }
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
length = -1;
|
||||
s = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SubstringByTextElements (int startingTextElement)
|
||||
{
|
||||
if (startingTextElement < 0 || s.Length == 0)
|
||||
throw new ArgumentOutOfRangeException ("startingTextElement");
|
||||
int idx = 0;
|
||||
for (int i = 0; i < startingTextElement; i++) {
|
||||
if (idx >= s.Length)
|
||||
throw new ArgumentOutOfRangeException ("startingTextElement");
|
||||
idx += GetNextTextElementLength (s, idx);
|
||||
}
|
||||
return s.Substring (idx);
|
||||
}
|
||||
|
||||
public string SubstringByTextElements (int startingTextElement, int lengthInTextElements)
|
||||
{
|
||||
if (startingTextElement < 0 || s.Length == 0)
|
||||
throw new ArgumentOutOfRangeException ("startingTextElement");
|
||||
if (lengthInTextElements < 0)
|
||||
throw new ArgumentOutOfRangeException ("lengthInTextElements");
|
||||
int idx = 0;
|
||||
for (int i = 0; i < startingTextElement; i++) {
|
||||
if (idx >= s.Length)
|
||||
throw new ArgumentOutOfRangeException ("startingTextElement");
|
||||
idx += GetNextTextElementLength (s, idx);
|
||||
}
|
||||
int start = idx;
|
||||
for (int i = 0; i < lengthInTextElements; i++) {
|
||||
if (idx >= s.Length)
|
||||
throw new ArgumentOutOfRangeException ("lengthInTextElements");
|
||||
idx += GetNextTextElementLength (s, idx);
|
||||
}
|
||||
return s.Substring (start, idx - start);
|
||||
}
|
||||
|
||||
public static string GetNextTextElement(string str)
|
||||
{
|
||||
if(str == null || str.Length == 0) {
|
||||
throw new ArgumentNullException("string is null");
|
||||
}
|
||||
return(GetNextTextElement (str, 0));
|
||||
}
|
||||
|
||||
public static string GetNextTextElement(string str, int index)
|
||||
{
|
||||
int len = GetNextTextElementLength (str, index);
|
||||
return len != 1 ? str.Substring (index, len) : new string (str [index], 1);
|
||||
}
|
||||
|
||||
static int GetNextTextElementLength(string str, int index)
|
||||
{
|
||||
if(str == null) {
|
||||
throw new ArgumentNullException("string is null");
|
||||
}
|
||||
|
||||
if(index >= str.Length)
|
||||
return 0;
|
||||
if(index < 0)
|
||||
throw new ArgumentOutOfRangeException ("Index is not valid");
|
||||
|
||||
/* Find the next base character, surrogate
|
||||
* pair or combining character sequence
|
||||
*/
|
||||
|
||||
char ch = str[index];
|
||||
UnicodeCategory cat = char.GetUnicodeCategory (ch);
|
||||
|
||||
if (cat == UnicodeCategory.Surrogate) {
|
||||
/* Check that it's a high surrogate
|
||||
* followed by a low surrogate
|
||||
*/
|
||||
if (ch >= 0xD800 && ch <= 0xDBFF) {
|
||||
if ((index + 1) < str.Length &&
|
||||
str[index + 1] >= 0xDC00 &&
|
||||
str[index + 1] <= 0xDFFF) {
|
||||
/* A valid surrogate pair */
|
||||
return 2;
|
||||
} else {
|
||||
/* High surrogate on its own */
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* Low surrogate on its own */
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* Look for a base character, which
|
||||
* may or may not be followed by a
|
||||
* series of combining characters
|
||||
*/
|
||||
|
||||
if (cat == UnicodeCategory.NonSpacingMark ||
|
||||
cat == UnicodeCategory.SpacingCombiningMark ||
|
||||
cat == UnicodeCategory.EnclosingMark) {
|
||||
/* Not a base character */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int count = 1;
|
||||
|
||||
while (index + count < str.Length) {
|
||||
cat = char.GetUnicodeCategory (str[index + count]);
|
||||
if (cat != UnicodeCategory.NonSpacingMark &&
|
||||
cat != UnicodeCategory.SpacingCombiningMark &&
|
||||
cat != UnicodeCategory.EnclosingMark) {
|
||||
/* Finished the sequence */
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public static TextElementEnumerator GetTextElementEnumerator(string str)
|
||||
{
|
||||
if(str == null || str.Length == 0) {
|
||||
throw new ArgumentNullException("string is null");
|
||||
}
|
||||
return(new TextElementEnumerator (str, 0));
|
||||
}
|
||||
|
||||
public static TextElementEnumerator GetTextElementEnumerator(string str, int index)
|
||||
{
|
||||
if(str == null) {
|
||||
throw new ArgumentNullException("string is null");
|
||||
}
|
||||
|
||||
if(index < 0 || index >= str.Length) {
|
||||
throw new ArgumentOutOfRangeException ("Index is not valid");
|
||||
}
|
||||
|
||||
return(new TextElementEnumerator (str, index));
|
||||
}
|
||||
|
||||
public static int[] ParseCombiningCharacters(string str)
|
||||
{
|
||||
if(str == null) {
|
||||
throw new ArgumentNullException("string is null");
|
||||
}
|
||||
|
||||
ArrayList indices = new ArrayList (str.Length);
|
||||
TextElementEnumerator tee = GetTextElementEnumerator (str);
|
||||
|
||||
tee.Reset ();
|
||||
while(tee.MoveNext ()) {
|
||||
indices.Add (tee.ElementIndex);
|
||||
}
|
||||
|
||||
return((int[])indices.ToArray (typeof (int)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
//
|
||||
// System.Globalization.TextElementEnumerator.cs
|
||||
//
|
||||
// Author:
|
||||
// Dick Porter (dick@ximian.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc.
|
||||
// (C) 2004 Novell, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible (true)]
|
||||
public class TextElementEnumerator: IEnumerator {
|
||||
private int index;
|
||||
private int elementindex;
|
||||
private int startpos;
|
||||
private string str;
|
||||
private string element;
|
||||
|
||||
/* Hide the .ctor() */
|
||||
internal TextElementEnumerator(string str, int startpos) {
|
||||
this.index = -1;
|
||||
this.startpos = startpos;
|
||||
this.str = str.Substring (startpos);
|
||||
this.element = null;
|
||||
}
|
||||
|
||||
public object Current
|
||||
{
|
||||
get {
|
||||
if (element == null) {
|
||||
throw new InvalidOperationException ();
|
||||
}
|
||||
|
||||
return(element);
|
||||
}
|
||||
}
|
||||
|
||||
public int ElementIndex
|
||||
{
|
||||
get {
|
||||
if (element == null) {
|
||||
throw new InvalidOperationException ();
|
||||
}
|
||||
|
||||
return(elementindex + startpos);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetTextElement()
|
||||
{
|
||||
if (element == null) {
|
||||
throw new InvalidOperationException ();
|
||||
}
|
||||
|
||||
return(element);
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
elementindex = index + 1;
|
||||
|
||||
if (elementindex < str.Length) {
|
||||
element = StringInfo.GetNextTextElement (str, elementindex);
|
||||
index += element.Length;
|
||||
|
||||
return(true);
|
||||
} else {
|
||||
element = null;
|
||||
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
element = null;
|
||||
index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
//
|
||||
// System.Globalization.UnicodeCategory.cs
|
||||
//
|
||||
// Author:
|
||||
// Joe Shaw (joe@ximian.com)
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
[System.Serializable]
|
||||
public enum UnicodeCategory {
|
||||
UppercaseLetter = 0,
|
||||
LowercaseLetter = 1,
|
||||
TitlecaseLetter = 2,
|
||||
ModifierLetter = 3,
|
||||
OtherLetter = 4,
|
||||
NonSpacingMark = 5,
|
||||
SpacingCombiningMark = 6,
|
||||
EnclosingMark = 7,
|
||||
DecimalDigitNumber = 8,
|
||||
LetterNumber = 9,
|
||||
OtherNumber = 10,
|
||||
SpaceSeparator = 11,
|
||||
LineSeparator = 12,
|
||||
ParagraphSeparator = 13,
|
||||
Control = 14,
|
||||
Format = 15,
|
||||
Surrogate = 16,
|
||||
PrivateUse = 17,
|
||||
ConnectorPunctuation = 18,
|
||||
DashPunctuation = 19,
|
||||
OpenPunctuation = 20,
|
||||
ClosePunctuation = 21,
|
||||
InitialQuotePunctuation = 22,
|
||||
FinalQuotePunctuation = 23,
|
||||
OtherPunctuation = 24,
|
||||
MathSymbol = 25,
|
||||
CurrencySymbol = 26,
|
||||
ModifierSymbol = 27,
|
||||
OtherSymbol = 28,
|
||||
OtherNotAssigned = 29,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user