private static void InitializeAlphabetRangeList( ) { bool isValid = false; foreach (UnicodeRange range in ranges) { UnicodeRange newRange = RangePropertyCollector.GetRange(new UnicodeRange(0x0041, 0x005A), range); if (null != newRange) { alphabetRangeList.Add(newRange); isValid = true; } newRange = RangePropertyCollector.GetRange(new UnicodeRange(0x0061, 0x007A), range); if (null != newRange) { alphabetRangeList.Add(newRange); isValid = true; } } if (!isValid) { throw new ArgumentOutOfRangeException("StringFactory, Latin alphabet ranges for Combining mark property are beyond expected. " + "Refer to Latin Alphabet range 0x0041 - 0x005A and 0x0061 - 0x007A." + "All " + ranges.Count + " UniCodeRange is in Latin alphabet range"); } }
private static void InitializeAlphabetRangeList( ) { bool isValid = false; UnicodeRange newRange = RangePropertyCollector.GetRange(new UnicodeRange(0x0041, 0x005A), range); if (null != newRange) { alphabetRangeList.Add(newRange); isValid = true; } newRange = RangePropertyCollector.GetRange(new UnicodeRange(0x0061, 0x007A), range); if (null != newRange) { alphabetRangeList.Add(newRange); isValid = true; } if (!isValid) { throw new ArgumentOutOfRangeException("StringFactory, latin alphabet range are beyond expected " + String.Format(CultureInfo.InvariantCulture, "0x{0:X}", range.StartOfUnicodeRange) + " - " + String.Format(CultureInfo.InvariantCulture, "0x{0:X}", range.EndOfUnicodeRange) + ". Refer to latin Alphabet range 0x0041 - 0x005A and 0x0061 - 0x007A."); } }
/// <summary> /// Define SurrogatePairProperty class /// <a href="http://www.unicode.org/charts/PDF/UD800.pdf">Newline</a> /// <a href="http://www.unicode.org/charts/PDF/UDC00.pdf">Newline</a> /// </summary> public SurrogatePairProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges) { bool isValid = false; foreach (UnicodeRange range in expectedRanges) { if (RangePropertyCollector.BuildPropertyDataList( unicodeDb, range, surrogatePairRangeList, "Surrogates", GroupAttributes.GroupName)) { foreach (UnicodeRangeProperty data in surrogatePairRangeList) { if (data.Name.Equals("High Surrogates", StringComparison.OrdinalIgnoreCase)) { highMin = data.Range.StartOfUnicodeRange; highMax = data.Range.EndOfUnicodeRange; } else if (data.Name.Equals("Low Surrogates", StringComparison.OrdinalIgnoreCase)) { lowMin = data.Range.StartOfUnicodeRange; lowMax = data.Range.EndOfUnicodeRange; } } isValid = true; } surrogateRange = RangePropertyCollector.GetRange(new UnicodeRange(0x10000, TextUtil.MaxUnicodePoint), range); if (null != surrogateRange) { isValid = true; } } if (!isValid) { throw new ArgumentOutOfRangeException("expectedRanges", "SurrogatePairProperty, SurrogatePair ranges are beyond expected range. " + "Refert to Surrogates range and UTF32."); } }
/// <summary> /// Define SurrogatePairDictionary class /// <a href="http://unicode.org/reports/tr9/">Newline</a> /// </summary> public BidiProperty(UnicodeRangeDatabase unicodeDb, Collection <UnicodeRange> expectedRanges) { bool isValid = false; foreach (UnicodeRange range in expectedRanges) { if (RangePropertyCollector.BuildPropertyDataList( unicodeDb, range, bidiPropertyRangeList, "Arabic", GroupAttributes.Name)) { isValid = true; } if (RangePropertyCollector.BuildPropertyDataList( unicodeDb, range, bidiPropertyRangeList, "Hebrew", GroupAttributes.Name)) { isValid = true; } } if (InitializeBidiDictionary(expectedRanges)) { isValid = true; } if (!isValid) { throw new ArgumentOutOfRangeException("expectedRanges", "BidiProperty, Bidi ranges are beyond expected range. " + "Refer to Arabic and Hebrew ranges."); } // Reset isValid to validate Latin range isValid = false; foreach (UnicodeRange expectedRange in expectedRanges) { UnicodeRange range = RangePropertyCollector.GetRange(new UnicodeRange(0x0030, 0x0039), expectedRange); if (null != range) { latinRangeList.Add(range); isValid = true; } range = RangePropertyCollector.GetRange(new UnicodeRange(0x0041, 0x005A), expectedRange); if (null != range) { latinRangeList.Add(range); isValid = true; } range = RangePropertyCollector.GetRange(new UnicodeRange(0x0061, 0x007A), expectedRange); if (null != range) { latinRangeList.Add(range); isValid = true; } } if (!isValid) { throw new ArgumentOutOfRangeException("expectedRanges", "BidiProperty, Bidi ranges are beyond expected range. " + "0x0030 - 0x0039, 0x0041 - 0x005A, and 0x0061 - 0x007A ranges are needed to construct Bidi string."); } }
/// <summary> /// Define SurrogatePairDictionary class /// <a href="http://unicode.org/reports/tr9/">Newline</a> /// </summary> public BidiProperty(UnicodeRangeDatabase unicodeDb, UnicodeRange expectedRange) { bool isValid = false; if (RangePropertyCollector.BuildPropertyDataList( unicodeDb, expectedRange, bidiPropertyRangeList, "Arabic", GroupAttributes.Name)) { isValid = true; } if (RangePropertyCollector.BuildPropertyDataList( unicodeDb, expectedRange, bidiPropertyRangeList, "Hebrew", GroupAttributes.Name)) { isValid = true; } if (InitializeBidiDictionary(expectedRange)) { isValid = true; } if (!isValid) { throw new ArgumentOutOfRangeException("BidiProperty, Bidi ranges are beyond expected range, " + String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " + String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) + ". Refer to Arabic and Hebrew ranges."); } UnicodeRange range = RangePropertyCollector.GetRange(new UnicodeRange(0x0030, 0x0039), expectedRange); if (null != range) { latinRangeList.Add(range); isValid = true; } range = RangePropertyCollector.GetRange(new UnicodeRange(0x0041, 0x005A), expectedRange); if (null != range) { latinRangeList.Add(range); isValid = true; } range = RangePropertyCollector.GetRange(new UnicodeRange(0x0061, 0x007A), expectedRange); if (null != range) { latinRangeList.Add(range); isValid = true; } if (!isValid) { throw new ArgumentOutOfRangeException("BidiProperty, Bidi ranges are beyond expected range, " + String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.StartOfUnicodeRange) + " - " + String.Format(CultureInfo.InvariantCulture, "0x{0:X}", expectedRange.EndOfUnicodeRange) + ". 0x0030 - 0x0039, 0x0041 - 0x005A, and 0x0061 - 0x007A ranges are needed to construct Bidi string."); } }