diff --git a/UnicodeInformation/UnicodeCategoryExtensions.cs b/UnicodeInformation/UnicodeCategoryExtensions.cs index b1dbc23..903a71d 100644 --- a/UnicodeInformation/UnicodeCategoryExtensions.cs +++ b/UnicodeInformation/UnicodeCategoryExtensions.cs @@ -7,13 +7,20 @@ using System.Threading.Tasks; namespace System.Unicode { + /// Provides extensions to the type. public static class UnicodeCategoryExtensions { + /// Gets the short name of the unicode category. + /// The category whose short name should be retrieved. + /// The short name of the unicode category. public static string GetShortName(this UnicodeCategory category) { return UnicodeCategoryInfo.Get(category).ShortName; } + /// Gets the long name of the unicode category. + /// The category whose long name should be retrieved. + /// The long name of the unicode category. public static string GetLongName(this UnicodeCategory category) { return UnicodeCategoryInfo.Get(category).LongName; diff --git a/UnicodeInformation/UnicodeCategoryInfo.cs b/UnicodeInformation/UnicodeCategoryInfo.cs index cd8ad8a..67a87ff 100644 --- a/UnicodeInformation/UnicodeCategoryInfo.cs +++ b/UnicodeInformation/UnicodeCategoryInfo.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; namespace System.Unicode { + /// Provides complementary information on values. public struct UnicodeCategoryInfo : IEquatable { private static readonly UnicodeCategoryInfo[] categories = @@ -80,23 +81,35 @@ namespace System.Unicode return unicodeLongNameToCategoryDictionary[name]; } + /// Gets an value providing information on the specified unicode category. + /// The category on which information should be retrieved. + /// Information on the specified category. public static UnicodeCategoryInfo Get(UnicodeCategory category) { return categories[(int)category]; } + /// Gets an value providing information on the unicode category, accessed by its short name, as per the Unicode standard. + /// The short name for which information should be retrieved . + /// Information on the specified category. public static UnicodeCategoryInfo FromShortName(string name) { return Get(GetCategoryFromShortName(name)); } + /// Gets an value providing information on the unicode category, accessed by its long name, as per the Unicode standard. + /// The long name for which information should be retrieved . + /// Information on the specified category. public static UnicodeCategoryInfo FromLongName(string name) { return Get(GetCategoryFromLongName(name)); } + /// The unicode category described. public readonly UnicodeCategory Category; + /// Short name of the category, as per the Unicode standard. public readonly string ShortName; + /// Long name of the category, as per the Unicode standard. public readonly string LongName; private UnicodeCategoryInfo(UnicodeCategory category, string shortName, string longName) @@ -106,26 +119,39 @@ namespace System.Unicode this.LongName = longName; } + /// Returns a that represents this instance. + /// A that represents this instance. public override string ToString() { return Category.ToString(); } + /// Determines whether the specified , is equal to this instance. + /// The to compare with this instance. + /// if the specified is equal to this instance; otherwise, . public override bool Equals(object obj) { return obj is UnicodeCategoryInfo && Equals((UnicodeCategoryInfo)obj); } + /// Indicates whether the current object is equal to another object of the same type. + /// An object to compare with this object. + /// if the current object is equal to the other parameter; otherwise, . public bool Equals(UnicodeCategoryInfo other) { return other.Category == Category && (other.Category != 0 || other.ShortName != null); } + /// Returns a hash code for this instance. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return (int)Category; } + /// Performs an implicit conversion from to . + /// The information. + /// The result of the conversion. public static implicit operator UnicodeCategory(UnicodeCategoryInfo info) { return info.Category; diff --git a/UnicodeInformation/UnicodeCodePointRange.cs b/UnicodeInformation/UnicodeCodePointRange.cs index fe1a331..05afc7c 100644 --- a/UnicodeInformation/UnicodeCodePointRange.cs +++ b/UnicodeInformation/UnicodeCodePointRange.cs @@ -8,14 +8,19 @@ using System.Threading.Tasks; namespace System.Unicode { + /// Represents a range of Unicode code points. public struct UnicodeCodePointRange : IEnumerable { + /// Represents an enumerator which enumerated through all the code points in the . public struct Enumerator : IEnumerator { private readonly int start; private readonly int end; private int index; + /// Initializes a new instance of the struct. + /// The start of the range. + /// The end of the range. internal Enumerator(int start, int end) { this.start = start; @@ -23,22 +28,34 @@ namespace System.Unicode this.index = start - 1; } + /// Does nothing. + public void Dispose() { } + + /// Gets the element in the collection at the current position of the enumerator.. + /// The element in the collection at the current position of the enumerator. public int Current { get { return index; } } object IEnumerator.Current { get { return index; } } - void IDisposable.Dispose() { } - + /// Advances the enumerator to the next element of the collection. + /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. public bool MoveNext() { return index < end && ++index == index; } void IEnumerator.Reset() { index = start - 1; } } + /// The first code point in the range. public readonly int FirstCodePoint; + /// The last code point in the range. public readonly int LastCodePoint; + /// Gets a value indicating whether this value represents a single code point. + /// if this value represents a single code point; otherwise, . public bool IsSingleCodePoint { get { return FirstCodePoint == LastCodePoint; } } + /// Initializes a new instance of the struct for a single code point. + /// The code point. + /// public UnicodeCodePointRange(int codePoint) { if (codePoint < 0 || codePoint > 0x10FFFF) throw new ArgumentOutOfRangeException(nameof(codePoint)); @@ -47,6 +64,13 @@ namespace System.Unicode LastCodePoint = codePoint; } + /// Initializes a new instance of the struct with specified bounds. + /// The first code point in the range. + /// The last code point in the range. + /// + /// is less than 0 or greated than 0x10FFFF, + /// or is less than or greated than 0x10FFFF. + /// public UnicodeCodePointRange(int firstCodePoint, int lastCodePoint) { if (firstCodePoint < 0 || firstCodePoint > 0x10FFFF) throw new ArgumentOutOfRangeException(nameof(firstCodePoint)); @@ -56,8 +80,13 @@ namespace System.Unicode LastCodePoint = lastCodePoint; } + /// Determines whether the range contains the specific code point. + /// This method does not validate its inputs, but will always return for any invalid code point. + /// The integer to check against the range. + /// if the range contains the specified code point; otherwise, . public bool Contains(int i) { + // Since the first and last code points have been checked or are at their default value of zero, the method will always exlcude invalid code points. return i >= FirstCodePoint & i <= LastCodePoint; } @@ -66,11 +95,18 @@ namespace System.Unicode return FirstCodePoint <= codePoint ? LastCodePoint < codePoint ? 1 : 0 : -1; } + /// Returns a that represents this instance. + /// A that represents this instance. public override string ToString() { return FirstCodePoint == LastCodePoint ? FirstCodePoint.ToString("X4") : FirstCodePoint.ToString("X4") + ".." + LastCodePoint.ToString("X4"); } + /// Parses the specified into a . + /// Code point ranges are encoded as one unprefixed hexadecimal number for single code points, or a pair of unprefixed hexadecimal numbers separated by the characters "..". + /// The text to parse. + /// The parsed value. + /// The parameter was not in an allowed format. public static UnicodeCodePointRange Parse(string s) { int start, end; @@ -91,6 +127,8 @@ namespace System.Unicode return new UnicodeCodePointRange(start, end); } + /// Returns an enumerator that iterates through the collection. + /// A that can be used to iterate through the collection. public Enumerator GetEnumerator() { return new Enumerator(FirstCodePoint, LastCodePoint); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } diff --git a/UnicodeInformation/UnicodeCrossReferenceCollection.cs b/UnicodeInformation/UnicodeCrossReferenceCollection.cs index f0561b2..295d942 100644 --- a/UnicodeInformation/UnicodeCrossReferenceCollection.cs +++ b/UnicodeInformation/UnicodeCrossReferenceCollection.cs @@ -11,22 +11,30 @@ namespace System.Unicode { private static int[] EmptyArray = new int[0]; + /// Represents an enumerator for the class. public struct Enumerator : IEnumerator { private readonly int[] items; private int index; + /// Initializes a new instance of the struct. + /// The items to enumerate. internal Enumerator(int[] items) { this.items = items; this.index = -1; } + /// Does nothing. public void Dispose() { } + /// Gets the element in the collection at the current position of the enumerator.. + /// The element in the collection at the current position of the enumerator. public int Current { get { return items[index]; } } object IEnumerator.Current { get { return Current; } } + /// Advances the enumerator to the next element of the collection. + /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. public bool MoveNext() { return index < items.Length && ++index < items.Length; } void IEnumerator.Reset() { this.index = -1; } @@ -34,9 +42,14 @@ namespace System.Unicode private readonly int[] items; + /// Initializes a new instance of the struct. public UnicodeCrossReferenceCollection() { items = EmptyArray; } internal UnicodeCrossReferenceCollection(int[] items) { this.items = items ?? EmptyArray; } + /// Gets the cross-referenced code point at the specified index. + /// The cross-referenced code point. + /// The index. + /// The cross-referenced code point at the specified index. public int this[int index] { get { return items[index]; } } int IList.this[int index] @@ -45,6 +58,8 @@ namespace System.Unicode set { throw new NotSupportedException(); } } + /// Gets the number of elements contained in the . + /// The number of elements contained in the . public int Count { get { return items.Length; } } bool ICollection.IsReadOnly { get { return true; } } @@ -57,11 +72,25 @@ namespace System.Unicode void ICollection.Clear() { throw new NotSupportedException(); } + /// Determines the index of a specific item in the . + /// The object to locate in the . + /// The index of the item if found in the list; otherwise, -1. public int IndexOf(int item) { return Array.IndexOf(items, item); } + + /// Determines whether the contains a specific value. + /// The object to locate in the . + /// if item is fount in the ; otherwise. public bool Contains(int item) { return IndexOf(item) >= 0; } + /// + /// Copies the elements of the UnicodeCrossReferenceCollection to an , starting at a particular index. + /// + /// The one-dimensional that is the destination of the elements to copy from UnicodeCrossReferenceCollection. The must have zero-based indexing. + /// The zeo-based index in array at which copy begins. public void CopyTo(int[] array, int arrayIndex) { items.CopyTo(array, arrayIndex); } + /// Returns an enumerator that iterates through the collection. + /// A that can be used to iterate through the collection. public Enumerator GetEnumerator() { return new Enumerator(items); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } diff --git a/UnicodeInformation/UnicodeNameAlias.cs b/UnicodeInformation/UnicodeNameAlias.cs index 7b3d3a3..343ca94 100644 --- a/UnicodeInformation/UnicodeNameAlias.cs +++ b/UnicodeInformation/UnicodeNameAlias.cs @@ -1,10 +1,15 @@ namespace System.Unicode { + /// Represents a name alias for an Unicode code point. public struct UnicodeNameAlias { internal static readonly UnicodeNameAlias[] EmptyArray = new UnicodeNameAlias[0]; + /// Gets the alias name. + /// The name. public string Name { get; } + /// Gets the kind of alias. + /// The kind of alias. public UnicodeNameAliasKind Kind { get; } internal UnicodeNameAlias(string name, UnicodeNameAliasKind kind) diff --git a/UnicodeInformation/UnicodeNameAliasCollection.cs b/UnicodeInformation/UnicodeNameAliasCollection.cs index 3bfa1be..9dde6f4 100644 --- a/UnicodeInformation/UnicodeNameAliasCollection.cs +++ b/UnicodeInformation/UnicodeNameAliasCollection.cs @@ -71,9 +71,20 @@ namespace System.Unicode void ICollection.Clear() { throw new NotSupportedException(); } + /// Determines the index of a specific item in the . + /// The object to locate in the . + /// The index of the item if found in the list; otherwise, -1. public int IndexOf(UnicodeNameAlias item) { return Array.IndexOf(items, item); } + /// Determines whether the contains a specific value. + /// The object to locate in the . + /// if item is fount in the ; otherwise. public bool Contains(UnicodeNameAlias item) { return IndexOf(item) >= 0; } + /// + /// Copies the elements of the UnicodeNameAliasCollection to an , starting at a particular index. + /// + /// The one-dimensional that is the destination of the elements to copy from UnicodeNameAliasCollection. The must have zero-based indexing. + /// The zeo-based index in array at which copy begins. public void CopyTo(UnicodeNameAlias[] array, int arrayIndex) { items.CopyTo(array, arrayIndex); } /// Returns an enumerator that iterates through the collection. diff --git a/UnicodeInformation/UnicodeNumericType.cs b/UnicodeInformation/UnicodeNumericType.cs index 2594048..efd4ca2 100644 --- a/UnicodeInformation/UnicodeNumericType.cs +++ b/UnicodeInformation/UnicodeNumericType.cs @@ -6,11 +6,16 @@ using System.Threading.Tasks; namespace System.Unicode { + /// Represents the value of the Numeric_Type property. public enum UnicodeNumericType : byte { + /// The code point has no numeric value. None = 0, + /// The code point represents a decimal digit which is part of a contiguous ascending range of characters from 0 to 9, and can be used in a decimal radix positional numeral system. Decimal = 1, + /// The code point represents a digit between 0 and 9 and requires special handling. Digit = 2, + /// The code point represents another kind of numeric value. Numeric = 3 } } diff --git a/UnicodeInformation/UnicodeRadicalStrokeCount.cs b/UnicodeInformation/UnicodeRadicalStrokeCount.cs index 77b7c72..e1b5a62 100644 --- a/UnicodeInformation/UnicodeRadicalStrokeCount.cs +++ b/UnicodeInformation/UnicodeRadicalStrokeCount.cs @@ -6,6 +6,8 @@ using System.Threading.Tasks; namespace System.Unicode { + /// Provides information on radical and additional stroke count for a code point. + /// Values of this type are usually associated with the property kRSUnicode (aka. Unicode_Radical_Stroke). public struct UnicodeRadicalStrokeCount { internal static readonly UnicodeRadicalStrokeCount[] EmptyArray = new UnicodeRadicalStrokeCount[0]; @@ -26,8 +28,17 @@ namespace System.Unicode this.strokeCount = strokeCount; } + /// Gets the index of the Kangxi radical of the character. + /// The Kangxi radicals are numbered from 1 to 214 inclusive. + /// The index of the Kangxi radical. public byte Radical { get { return radical; } } + /// Gets the additional stroke count. + /// + /// The stroke count. + /// public byte StrokeCount { get { return (byte)(strokeCount & 0x7F); } } + /// Gets a value indicating whether the information is based on the simplified form of the radical. + /// if the information is based on the simplified form of the radical; otherwise, . public bool IsSimplified { get { return (strokeCount & 0x80) != 0; } } } } diff --git a/UnicodeInformation/UnicodeRadicalStrokeCountCollection.cs b/UnicodeInformation/UnicodeRadicalStrokeCountCollection.cs index de34f23..b81fd4d 100644 --- a/UnicodeInformation/UnicodeRadicalStrokeCountCollection.cs +++ b/UnicodeInformation/UnicodeRadicalStrokeCountCollection.cs @@ -7,24 +7,33 @@ using System.Threading.Tasks; namespace System.Unicode { + /// Represents a collection of values for the kRSUnicode (aka. Unicode_Radical_Stroke) property. public struct UnicodeRadicalStrokeCountCollection : IList { + /// Represents an enumerator for the class. public struct Enumerator : IEnumerator { private readonly UnicodeRadicalStrokeCount[] items; private int index; + /// Initializes a new instance of the struct. + /// The items to enumerate. internal Enumerator(UnicodeRadicalStrokeCount[] items) { this.items = items; this.index = -1; } + /// Does nothing. public void Dispose() { } + /// Gets the element in the collection at the current position of the enumerator.. + /// The element in the collection at the current position of the enumerator. public UnicodeRadicalStrokeCount Current { get { return items[index]; } } object IEnumerator.Current { get { return Current; } } + /// Advances the enumerator to the next element of the collection. + /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. public bool MoveNext() { return index < items.Length && ++index < items.Length; } void IEnumerator.Reset() { this.index = -1; } @@ -32,9 +41,14 @@ namespace System.Unicode private readonly UnicodeRadicalStrokeCount[] items; + /// Initializes a new instance of the struct. public UnicodeRadicalStrokeCountCollection() { items = UnicodeRadicalStrokeCount.EmptyArray; } internal UnicodeRadicalStrokeCountCollection(UnicodeRadicalStrokeCount[] items) { this.items = items ?? UnicodeRadicalStrokeCount.EmptyArray; } + /// Gets the at the specified index. + /// The . + /// The index. + /// The at the specified index. public UnicodeRadicalStrokeCount this[int index] { get { return items[index]; } } UnicodeRadicalStrokeCount IList.this[int index] @@ -43,6 +57,8 @@ namespace System.Unicode set { throw new NotSupportedException(); } } + /// Gets the number of elements contained in the . + /// The number of elements contained in the . public int Count { get { return items.Length; } } bool ICollection.IsReadOnly { get { return true; } } @@ -55,11 +71,27 @@ namespace System.Unicode void ICollection.Clear() { throw new NotSupportedException(); } + /// Determines the index of a specific item in the . + /// The object to locate in the . + /// The index of the item if found in the list; otherwise, -1. public int IndexOf(UnicodeRadicalStrokeCount item) { return Array.IndexOf(items, item); } + + /// Determines whether the contains a specific value. + /// The object to locate in the . + /// if item is fount in the ; otherwise. public bool Contains(UnicodeRadicalStrokeCount item) { return IndexOf(item) >= 0; } + /// Copies the elements of the UnicodeRadicalStrokeCountCollection to an , starting at a particular index. + /// The one-dimensional that is the destination of the elements to copy from UnicodeRadicalStrokeCountCollection. The must have zero-based indexing. + /// The zeo-based index in array at which copy begins. public void CopyTo(UnicodeRadicalStrokeCount[] array, int arrayIndex) { items.CopyTo(array, arrayIndex); } + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// public Enumerator GetEnumerator() { return new Enumerator(items); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }