public AlphaNumAlgorithm(CultureInfo current)
 {
     if (current != null)
     {
         this.m_CompareInfo = current.CompareInfo;
     }
     else
     {
         this.m_CompareInfo = CultureInfo.CurrentCulture.CompareInfo;
     }
     this.m_CompareOptions = System.Globalization.CompareOptions.IgnoreCase;
 }
 public ConstructorSnippet(CultureInfo current)
 {
     if (current != null)
     {
         this.m_CompareInfo = current.CompareInfo;
     }
     else
     {
         this.m_CompareInfo = CultureInfo.CurrentCulture.CompareInfo;
     }
     this.m_CompareOptions = System.Globalization.CompareOptions.IgnoreCase;
 }
		static bool IsIgnorable (int i, COpt opt)
		{
			return Uni.IsIgnorable (i, (byte) (1 +
				((opt & COpt.IgnoreSymbols) != 0 ? 2 : 0) +
				((opt & COpt.IgnoreNonSpace) != 0 ? 4 : 0)));
			
		}
		int FilterExtender (int i, ExtenderType ext, COpt opt)
		{
			if (ext == ExtenderType.Conditional &&
				Uni.HasSpecialWeight ((char) i)) {
				bool half = IsHalfKana ((char) i, opt);
				bool katakana = !Uni.IsHiragana ((char) i);
				switch (Level1 (i) & 7) {
				case 2:
					return half ? 0xFF71 : katakana ? 0x30A2 : 0x3042;
				case 3:
					return half ? 0xFF72 : katakana ? 0x30A4 : 0x3044;
				case 4:
					return half ? 0xFF73 : katakana ? 0x30A6 : 0x3046;
				case 5:
					return half ? 0xFF74 : katakana ? 0x30A8 : 0x3048;
				case 6:
					return half ? 0xFF75 : katakana ? 0x30AA : 0x304A;
				}
			}
			return i;
		}
		static byte ToDashTypeValue (ExtenderType ext, COpt opt)
		{
			if ((opt & COpt.IgnoreNonSpace) != 0) // LAMESPEC: huh, why?
				return 3;
			switch (ext) {
			case ExtenderType.None:
				return 3;
			case ExtenderType.Conditional:
				return 5;
			default:
				return 4;
			}
		}
		int FilterOptions (int i, COpt opt)
		{
			if ((opt & COpt.IgnoreWidth) != 0) {
				int x = Uni.ToWidthCompat (i);
				if (x != 0)
					i = x;
			}
			if ((opt & COpt.OrdinalIgnoreCase) != 0)
				i = textInfo.ToLower ((char) i);
			if ((opt & COpt.IgnoreCase) != 0)
				i = textInfo.ToLower ((char) i);
			if ((opt & COpt.IgnoreKanaType) != 0)
				i = Uni.ToKanaTypeInsensitive (i);
			return i;
		}
		static bool IsHalfKana (int cp, COpt opt)
		{
			return (opt & COpt.IgnoreWidth) != 0 ||
				Uni.IsHalfWidthKana ((char) cp);
		}
		unsafe bool MatchesPrimitive (COpt opt, byte* source, int si, ExtenderType ext, byte* target, int ti, bool noLv4)
		{
			bool ignoreNonSpace = (opt & COpt.IgnoreNonSpace) != 0;
			if (source [0] != target [0] ||
				source [1] != target [1] ||
				(!ignoreNonSpace && source [2] != target [2]) ||
				source [3] != target [3])
				return false;
			if (noLv4 && (si < 0 || !Uni.HasSpecialWeight ((char) si)))
				return true;
			else if (noLv4)
				return false;
			// Since target can never be an extender, if the source
			// is an expander and it matters, then they never match.
			if (!ignoreNonSpace && ext == ExtenderType.Conditional)
				return false;
			if (Uni.IsJapaneseSmallLetter ((char) si) !=
				Uni.IsJapaneseSmallLetter ((char) ti) ||
				ToDashTypeValue (ext, opt) !=
				// FIXME: we will have to specify correct value for target
				ToDashTypeValue (ExtenderType.None, opt) ||
				!Uni.IsHiragana ((char) si) !=
				!Uni.IsHiragana ((char) ti) ||
				IsHalfKana ((char) si, opt) !=
				IsHalfKana ((char) ti, opt))
				return false;
			return true;
		}
Exemple #9
0
 public static System.StringComparer GetStringComparer(this System.Globalization.CompareInfo compareInfo, System.Globalization.CompareOptions options)
 {
     throw null;
 }
Exemple #10
0
		static bool IsIgnorable (int i, COpt opt)
		{
			return Uni.IsIgnorable (i, (byte)
				(((opt & (COpt.Ordinal | COpt.OrdinalIgnoreCase)) == 0 ? 1 : 0) +
				((opt & COpt.IgnoreSymbols) != 0 ? 2 : 0) +
				((opt & COpt.IgnoreNonSpace) != 0 ? 4 : 0)));
			
		}