<FeatureMergeCultureSupportAndEngine>true</FeatureMergeCultureSupportAndEngine>
<FeatureMergeJitAndEngine>true</FeatureMergeJitAndEngine>
<FeatureMulticoreJIT>true</FeatureMulticoreJIT>
- <FeatureNormIdnaOnly>true</FeatureNormIdnaOnly>
<FeaturePrejit>true</FeaturePrejit>
<FeatureStandaloneSn>true</FeatureStandaloneSn>
<FeatureStrongnameDelaySigningAllowed>true</FeatureStrongnameDelaySigningAllowed>
// Definitions.
//
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
// Normalization
static HMODULE m_hNormalization;
static PFN_NORMALIZATION_IS_NORMALIZED_STRING m_pfnNormalizationIsNormalizedStringFunc;
return (lcid == LOCALE_CUSTOM_DEFAULT || lcid == LOCALE_CUSTOM_UNSPECIFIED);
}
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
//
// Normalization Implementation
//
PFN_NORMALIZATION_IS_NORMALIZED_STRING COMNlsInfo::m_pfnNormalizationIsNormalizedStringFunc = NULL;
PFN_NORMALIZATION_NORMALIZE_STRING COMNlsInfo::m_pfnNormalizationNormalizeStringFunc = NULL;
PFN_NORMALIZATION_INIT_NORMALIZATION COMNlsInfo::m_pfnNormalizationInitNormalizationFunc = NULL;
-#endif
+#endif // FEATURE_COREFX_GLOBALIZATION
#if FEATURE_CODEPAGES_FILE
/*============================nativeCreateOpenFileMapping============================
FCIMPLEND
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
//
// Normalization
//
if (!hNormalization)
ThrowLastError();
}
+#ifndef FEATURE_CORECLR
+ // in coreclr we should always find the normalization in kernel32 as it supports Win7 and up
else
{
HRESULT hr = g_pCLRRuntime->LoadLibrary(NORMALIZATION_DLL, &hNormalization);
if (FAILED(hr))
ThrowHR(hr);
}
+#endif // FEATURE_CORECLR
_ASSERTE(hNormalization != NULL);
m_hNormalization = hNormalization;
END_QCALL;
}
-#endif // FEATURE_CORECLR
+#endif // FEATURE_COREFX_GLOBALIZATION
//
<Member Name="Insert(System.Int32,System.String)" />
<Member Name="Intern(System.String)" />
<Member Name="IsInterned(System.String)" />
-<!--
<Member Name="IsNormalized" />
<Member Name="IsNormalized(System.Text.NormalizationForm)" />
--->
<Member Name="IsNullOrEmpty(System.String)" />
<Member Name="IsNullOrWhiteSpace(System.String)" />
<Member Name="Join(System.String,System.Object[])" />
<Member Name="LastIndexOfAny(System.Char[])" />
<Member Name="LastIndexOfAny(System.Char[],System.Int32)" />
<Member Name="LastIndexOfAny(System.Char[],System.Int32,System.Int32)" />
-<!--
<Member Name="Normalize" />
<Member Name="Normalize(System.Text.NormalizationForm)" />
--->
<Member Name="op_Equality(System.String,System.String)" />
<Member Name="op_Inequality(System.String,System.String)" />
<Member Name="PadLeft(System.Int32)" />
<Member Name="GetHashCode" />
<Member MemberType="Property" Name="MaxCharCount" />
</Type>
+ <Type Name="System.Text.EncoderExceptionFallbackBuffer">
+ <Member Name="#ctor" />
+ <Member Name="Fallback(System.Char,System.Char,System.Int32)" />
+ <Member Name="Fallback(System.Char,System.Int32)" />
+ <Member Name="get_Remaining" />
+ <Member Name="GetNextChar" />
+ <Member Name="MovePrevious" />
+ <Member MemberType="Property" Name="Remaining" />
+ </Type>
<Type Name="System.Text.EncoderFallbackException">
<Member Name="#ctor" />
<Member Name="#ctor(System.String)" />
<Member Name="GetPreamble" />
<Member Name="GetString(System.Byte[])" />
<Member Name="GetString(System.Byte[],System.Int32,System.Int32)" />
-<!--
<Member Name="IsAlwaysNormalized" />
<Member Name="IsAlwaysNormalized(System.Text.NormalizationForm)" />
- -->
<Member Status="ImplRoot" Name="OnDeserialized(System.Runtime.Serialization.StreamingContext)" />
<Member Status="ImplRoot" Name="OnDeserializing(System.Runtime.Serialization.StreamingContext)" />
<Member Status="ImplRoot" Name="OnSerializing(System.Runtime.Serialization.StreamingContext)" />
<Member MemberType="Property" Name="UTF8" />
<Member MemberType="Property" Name="WebName" />
</Type>
+ <Type Name="System.Text.EncodingInfo">
+ <Member Name="Equals(System.Object)" />
+ <Member Name="get_CodePage" />
+ <Member Name="get_DisplayName" />
+ <Member Name="get_Name" />
+ <Member Name="GetEncoding" />
+ <Member Name="GetHashCode" />
+ <Member MemberType="Property" Name="CodePage" />
+ <Member MemberType="Property" Name="DisplayName" />
+ <Member MemberType="Property" Name="Name" />
+ </Type>
+ <Type Name="System.Text.NormalizationForm">
+ <Member MemberType="Field" Name="FormC" />
+ <Member MemberType="Field" Name="FormD" />
+ <Member MemberType="Field" Name="FormKC" />
+ <Member MemberType="Field" Name="FormKD" />
+ <Member MemberType="Field" Name="value__" />
+ </Type>
<Type Name="System.Text.StringBuilder">
<Member Name="#ctor" />
<Member Name="#ctor(System.Int32)" />
<Member Status="ImplRoot" Name="ReplaceBufferAnsiInternal(System.SByte*,System.Int32)" /> <!-- EE - il stubs -->
</Type>
<Type Name="System.Text.UnicodeEncoding">
+ <Member MemberType="Field" Name="CharSize" />
<Member Name="#ctor" />
<Member Name="#ctor(System.Boolean,System.Boolean)" />
<Member Name="#ctor(System.Boolean,System.Boolean,System.Boolean)" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\DaylightTime.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureCoreFxGlobalization)' != 'true'">
- <GlobalizationSources Condition="'$(FeatureCoreClr)'=='true'" Include="$(BclSourcesRoot)\System\Globalization\STUBS.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\BidiCategory.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\Calendar.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\CalendarData.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\KoreanCalendar.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\RegionInfo.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\SortKey.cs" />
+ <GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\SortVersion.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\StringInfo.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\TaiwanCalendar.cs" />
<GlobalizationSources Include="$(BclSourcesRoot)\System\Globalization\TextElementEnumerator.cs" />
public static System.String Intern(System.String str) { throw null; }
[System.Security.SecuritySafeCriticalAttribute]
public static System.String IsInterned(System.String str) { throw null; }
+ public bool IsNormalized() { throw null; }
+ [System.Security.SecuritySafeCriticalAttribute]
+ public bool IsNormalized(System.Text.NormalizationForm normalizationForm) { throw null; }
public static bool IsNullOrEmpty(System.String value) { throw null; }
public static bool IsNullOrWhiteSpace(System.String value) { throw null; }
[System.Runtime.InteropServices.ComVisibleAttribute(false)]
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
[System.Security.SecuritySafeCriticalAttribute]
public int LastIndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
+ public System.String Normalize() { throw null; }
+ [System.Security.SecuritySafeCriticalAttribute]
+ public System.String Normalize(System.Text.NormalizationForm normalizationForm) { throw null; }
public static bool operator ==(System.String a, System.String b) { throw null; }
public static bool operator !=(System.String a, System.String b) { throw null; }
public System.String PadLeft(int totalWidth) { throw null; }
public override bool Equals(object value) { throw null; }
public override int GetHashCode() { throw null; }
}
+ public sealed partial class EncoderExceptionFallbackBuffer : System.Text.EncoderFallbackBuffer
+ {
+ public EncoderExceptionFallbackBuffer() { }
+ public override int Remaining { get { throw null; } }
+ public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
+ public override bool Fallback(char charUnknown, int index) { throw null; }
+ public override char GetNextChar() { throw null; }
+ public override bool MovePrevious() { throw null; }
+ }
public abstract partial class EncoderFallback
{
protected EncoderFallback() { }
public unsafe string GetString(byte* bytes, int byteCount) { throw null; }
public virtual string GetString(byte[] bytes) { throw null; }
public virtual string GetString(byte[] bytes, int index, int count) { throw null; }
+ [System.Runtime.InteropServices.ComVisibleAttribute(false)]
+ public bool IsAlwaysNormalized() { throw null; }
+ [System.Runtime.InteropServices.ComVisibleAttribute(false)]
+ public virtual bool IsAlwaysNormalized(System.Text.NormalizationForm form) { throw null; }
public static void RegisterProvider(System.Text.EncodingProvider provider) { }
}
public sealed partial class EncodingInfo
{
internal EncodingInfo() { }
+ public int CodePage { get { throw null; } }
+ public string DisplayName { get { throw null; } }
+ public string Name { get { throw null; } }
public override bool Equals(object value) { throw null; }
+ public System.Text.Encoding GetEncoding() { throw null; }
public override int GetHashCode() { throw null; }
}
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public virtual System.Text.Encoding GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
}
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
+ public enum NormalizationForm
+ {
+ FormC = 1,
+ FormD = 2,
+ FormKC = 5,
+ FormKD = 6,
+ }
+ [System.Runtime.InteropServices.ComVisibleAttribute(true)]
public sealed partial class StringBuilder
{
public StringBuilder() { }
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public partial class UnicodeEncoding : System.Text.Encoding
{
+ public const int CharSize = 2;
public UnicodeEncoding() { }
public UnicodeEncoding(bool bigEndian, bool byteOrderMark) { }
public UnicodeEncoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { }
// if we can't find a bigger name. That doesn't help with things like "zh" though, so
// the approach is of questionable value
//
-#if !FEATURE_CORECLR
public static CultureInfo CreateSpecificCulture(String name) {
Contract.Ensures(Contract.Result<CultureInfo>() != null);
return (new CultureInfo(culture.m_cultureData.SSPECIFICCULTURE));
}
-#endif // !FEATURE_CORECLR
internal static bool VerifyCultureName(String cultureName, bool throwException)
{
}
#endif
-#if !FEATURE_CORECLR
public static CultureInfo[] GetCultures(CultureTypes types) {
Contract.Ensures(Contract.Result<CultureInfo[]>() != null);
// internally we treat UserCustomCultures as Supplementals but v2
}
return (CultureData.GetCultures(types));
}
-#endif
////////////////////////////////////////////////////////////////////////
//
}
}
-#if !FEATURE_CORECLR
// ie: eng
public virtual String ThreeLetterISOLanguageName {
[System.Security.SecuritySafeCritical] // auto-generated
return (this.m_cultureData.SABBREVLANGNAME);
}
}
-#endif
////////////////////////////////////////////////////////////////////////
//
}
-#if !FEATURE_CORECLR
// This function is deprecated, we don't like it
public static CultureInfo GetCultureInfoByIetfLanguageTag(string name)
{
return ci;
}
-#endif
+
private static volatile bool s_isTaiwanSku;
private static volatile bool s_haveIsTaiwanSku;
internal static bool IsTaiwanSku
public partial class CultureNotFoundException : ArgumentException, ISerializable
{
private string m_invalidCultureName; // unrecognized culture name
-#if !FEATURE_CORECLR
private Nullable<int> m_invalidCultureId; // unrecognized culture Lcid
-#endif //!FEATURE_CORECLR
public CultureNotFoundException()
: base(DefaultMessage)
: base(message, innerException)
{
}
-#if !FEATURE_CORECLR
+
public CultureNotFoundException(String paramName, int invalidCultureId, String message)
: base(message, paramName)
{
{
m_invalidCultureId = invalidCultureId;
}
-#endif //!FEATURE_CORECLR
public CultureNotFoundException(String paramName, string invalidCultureName, String message)
: base(message, paramName)
}
protected CultureNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) {
-#if !FEATURE_CORECLR
m_invalidCultureId = (Nullable<int>) info.GetValue("InvalidCultureId", typeof(Nullable<int>));
-#endif //!FEATURE_CORECLR
m_invalidCultureName = (string) info.GetValue("InvalidCultureName", typeof(string));
}
Contract.EndContractBlock();
base.GetObjectData(info, context);
Nullable<int> invalidCultureId = null;
-#if !FEATURE_CORECLR
invalidCultureId = m_invalidCultureId;
-#endif //!FEATURE_CORECLR
info.AddValue("InvalidCultureId", invalidCultureId, typeof(Nullable<int>));
info.AddValue("InvalidCultureName", m_invalidCultureName, typeof(string));
}
-#if !FEATURE_CORECLR
public virtual Nullable<int> InvalidCultureId
{
get { return m_invalidCultureId; }
}
-#endif //!FEATURE_CORECLR
public virtual string InvalidCultureName
{
{
get
{
-#if !FEATURE_CORECLR
if (InvalidCultureId != null)
{
return String.Format(CultureInfo.InvariantCulture,
"{0} (0x{0:x4})", (int)InvalidCultureId);
}
-#endif //!FEATURE_CORECLR
return InvalidCultureName;
}
}
{
String s = base.Message;
if (
-#if !FEATURE_CORECLR
m_invalidCultureId != null ||
-#endif //!FEATURE_CORECLR
m_invalidCultureName != null)
{
String valueMessage = Environment.GetResourceString("Argument_CultureInvalidIdentifier", FormatedInvalidCultureId);
#endif
private void InitializeOverridableProperties(CultureData cultureData, int calendarID)
{
-#if !FEATURE_CORECLR
// Silverlight 2.0 never took a snapshot of the user's overridable properties
// This has a substantial performance impact so skip when CoreCLR
Contract.Requires(cultureData != null);
this.allYearMonthPatterns = cultureData.YearMonths(calendarID);
Contract.Assert(this.allYearMonthPatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some year month patterns");
-#endif
}
#region Serialization
private int CultureID;
[OptionalField(VersionAdded = 1)]
private bool m_useUserOverride;
-#if !FEATURE_CORECLR
[OptionalField(VersionAdded = 1)]
private bool bUseCalendarInfo;
[OptionalField(VersionAdded = 1)]
internal bool m_isDefaultCalendar; // NEVER USED, DO NOT USE THIS! (Serialized in Whidbey)
[OptionalField(VersionAdded = 2)]
private static volatile Hashtable s_calendarNativeNames; // NEVER USED, DO NOT USE THIS! (Serialized in Whidbey)
-#endif // !FEATURE_CORECLR
// This was synthesized by Whidbey so we knew what words might appear in the middle of a date string
// Now we always synthesize so its not helpful
return (this.dateSeparator);
}
-#if FEATURE_CORECLR
- set { throw new NotImplementedException(); }
-#endif
-
-#if !FEATURE_CORECLR
- set {
+ set
+ {
if (IsReadOnly)
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
- if (value == null) {
+ if (value == null)
+ {
throw new ArgumentNullException("value",
Environment.GetResourceString("ArgumentNull_String"));
}
ClearTokenHashTable();
this.dateSeparator = value;
}
-#endif
}
return (timeSeparator);
}
-#if FEATURE_CORECLR
- set { throw new NotImplementedException(); }
-#endif
-
-#if !FEATURE_CORECLR
- set {
+ set
+ {
if (IsReadOnly)
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
- if (value == null) {
+ if (value == null)
+ {
throw new ArgumentNullException("value",
Environment.GetResourceString("ArgumentNull_String"));
}
timeSeparator = value;
}
-#endif
}
}
-#if !FEATURE_CORECLR
////////////////////////////////////////////////////////////////////////
//
// ThreeLetterISORegionName
return (this.m_cultureData.SABBREVCTRYNAME);
}
}
-#endif
////////////////////////////////////////////////////////////////////////
//
+++ /dev/null
-namespace System.Globalization
-{
- public partial class CultureInfo : System.ICloneable, System.IFormatProvider
- {
- public virtual string ThreeLetterISOLanguageName { get { throw new NotImplementedException(); } }
- public virtual string ThreeLetterWindowsLanguageName { get { throw new NotImplementedException(); } }
- public static System.Globalization.CultureInfo CreateSpecificCulture(string name) { throw new NotImplementedException(); }
- public static System.Globalization.CultureInfo GetCultureInfoByIetfLanguageTag(string name) { throw new NotImplementedException(); }
- public static System.Globalization.CultureInfo[] GetCultures(System.Globalization.CultureTypes types) { throw new NotImplementedException(); }
- }
-
- public partial class CultureNotFoundException : System.ArgumentException, System.Runtime.Serialization.ISerializable
- {
- public CultureNotFoundException(string message, int invalidCultureId, System.Exception innerException) { throw new NotImplementedException(); }
- public CultureNotFoundException(string paramName, int invalidCultureId, string message) { throw new NotImplementedException(); }
- public virtual System.Nullable<int> InvalidCultureId { get { throw new NotImplementedException(); } }
- }
-
- /*public partial class DateTimeFormatInfo
- {
- Can't do partials here so implement the stub in the main class
- public String DateSeparator { set { throw null; } }
- public String TimeSeparator { set { throw null; } }
- }*/
-
- public partial class RegionInfo
- {
- public virtual string ThreeLetterISORegionName { get { throw new NotImplementedException(); } }
- public virtual string ThreeLetterWindowsRegionName { get { throw new NotImplementedException(); } }
- }
-
- public partial class SortKey
- {
- internal SortKey() { throw new NotImplementedException(); }
- }
-
- public sealed partial class SortVersion : System.IEquatable<System.Globalization.SortVersion>
- {
- public SortVersion(int fullVersion, System.Guid sortId) { throw new NotImplementedException(); }
- public int FullVersion { get { throw new NotImplementedException(); } }
- public System.Guid SortId { get { throw new NotImplementedException(); } }
- public bool Equals(System.Globalization.SortVersion other) { throw new NotImplementedException(); }
- public override bool Equals(object obj) { throw new NotImplementedException(); }
- public override int GetHashCode() { throw new NotImplementedException(); }
- public static bool operator ==(System.Globalization.SortVersion left, System.Globalization.SortVersion right) { throw new NotImplementedException(); }
- public static bool operator !=(System.Globalization.SortVersion left, System.Globalization.SortVersion right) { throw new NotImplementedException(); }
- }
-
- public partial class TextInfo : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback
- {
- public virtual int ANSICodePage { get { throw new NotImplementedException(); } }
- public virtual int EBCDICCodePage { get { throw new NotImplementedException(); } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int MacCodePage { get { throw new NotImplementedException(); } }
- public virtual int OEMCodePage { get { throw new NotImplementedException(); } }
- public string ToTitleCase(string str) { throw new NotImplementedException(); }
- }
-}
\ No newline at end of file
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Globalization
+{
+ using System;
+ using System.Diagnostics.Contracts;
+
+ [Serializable]
+ public sealed class SortVersion : IEquatable<SortVersion>
+ {
+ private int m_NlsVersion;
+ private Guid m_SortId;
+
+ public int FullVersion
+ {
+ get
+ {
+ return m_NlsVersion;
+ }
+ }
+
+ public Guid SortId
+ {
+ get
+ {
+ return m_SortId;
+ }
+ }
+
+ public SortVersion(int fullVersion, Guid sortId)
+ {
+ m_SortId = sortId;
+ m_NlsVersion = fullVersion;
+ }
+
+ internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion)
+ {
+ m_NlsVersion = nlsVersion;
+
+ if (customVersion == Guid.Empty)
+ {
+ byte[] b = BitConverter.GetBytes(effectiveId);
+ byte b1 = (byte) ((uint) effectiveId >> 24);
+ byte b2 = (byte) ((effectiveId & 0x00FF0000) >> 16);
+ byte b3 = (byte) ((effectiveId & 0x0000FF00) >> 8);
+ byte b4 = (byte) (effectiveId & 0xFF);
+ customVersion = new Guid(0,0,0,0,0,0,0,b1,b2,b3,b4);
+ }
+
+ m_SortId = customVersion;
+ }
+
+ public override bool Equals(object obj)
+ {
+ SortVersion n = obj as SortVersion;
+ if(n != null)
+ {
+ return this.Equals(n);
+ }
+
+ return false;
+ }
+
+ public bool Equals(SortVersion other)
+ {
+ if (other == null)
+ {
+ return false;
+ }
+
+ return m_NlsVersion == other.m_NlsVersion && m_SortId == other.m_SortId;
+ }
+
+ public override int GetHashCode()
+ {
+ return m_NlsVersion * 7 | m_SortId.GetHashCode();
+ }
+
+ public static bool operator ==(SortVersion left, SortVersion right)
+ {
+ if (((object) left) != null)
+ {
+ return left.Equals(right);
+ }
+
+ if (((object) right) != null)
+ {
+ return right.Equals(left);
+ }
+
+ // Both null.
+ return true;
+ }
+
+ public static bool operator !=(SortVersion left, SortVersion right)
+ {
+ return !(left == right);
+ }
+ }
+}
\ No newline at end of file
////////////////////////////////////////////////////////////////////////
-#if !FEATURE_CORECLR
- public virtual int ANSICodePage {
- get {
+ public virtual int ANSICodePage
+ {
+ get
+ {
return (this.m_cultureData.IDEFAULTANSICODEPAGE);
}
}
- public virtual int OEMCodePage {
- get {
+ public virtual int OEMCodePage
+ {
+ get
+ {
return (this.m_cultureData.IDEFAULTOEMCODEPAGE);
}
}
- public virtual int MacCodePage {
- get {
+ public virtual int MacCodePage
+ {
+ get
+ {
return (this.m_cultureData.IDEFAULTMACCODEPAGE);
}
}
- public virtual int EBCDICCodePage {
- get {
+ public virtual int EBCDICCodePage
+ {
+ get
+ {
return (this.m_cultureData.IDEFAULTEBCDICCODEPAGE);
}
}
-#endif
-
////////////////////////////////////////////////////////////////////////
//
// titlecasing. Windows 7 is expected to be the first release with this feature. On the Macintosh side,
// titlecasing is not available as of version 10.5 of the operating system.
//
-#if !FEATURE_CORECLR
- public unsafe String ToTitleCase(String str) {
- if (str==null) {
+ public unsafe String ToTitleCase(String str)
+ {
+ if (str == null)
+ {
throw new ArgumentNullException("str");
}
Contract.EndContractBlock();
- if (str.Length == 0) {
+ if (str.Length == 0)
+ {
return (str);
}
StringBuilder result = new StringBuilder();
String lowercaseData = null;
- for (int i = 0; i < str.Length; i++) {
+ for (int i = 0; i < str.Length; i++)
+ {
UnicodeCategory charType;
int charLen;
charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
- if (Char.CheckLetter(charType)) {
+ if (Char.CheckLetter(charType))
+ {
// Do the titlecasing for the first character of the word.
i = AddTitlecaseLetter(ref result, ref str, i, charLen) + 1;
//
bool hasLowerCase = (charType == UnicodeCategory.LowercaseLetter);
// Use a loop to find all of the other letters following this letter.
- while (i < str.Length) {
+ while (i < str.Length)
+ {
charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
- if (IsLetterCategory(charType)) {
- if (charType == UnicodeCategory.LowercaseLetter) {
+ if (IsLetterCategory(charType))
+ {
+ if (charType == UnicodeCategory.LowercaseLetter)
+ {
hasLowerCase = true;
}
i += charLen;
- } else if (str[i] == '\'') {
+ }
+ else if (str[i] == '\'')
+ {
i++;
- if (hasLowerCase) {
- if (lowercaseData==null) {
+ if (hasLowerCase)
+ {
+ if (lowercaseData == null)
+ {
lowercaseData = this.ToLower(str);
}
result.Append(lowercaseData, lowercaseStart, i - lowercaseStart);
- } else {
+ }
+ else
+ {
result.Append(str, lowercaseStart, i - lowercaseStart);
}
lowercaseStart = i;
hasLowerCase = true;
- } else if (!IsWordSeparator(charType)) {
+ }
+ else if (!IsWordSeparator(charType))
+ {
// This category is considered to be part of the word.
// This is any category that is marked as false in wordSeprator array.
i+= charLen;
- } else {
+ }
+ else
+ {
// A word separator. Break out of the loop.
break;
}
int count = i - lowercaseStart;
- if (count>0) {
- if (hasLowerCase) {
- if (lowercaseData==null) {
+ if (count>0)
+ {
+ if (hasLowerCase)
+ {
+ if (lowercaseData == null)
+ {
lowercaseData = this.ToLower(str);
}
result.Append(lowercaseData, lowercaseStart, count);
- } else {
+ }
+ else
+ {
result.Append(str, lowercaseStart, count);
}
}
- if (i < str.Length) {
+ if (i < str.Length)
+ {
// not a letter, just append it
i = AddNonLetter(ref result, ref str, i, charLen);
}
}
- else {
+ else
+ {
// not a letter, just append it
i = AddNonLetter(ref result, ref str, i, charLen);
}
return (result.ToString());
}
- private static int AddNonLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen) {
+ private static int AddNonLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen)
+ {
Contract.Assert(charLen == 1 || charLen == 2, "[TextInfo.AddNonLetter] CharUnicodeInfo.InternalGetUnicodeCategory returned an unexpected charLen!");
- if (charLen == 2) {
+ if (charLen == 2)
+ {
// Surrogate pair
result.Append(input[inputIndex++]);
result.Append(input[inputIndex]);
}
- else {
+ else
+ {
result.Append(input[inputIndex]);
}
return inputIndex;
}
- private int AddTitlecaseLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen) {
+ private int AddTitlecaseLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen)
+ {
Contract.Assert(charLen == 1 || charLen == 2, "[TextInfo.AddTitlecaseLetter] CharUnicodeInfo.InternalGetUnicodeCategory returned an unexpected charLen!");
// for surrogate pairs do a simple ToUpper operation on the substring
- if (charLen == 2) {
+ if (charLen == 2)
+ {
// Surrogate pair
result.Append( this.ToUpper(input.Substring(inputIndex, charLen)) );
inputIndex++;
}
- else {
- switch (input[inputIndex]) {
+ else
+ {
+ switch (input[inputIndex])
+ {
//
// For AppCompat, the Titlecase Case Mapping data from NDP 2.0 is used below.
case (char)0x01C4: // DZ with Caron -> Dz with Caron
/* true */ (1 << 28) | // OtherSymbol = 28,
/* false */ (0 << 29); // OtherNotAssigned = 29;
- private static bool IsWordSeparator(UnicodeCategory category) {
+ private static bool IsWordSeparator(UnicodeCategory category)
+ {
return (wordSeparatorMask & (1 << (int)category)) != 0;
}
- private static bool IsLetterCategory(UnicodeCategory uc) {
+ private static bool IsLetterCategory(UnicodeCategory uc)
+ {
return (uc == UnicodeCategory.UppercaseLetter
|| uc == UnicodeCategory.LowercaseLetter
|| uc == UnicodeCategory.TitlecaseLetter
|| uc == UnicodeCategory.ModifierLetter
|| uc == UnicodeCategory.OtherLetter);
}
-#endif
-
// IsRightToLeft
//
return new String(cBuffer, 0, iLength);
}
-#if !FEATURE_CORECLR
+#if !FEATURE_COREFX_GLOBALIZATION
[System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe private static extern int nativeNormalizationNormalizeString(
FCFuncElement("StructureToPtrNative", SafeBuffer::StructureToPtr)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
FCFuncStart(gNormalizationFuncs)
FCFuncElement("nativeNormalizationIsNormalizedString", COMNlsInfo::nativeNormalizationIsNormalizedString)
FCFuncElement("nativeNormalizationNormalizeString", COMNlsInfo::nativeNormalizationNormalizeString)
QCFuncElement("nativeNormalizationInitNormalization", COMNlsInfo::nativeNormalizationInitNormalization)
FCFuncEnd()
-#endif // FEATURE_CORECLR
+#endif // FEATURE_COREFX_GLOBALIZATION
FCFuncStart(gTypedReferenceFuncs)
FCFuncElement("InternalToObject", ReflectionInvocation::TypedReferenceToObject)
FCClassElement("ModuleBuilder", "System.Reflection.Emit", gCOMModuleBuilderFuncs)
FCClassElement("ModuleHandle", "System", gCOMModuleHandleFuncs)
FCClassElement("Monitor", "System.Threading", gMonitorFuncs)
-#ifndef FEATURE_CORECLR
+#ifndef FEATURE_COREFX_GLOBALIZATION
FCClassElement("Normalization", "System.Text", gNormalizationFuncs)
-#endif // FEATURE_CORECLR
+#endif // FEATURE_COREFX_GLOBALIZATION
FCClassElement("Number", "System", gNumberFuncs)
#ifdef FEATURE_COMINTEROP
FCClassElement("OAVariantLib", "Microsoft.Win32", gOAVariantFuncs)