summaryrefslogtreecommitdiff
path: root/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
commitdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch)
treee5435159cd1bf0519276363a6fe1663d1721bed3 /src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
parent4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff)
downloadcoreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs')
-rw-r--r--src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs78
1 files changed, 49 insertions, 29 deletions
diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
index 744a48b107..4ebaf9cb10 100644
--- a/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
+++ b/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System.Globalization
@@ -53,24 +54,24 @@ namespace System.Globalization
internal static int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
{
- Contract.Assert(source != null);
- Contract.Assert(value != null);
+ Debug.Assert(source != null);
+ Debug.Assert(value != null);
return FindStringOrdinal(FIND_FROMSTART, source, startIndex, count, value, value.Length, ignoreCase);
}
internal static int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
{
- Contract.Assert(source != null);
- Contract.Assert(value != null);
+ Debug.Assert(source != null);
+ Debug.Assert(value != null);
return FindStringOrdinal(FIND_FROMEND, source, startIndex - count + 1, count, value, value.Length, ignoreCase);
}
private unsafe int GetHashCodeOfStringCore(string source, CompareOptions options)
{
- Contract.Assert(source != null);
- Contract.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
+ Debug.Assert(source != null);
+ Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
if (source.Length == 0)
{
@@ -102,9 +103,9 @@ namespace System.Globalization
private unsafe int CompareString(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
{
- Contract.Assert(string1 != null);
- Contract.Assert(string2 != null);
- Contract.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
+ Debug.Assert(string1 != null);
+ Debug.Assert(string2 != null);
+ Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
string localeName = _sortHandle != IntPtr.Zero ? null : _sortName;
@@ -167,9 +168,9 @@ namespace System.Globalization
private int IndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
{
- Contract.Assert(!string.IsNullOrEmpty(source));
- Contract.Assert(target != null);
- Contract.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
+ Debug.Assert(!string.IsNullOrEmpty(source));
+ Debug.Assert(target != null);
+ Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
// TODO: Consider moving this up to the relevent APIs we need to ensure this behavior for
// and add a precondition that target is not empty.
@@ -200,9 +201,9 @@ namespace System.Globalization
private int LastIndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
{
- Contract.Assert(!string.IsNullOrEmpty(source));
- Contract.Assert(target != null);
- Contract.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
+ Debug.Assert(!string.IsNullOrEmpty(source));
+ Debug.Assert(target != null);
+ Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
// TODO: Consider moving this up to the relevent APIs we need to ensure this behavior for
// and add a precondition that target is not empty.
@@ -234,9 +235,9 @@ namespace System.Globalization
private bool StartsWith(string source, string prefix, CompareOptions options)
{
- Contract.Assert(!string.IsNullOrEmpty(source));
- Contract.Assert(!string.IsNullOrEmpty(prefix));
- Contract.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
+ Debug.Assert(!string.IsNullOrEmpty(source));
+ Debug.Assert(!string.IsNullOrEmpty(prefix));
+ Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
return FindString(FIND_STARTSWITH | (uint)GetNativeCompareFlags(options),
source,
@@ -249,9 +250,9 @@ namespace System.Globalization
private bool EndsWith(string source, string suffix, CompareOptions options)
{
- Contract.Assert(!string.IsNullOrEmpty(source));
- Contract.Assert(!string.IsNullOrEmpty(suffix));
- Contract.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
+ Debug.Assert(!string.IsNullOrEmpty(source));
+ Debug.Assert(!string.IsNullOrEmpty(suffix));
+ Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
return FindString(FIND_ENDSWITH | (uint)GetNativeCompareFlags(options),
source,
@@ -280,14 +281,10 @@ namespace System.Globalization
int sourceStartIndex = findLastIndex ? startIndex - sourceCount + 1 : startIndex;
-#if !TEST_CODEGEN_OPTIMIZATION
fixed (char* pSource = source, spTarget = target)
{
char* spSubSource = pSource + sourceStartIndex;
-#else
- String.StringPointer spSubSource = source.GetStringPointer(sourceStartIndex);
- String.StringPointer spTarget = target.GetStringPointer();
-#endif
+
if (findLastIndex)
{
int startPattern = (sourceCount - 1) - targetCount + 1;
@@ -347,11 +344,29 @@ namespace System.Globalization
retValue += startIndex;
}
}
-#if !TEST_CODEGEN_OPTIMIZATION
}
return retValue;
-#endif // TEST_CODEGEN_OPTIMIZATION
+ }
+
+ private unsafe SortKey CreateSortKey(String source, CompareOptions options)
+ {
+ if (source==null) { throw new ArgumentNullException(nameof(source)); }
+ Contract.EndContractBlock();
+
+ if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
+ {
+ throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
+ }
+
+ throw new NotImplementedException();
+ }
+
+ private static unsafe bool IsSortable(char *text, int length)
+ {
+ // CompareInfo c = CultureInfo.InvariantCulture.CompareInfo;
+ // return (InternalIsSortable(c.m_dataHandle, c.m_handleOrigin, c.m_sortName, text, text.Length));
+ throw new NotImplementedException();
}
private const int COMPARE_OPTIONS_ORDINAL = 0x40000000; // Ordinal
@@ -381,7 +396,7 @@ namespace System.Globalization
// Suffix & Prefix shouldn't use this, make sure to turn off the NORM_LINGUISTIC_CASING flag
if (options == CompareOptions.Ordinal) { nativeCompareFlags = COMPARE_OPTIONS_ORDINAL; }
- Contract.Assert(((options & ~(CompareOptions.IgnoreCase |
+ Debug.Assert(((options & ~(CompareOptions.IgnoreCase |
CompareOptions.IgnoreKanaType |
CompareOptions.IgnoreNonSpace |
CompareOptions.IgnoreSymbols |
@@ -391,5 +406,10 @@ namespace System.Globalization
return nativeCompareFlags;
}
+
+ private SortVersion GetSortVersion()
+ {
+ throw new NotImplementedException();
+ }
}
}