2014-10-27 21:12:57 +01:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2014-11-03 00:05:54 +01:00
|
|
|
namespace System.Unicode.Builder
|
2014-10-27 21:12:57 +01:00
|
|
|
{
|
|
|
|
|
public sealed class UnicodeCharacterDataBuilder
|
|
|
|
|
{
|
2014-11-02 21:56:24 +01:00
|
|
|
private readonly UnicodeCharacterRange codePointRange;
|
2014-10-27 21:12:57 +01:00
|
|
|
private string name;
|
|
|
|
|
private UnicodeCategory category = UnicodeCategory.OtherNotAssigned;
|
|
|
|
|
private CanonicalCombiningClass canonicalCombiningClass;
|
2014-11-02 21:56:24 +01:00
|
|
|
private BidirectionalClass bidirectionalClass;
|
2014-10-27 21:12:57 +01:00
|
|
|
private string decompositionType;
|
|
|
|
|
private UnicodeNumericType numericType;
|
|
|
|
|
private UnicodeRationalNumber numericValue;
|
|
|
|
|
private bool bidirectionalMirrored;
|
|
|
|
|
private string oldName;
|
|
|
|
|
private string simpleUpperCaseMapping;
|
|
|
|
|
private string simpleLowerCaseMapping;
|
|
|
|
|
private string simpleTitleCaseMapping;
|
2014-11-01 14:09:56 +01:00
|
|
|
private ContributoryProperties contributoryProperties;
|
2014-10-27 21:12:57 +01:00
|
|
|
|
|
|
|
|
private List<int> relatedCodePoints = new List<int>();
|
|
|
|
|
|
2014-11-02 21:56:24 +01:00
|
|
|
public UnicodeCharacterRange CodePointRange { get { return codePointRange; } }
|
2014-10-27 21:12:57 +01:00
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get { return name; }
|
|
|
|
|
set { name = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UnicodeCategory Category
|
|
|
|
|
{
|
|
|
|
|
get { return category; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (!Enum.IsDefined(typeof(UnicodeCategory), value))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentOutOfRangeException("value");
|
|
|
|
|
}
|
|
|
|
|
category = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CanonicalCombiningClass CanonicalCombiningClass
|
|
|
|
|
{
|
|
|
|
|
get { return canonicalCombiningClass; }
|
|
|
|
|
set { canonicalCombiningClass = value; } // Even values not defined in the enum are allowed here.
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-02 21:56:24 +01:00
|
|
|
public BidirectionalClass BidirectionalClass
|
2014-10-27 21:12:57 +01:00
|
|
|
{
|
|
|
|
|
get { return bidirectionalClass; }
|
|
|
|
|
set { bidirectionalClass = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string DecompositionType
|
|
|
|
|
{
|
|
|
|
|
get { return decompositionType; }
|
|
|
|
|
set { decompositionType = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UnicodeNumericType NumericType
|
|
|
|
|
{
|
|
|
|
|
get { return numericType; }
|
|
|
|
|
set { numericType = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UnicodeRationalNumber NumericValue
|
|
|
|
|
{
|
|
|
|
|
get { return numericValue; }
|
|
|
|
|
set { numericValue = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string OldName
|
|
|
|
|
{
|
|
|
|
|
get { return oldName; }
|
|
|
|
|
set { oldName = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool BidirectionalMirrored
|
|
|
|
|
{
|
|
|
|
|
get { return bidirectionalMirrored; }
|
|
|
|
|
set { bidirectionalMirrored = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string SimpleUpperCaseMapping
|
|
|
|
|
{
|
|
|
|
|
get { return simpleUpperCaseMapping; }
|
|
|
|
|
set { simpleUpperCaseMapping = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string SimpleLowerCaseMapping
|
|
|
|
|
{
|
|
|
|
|
get { return simpleLowerCaseMapping; }
|
|
|
|
|
set { simpleLowerCaseMapping = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string SimpleTitleCaseMapping
|
|
|
|
|
{
|
|
|
|
|
get { return simpleTitleCaseMapping; }
|
|
|
|
|
set { simpleTitleCaseMapping = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-01 14:09:56 +01:00
|
|
|
public ContributoryProperties ContributoryProperties
|
|
|
|
|
{
|
|
|
|
|
get { return contributoryProperties; }
|
|
|
|
|
set { contributoryProperties = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-27 21:12:57 +01:00
|
|
|
public ICollection<int> RelatedCodePoints { get { return relatedCodePoints; } }
|
|
|
|
|
|
|
|
|
|
public UnicodeCharacterDataBuilder(int codePoint)
|
2014-11-02 21:56:24 +01:00
|
|
|
: this(new UnicodeCharacterRange(codePoint))
|
2014-10-27 21:12:57 +01:00
|
|
|
{
|
2014-11-02 21:56:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UnicodeCharacterDataBuilder(UnicodeCharacterRange codePointRange)
|
|
|
|
|
{
|
|
|
|
|
this.codePointRange = codePointRange;
|
|
|
|
|
this.category = UnicodeCategory.OtherNotAssigned;
|
2014-10-27 21:12:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UnicodeCharacterData ToCharacterData()
|
|
|
|
|
{
|
|
|
|
|
return new UnicodeCharacterData
|
|
|
|
|
(
|
2014-11-02 21:56:24 +01:00
|
|
|
codePointRange,
|
2014-10-27 21:12:57 +01:00
|
|
|
Name,
|
|
|
|
|
category,
|
|
|
|
|
canonicalCombiningClass,
|
|
|
|
|
bidirectionalClass,
|
|
|
|
|
decompositionType,
|
|
|
|
|
numericType,
|
|
|
|
|
numericValue,
|
|
|
|
|
bidirectionalMirrored,
|
|
|
|
|
oldName,
|
|
|
|
|
simpleUpperCaseMapping,
|
|
|
|
|
simpleLowerCaseMapping,
|
|
|
|
|
simpleTitleCaseMapping,
|
2014-11-01 14:09:56 +01:00
|
|
|
contributoryProperties,
|
2014-10-27 21:12:57 +01:00
|
|
|
relatedCodePoints.Count > 0 ? relatedCodePoints.ToArray() : null
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|