Handle Unicode Core Properties.
This commit is contained in:
@@ -61,6 +61,7 @@ namespace UnicodeCharacterInspector
|
||||
NotifyPropertyChanged("NumericType");
|
||||
NotifyPropertyChanged("NumericValue");
|
||||
NotifyPropertyChanged("ContributoryProperties");
|
||||
NotifyPropertyChanged("CoreProperties");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,5 +125,10 @@ namespace UnicodeCharacterInspector
|
||||
{
|
||||
get { return character != null ? characterInfo.ContributoryProperties : null as ContributoryProperties?; }
|
||||
}
|
||||
|
||||
public CoreProperties? CoreProperties
|
||||
{
|
||||
get { return character != null ? characterInfo.CoreProperties : null as CoreProperties?; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<TextBox Grid.ColumnSpan="2" MaxLines="1" Text="{Binding Text, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<ListBox Grid.Row="1" Grid.RowSpan="3" ItemsSource="{Binding Characters}" SelectedIndex="{Binding SelectedCharacterIndex}" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" TextOptions.TextFormattingMode="Ideal" TextOptions.TextRenderingMode="Grayscale" Text="{Binding SelectedCharacterInfo.Character}" FontSize="96" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
<ScrollViewer Grid.Row="2" Grid.Column="1">
|
||||
<ScrollViewer Grid.Row="2" Grid.Column="1" VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource ResourceKey={x:Type Label}}">
|
||||
@@ -70,32 +70,35 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.CodePoint, Converter={StaticResource NullToVisibilityConverter}}" Content="Code Point" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.CodePoint, Converter={StaticResource NullToVisibilityConverter}}" Text="Code Point" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.CodePoint, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.CodePoint, StringFormat=U+{0:X4}, TargetNullValue={x:Static System:String.Empty}}" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Name, Converter={StaticResource NullToVisibilityConverter}}" Content="Name" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Name, Converter={StaticResource NullToVisibilityConverter}}" Text="Name" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.Name, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.Name}" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.OldName, Converter={StaticResource NullToVisibilityConverter}}" Content="Old Name" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.OldName, Converter={StaticResource NullToVisibilityConverter}}" Text="Old Name" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.OldName, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.OldName}" />
|
||||
<Label Grid.Row="3" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Category, Converter={StaticResource NullToVisibilityConverter}}" Content="Category" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Category, Converter={StaticResource NullToVisibilityConverter}}" Text="Category" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.Category, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.Category}" />
|
||||
<Label Grid.Row="4" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Block, Converter={StaticResource NullToVisibilityConverter}}" Content="Block" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.Block, Converter={StaticResource NullToVisibilityConverter}}" Text="Block" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.Block, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.Block}" />
|
||||
<Label Grid.Row="5" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.CanonicalCombiningClass, Converter={StaticResource NullToVisibilityConverter}}" Content="Canonical Combining Class" />
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.CanonicalCombiningClass, Converter={StaticResource NullToVisibilityConverter}}" Text="Canonical Combining Class" />
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.CanonicalCombiningClass, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.CanonicalCombiningClass}" />
|
||||
<Label Grid.Row="6" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.BidirectionalClass, Converter={StaticResource NullToVisibilityConverter}}" Content="Bidirectional Class" />
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.BidirectionalClass, Converter={StaticResource NullToVisibilityConverter}}" Text="Bidirectional Class" />
|
||||
<TextBlock Grid.Row="6" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.BidirectionalClass, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.BidirectionalClass}" />
|
||||
<Label Grid.Row="7" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.DecompositionType, Converter={StaticResource NullToVisibilityConverter}}" Content="Decomposition Type" />
|
||||
<TextBlock Grid.Row="7" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.DecompositionType, Converter={StaticResource NullToVisibilityConverter}}" Text="Decomposition Type" />
|
||||
<TextBlock Grid.Row="7" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.DecompositionType, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.DecompositionType}" />
|
||||
<Label Grid.Row="8" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.DecompositionMapping, Converter={StaticResource NullToVisibilityConverter}}" Content="Decomposition Mapping" />
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.DecompositionMapping, Converter={StaticResource NullToVisibilityConverter}}" Text="Decomposition Mapping" />
|
||||
<TextBlock Grid.Row="8" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.DecompositionMapping, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.DecompositionMapping}" />
|
||||
<Label Grid.Row="9" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.NumericType, Converter={StaticResource NullToVisibilityConverter}}" Content="Numeric Type" />
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.NumericType, Converter={StaticResource NullToVisibilityConverter}}" Text="Numeric Type" />
|
||||
<TextBlock Grid.Row="9" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.NumericType, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.NumericType}" />
|
||||
<Label Grid.Row="10" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.NumericValue, Converter={StaticResource NullToVisibilityConverter}}" Content="Numeric Value" />
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.NumericValue, Converter={StaticResource NullToVisibilityConverter}}" Text="Numeric Value" />
|
||||
<TextBlock Grid.Row="10" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.NumericValue, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.NumericValue}" />
|
||||
<Label Grid.Row="11" Grid.Column="0" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Content="Contributory Properties" />
|
||||
<TextBlock Grid.Row="11" Grid.Column="1" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.ContributoryProperties}" />
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" VerticalAlignment="Top" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="Contributory Properties" />
|
||||
<TextBlock Grid.Row="11" Grid.Column="1" VerticalAlignment="Top" TextWrapping="WrapWithOverflow" Visibility="{Binding SelectedCharacterInfo.ContributoryProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.ContributoryProperties}" />
|
||||
<TextBlock Grid.Row="12" Grid.Column="0" VerticalAlignment="Top" Visibility="{Binding SelectedCharacterInfo.CoreProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="Core Properties" />
|
||||
<TextBlock Grid.Row="12" Grid.Column="1" VerticalAlignment="Top" TextWrapping="WrapWithOverflow" Visibility="{Binding SelectedCharacterInfo.CoreProperties, Converter={StaticResource NullToVisibilityConverter}}" Text="{Binding SelectedCharacterInfo.CoreProperties}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Windows.Data;
|
||||
|
||||
namespace UnicodeCharacterInspector
|
||||
{
|
||||
class NullToVisibilityConverter : IValueConverter
|
||||
internal sealed class NullToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,15 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
internal static class BinaryWriterExtensions
|
||||
{
|
||||
public static void WriteUInt24(this BinaryWriter writer, int value)
|
||||
{
|
||||
if (value < 0 || value > 0xFFFFFF) throw new ArgumentOutOfRangeException("value");
|
||||
|
||||
writer.Write((byte)(value));
|
||||
writer.Write((byte)(value >> 8));
|
||||
writer.Write((byte)(value >> 16));
|
||||
}
|
||||
|
||||
/// <summary>Writes code point in a custom, but compact encoding.</summary>
|
||||
/// <remarks>
|
||||
/// Unlike UTF-8, this encoding will consume at most 3 bytes.
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public const string UnihanDirectoryName = "Unihan";
|
||||
public const string UnihanArchiveName = "Unihan.zip";
|
||||
public const string UcdDirectoryName = "UCD";
|
||||
public const string UcdArchiveName = "UCD.zip";
|
||||
|
||||
@@ -18,7 +20,8 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
"UnicodeData.txt",
|
||||
"PropList.txt",
|
||||
"Blocks.txt",
|
||||
"DerivedCoreProperties.txt",
|
||||
"Blocks.txt",
|
||||
"Jamo.txt"
|
||||
};
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace System.Unicode.Builder
|
||||
private string simpleLowerCaseMapping;
|
||||
private string simpleTitleCaseMapping;
|
||||
private ContributoryProperties contributoryProperties;
|
||||
private CoreProperties coreProperties;
|
||||
|
||||
private List<int> relatedCodePoints = new List<int>();
|
||||
|
||||
@@ -114,6 +115,12 @@ namespace System.Unicode.Builder
|
||||
set { contributoryProperties = value; }
|
||||
}
|
||||
|
||||
public CoreProperties CoreProperties
|
||||
{
|
||||
get { return coreProperties; }
|
||||
set { coreProperties = value; }
|
||||
}
|
||||
|
||||
public ICollection<int> RelatedCodePoints { get { return relatedCodePoints; } }
|
||||
|
||||
public UnicodeCharacterDataBuilder(int codePoint)
|
||||
@@ -146,6 +153,7 @@ namespace System.Unicode.Builder
|
||||
simpleLowerCaseMapping,
|
||||
simpleTitleCaseMapping,
|
||||
contributoryProperties,
|
||||
coreProperties,
|
||||
relatedCodePoints.Count > 0 ? relatedCodePoints.ToArray() : null
|
||||
);
|
||||
}
|
||||
@@ -168,6 +176,7 @@ namespace System.Unicode.Builder
|
||||
if (simpleLowerCaseMapping != null) fields |= UcdFields.SimpleLowerCaseMapping;
|
||||
if (simpleTitleCaseMapping != null) fields |= UcdFields.SimpleTitleCaseMapping;
|
||||
if (contributoryProperties != 0) fields |= UcdFields.ContributoryProperties;
|
||||
if (coreProperties != 0) fields |= UcdFields.CoreProperties;
|
||||
|
||||
writer.Write((ushort)fields);
|
||||
|
||||
@@ -193,6 +202,7 @@ namespace System.Unicode.Builder
|
||||
if ((fields & UcdFields.SimpleLowerCaseMapping) != 0) writer.Write(simpleLowerCaseMapping);
|
||||
if ((fields & UcdFields.SimpleTitleCaseMapping) != 0) writer.Write(simpleTitleCaseMapping);
|
||||
if ((fields & UcdFields.ContributoryProperties) != 0) writer.Write((int)contributoryProperties);
|
||||
if ((fields & UcdFields.CoreProperties) != 0) writer.WriteUInt24((int)coreProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,20 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
return length > 0 ? Encoding.UTF8.GetString(reader.utf8StringBuffer, 0, length) : string.Empty;
|
||||
}
|
||||
|
||||
public string ToTrimmedString()
|
||||
{
|
||||
if (length == 0) return string.Empty;
|
||||
|
||||
var buffer = reader.utf8StringBuffer;
|
||||
int start = 0;
|
||||
int end = length;
|
||||
|
||||
while (buffer[start] == ' ') if (++start == length) return string.Empty;
|
||||
while (buffer[--end] == ' ') ;
|
||||
|
||||
return length > 0 ? Encoding.UTF8.GetString(reader.utf8StringBuffer, start, end - start + 1) : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Stream stream;
|
||||
@@ -128,10 +142,7 @@ namespace System.Unicode.Builder
|
||||
return hasField;
|
||||
}
|
||||
|
||||
/// <summary>Reads the next data field.</summary>
|
||||
/// <remarks>This method will return <see langword="null"/> on end of line.</remarks>
|
||||
/// <returns>The text value of the read field, if available; <see langword="null"/> otherwise.</returns>
|
||||
public string ReadField()
|
||||
private string ReadFieldInternal(bool trim)
|
||||
{
|
||||
if (length == 0) throw new InvalidOperationException();
|
||||
|
||||
@@ -193,7 +204,23 @@ namespace System.Unicode.Builder
|
||||
}
|
||||
} while (RefillBuffer());
|
||||
|
||||
return buffer.ToString();
|
||||
return trim ? buffer.ToTrimmedString() : buffer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Reads the next data field.</summary>
|
||||
/// <remarks>This method will return <see langword="null"/> on end of line.</remarks>
|
||||
/// <returns>The text value of the read field, if available; <see langword="null"/> otherwise.</returns>
|
||||
public string ReadField()
|
||||
{
|
||||
return ReadFieldInternal(false);
|
||||
}
|
||||
|
||||
/// <summary>Reads the next data field as a trimmed value.</summary>
|
||||
/// <remarks>This method will return <see langword="null"/> on end of line.</remarks>
|
||||
/// <returns>The trimmed text value of the read field, if available; <see langword="null"/> otherwise.</returns>
|
||||
public string ReadTrimmedField()
|
||||
{
|
||||
return ReadFieldInternal(true);
|
||||
}
|
||||
|
||||
/// <summary>Skips the next data field.</summary>
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
public const string UnicodeDataFileName = "UnicodeData.txt";
|
||||
public const string PropListFileName = "PropList.txt";
|
||||
public const string DerivedCorePropertiesFileName = "DerivedCoreProperties.txt";
|
||||
public const string BlocksFileName = "Blocks.txt";
|
||||
|
||||
private static string ParseSimpleCaseMapping(string mapping)
|
||||
@@ -32,6 +33,7 @@ namespace System.Unicode.Builder
|
||||
|
||||
await ProcessUnicodeDataFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessPropListFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessDerivedCorePropertiesFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessBlocksFile(ucdSource, builder).ConfigureAwait(false);
|
||||
|
||||
return builder;
|
||||
@@ -162,8 +164,25 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
ContributoryProperties property;
|
||||
|
||||
var range = UnicodeCharacterRange.Parse(reader.ReadField().TrimEnd());
|
||||
if (EnumHelper<ContributoryProperties>.TryGetNamedValue(reader.ReadField().Trim(), out property))
|
||||
var range = UnicodeCharacterRange.Parse(reader.ReadTrimmedField());
|
||||
if (EnumHelper<ContributoryProperties>.TryGetNamedValue(reader.ReadTrimmedField(), out property))
|
||||
{
|
||||
builder.SetProperties(property, range);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task ProcessDerivedCorePropertiesFile(IUcdSource ucdSource, UnicodeInfoBuilder builder)
|
||||
{
|
||||
using (var reader = new UnicodeDataFileReader(await ucdSource.OpenDataFileAsync(DerivedCorePropertiesFileName).ConfigureAwait(false)))
|
||||
{
|
||||
while (reader.MoveToNextLine())
|
||||
{
|
||||
CoreProperties property;
|
||||
|
||||
var range = UnicodeCharacterRange.Parse(reader.ReadTrimmedField());
|
||||
if (EnumHelper<CoreProperties>.TryGetNamedValue(reader.ReadTrimmedField(), out property))
|
||||
{
|
||||
builder.SetProperties(property, range);
|
||||
}
|
||||
@@ -177,7 +196,7 @@ namespace System.Unicode.Builder
|
||||
{
|
||||
while (reader.MoveToNextLine())
|
||||
{
|
||||
builder.AddBlockEntry(new UnicodeBlock(UnicodeCharacterRange.Parse(reader.ReadField()), reader.ReadField().Trim()));
|
||||
builder.AddBlockEntry(new UnicodeBlock(UnicodeCharacterRange.Parse(reader.ReadField()), reader.ReadTrimmedField()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,37 @@ namespace System.Unicode.Builder
|
||||
}
|
||||
}
|
||||
|
||||
public void SetProperties(CoreProperties property, UnicodeCharacterRange codePointRange)
|
||||
{
|
||||
int firstIndex = FindCodePoint(codePointRange.FirstCodePoint);
|
||||
int lastIndex = FindCodePoint(codePointRange.LastCodePoint);
|
||||
|
||||
if (firstIndex < 0 && lastIndex < 0)
|
||||
{
|
||||
Insert(new UnicodeCharacterDataBuilder(codePointRange) { CoreProperties = property });
|
||||
return;
|
||||
}
|
||||
|
||||
if (firstIndex < 0
|
||||
|| lastIndex < 0
|
||||
|| entries[firstIndex].CodePointRange.FirstCodePoint < codePointRange.FirstCodePoint
|
||||
|| entries[lastIndex].CodePointRange.LastCodePoint > codePointRange.LastCodePoint)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
int i = firstIndex;
|
||||
|
||||
while (true)
|
||||
{
|
||||
entries[i].CoreProperties |= property;
|
||||
|
||||
if (i == lastIndex) break;
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddBlockEntry(UnicodeBlock block)
|
||||
{
|
||||
blockEntries.Add(block);
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Unicode
|
||||
{
|
||||
[Flags]
|
||||
public enum CoreProperties : int
|
||||
{
|
||||
[ValueName("Lowercase"), ValueName("Lower"), Display(Name = "Lowercase")]
|
||||
Lowercase = 0x00000001,
|
||||
[ValueName("Uppercase"), ValueName("Upper"), Display(Name = "Uppercase")]
|
||||
Uppercase = 0x00000002,
|
||||
[ValueName("Cased"), Display(Name = "Cased")]
|
||||
Cased = 0x00000004,
|
||||
[ValueName("Case_Ignorable"), ValueName("CI"), Display(Name = "Case_Ignorable")]
|
||||
CaseIgnorable = 0x00000008,
|
||||
[ValueName("Changes_When_Lowercased"), ValueName("CWL"), Display(Name = "Changes_When_Lowercased")]
|
||||
ChangesWhenLowercased = 0x00000010,
|
||||
[ValueName("Changes_When_Uppercased"), ValueName("CWU"), Display(Name = "Changes_When_Uppercased")]
|
||||
ChangesWhenUppercased = 0x00000020,
|
||||
[ValueName("Changes_When_Titlecased"), ValueName("CWT"), Display(Name = "Changes_When_Titlecased")]
|
||||
ChangesWhenTitlecased = 0x00000040,
|
||||
[ValueName("Changes_When_Casefolded"), ValueName("CWCF"), Display(Name = "Changes_When_Casefolded")]
|
||||
ChangesWhenCasefolded = 0x00000080,
|
||||
[ValueName("Changes_When_Casemapped"), ValueName("CWCM"), Display(Name = "Changes_When_Casemapped")]
|
||||
ChangesWhenCasemapped = 0x00000100,
|
||||
[ValueName("Alphabetic"), ValueName("Alpha"), Display(Name = "Alphabetic")]
|
||||
Alphabetic = 0x00000200,
|
||||
[ValueName("Default_Ignorable_Code_Point"), ValueName("DI"), Display(Name = "Default_Ignorable_Code_Point")]
|
||||
DefaultIgnorableCodePoint = 0x00000400,
|
||||
[ValueName("Grapheme_Base"), ValueName("Gr_Base"), Display(Name = "Grapheme_Base")]
|
||||
GraphemeBase = 0x00000800,
|
||||
[ValueName("Grapheme_Extend"), ValueName("Gr_Ext"), Display(Name = "Grapheme_Extend")]
|
||||
GraphemeExtend = 0x00001000,
|
||||
[ValueName("Grapheme_Link"), ValueName("Gr_Link"), Display(Name = "Grapheme_Link")]
|
||||
GraphemeLink = 0x00002000,
|
||||
[ValueName("Math"), Display(Name = "Math")]
|
||||
Math = 0x00004000,
|
||||
[ValueName("ID_Start"), ValueName("IDS"), Display(Name = "ID_Start")]
|
||||
IdentifierStart = 0x00008000,
|
||||
[ValueName("ID_Continue"), ValueName("IDC"), Display(Name = "ID_Continue")]
|
||||
IdentifierContinue = 0x00010000,
|
||||
[ValueName("XID_Start"), ValueName("XIDS"), Display(Name = "XID_Start")]
|
||||
ExtendedIdentifierStart = 0x00020000,
|
||||
[ValueName("XID_Continue"), ValueName("XIDC"), Display(Name = "XID_Continue")]
|
||||
ExtendedIdentifierContinue = 0x00040000,
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ namespace System.Unicode
|
||||
SimpleUpperCaseMapping = 1024,
|
||||
SimpleLowerCaseMapping = 2048,
|
||||
SimpleTitleCaseMapping = 4096,
|
||||
|
||||
ContributoryProperties = 8192,
|
||||
CoreProperties = 16384,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace System.Unicode
|
||||
public string SimpleLowerCaseMapping { get { return characterData.SimpleLowerCaseMapping; } }
|
||||
public string SimpleTitleCaseMapping { get { return characterData.SimpleTitleCaseMapping; } }
|
||||
public ContributoryProperties ContributoryProperties { get { return characterData.ContributoryProperties; } }
|
||||
public CoreProperties CoreProperties { get { return characterData.CoreProperties; } }
|
||||
|
||||
internal UnicodeCharInfo(int codePoint, UnicodeCharacterData characterData, string block)
|
||||
{
|
||||
|
||||
@@ -24,8 +24,9 @@ namespace System.Unicode
|
||||
public readonly string SimpleLowerCaseMapping;
|
||||
public readonly string SimpleTitleCaseMapping;
|
||||
public readonly ContributoryProperties ContributoryProperties;
|
||||
public readonly CoreProperties CoreProperties;
|
||||
|
||||
public readonly int[] RelatedCodePoints;
|
||||
public readonly int[] RelatedCodePoints; // NB: It seems that parsing NamesList is required in order to provide data for this field ?
|
||||
|
||||
internal UnicodeCharacterData
|
||||
(
|
||||
@@ -44,6 +45,7 @@ namespace System.Unicode
|
||||
string simpleLowerCaseMapping,
|
||||
string simpleTitleCaseMapping,
|
||||
ContributoryProperties contributoryProperties,
|
||||
CoreProperties coreProperties,
|
||||
int[] relatedCodePoints
|
||||
)
|
||||
{
|
||||
@@ -62,6 +64,7 @@ namespace System.Unicode
|
||||
this.SimpleLowerCaseMapping = simpleLowerCaseMapping;
|
||||
this.SimpleTitleCaseMapping = simpleTitleCaseMapping;
|
||||
this.ContributoryProperties = contributoryProperties;
|
||||
this.CoreProperties = coreProperties;
|
||||
this.RelatedCodePoints = relatedCodePoints;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace System.Unicode
|
||||
string simpleLowerCaseMapping = (fields & UcdFields.SimpleLowerCaseMapping) != 0 ? reader.ReadString() : null;
|
||||
string simpleTitleCaseMapping = (fields & UcdFields.SimpleTitleCaseMapping) != 0 ? reader.ReadString() : null;
|
||||
ContributoryProperties contributoryProperties = (fields & UcdFields.ContributoryProperties) != 0 ? (ContributoryProperties)reader.ReadInt32() : 0;
|
||||
CoreProperties coreProperties = (fields & UcdFields.CoreProperties) != 0 ? (CoreProperties)ReadInt24(reader) : 0;
|
||||
|
||||
return new UnicodeCharacterData
|
||||
(
|
||||
@@ -101,7 +102,8 @@ namespace System.Unicode
|
||||
simpleLowerCaseMapping,
|
||||
simpleTitleCaseMapping,
|
||||
contributoryProperties,
|
||||
null
|
||||
coreProperties,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,6 +112,11 @@ namespace System.Unicode
|
||||
return new UnicodeBlock(new UnicodeCharacterRange(ReadCodePoint(reader), ReadCodePoint(reader)), reader.ReadString());
|
||||
}
|
||||
|
||||
private static int ReadInt24(BinaryReader reader)
|
||||
{
|
||||
return reader.ReadByte() | ((reader.ReadByte() | (reader.ReadByte() << 8)) << 8);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal static int ReadCodePoint(BinaryReader reader)
|
||||
#else
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
<Link>System.Unicode.snk</Link>
|
||||
</None>
|
||||
<None Include="app.config" />
|
||||
<EmbeddedResource Include="ucd.dat">
|
||||
<LogicalName>ucd.dat</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ucd.dat">
|
||||
<LogicalName>ucd.dat</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BidirectionalClass.cs" />
|
||||
@@ -64,6 +64,7 @@
|
||||
<Compile Include="CanonicalCombiningClass.cs" />
|
||||
<Compile Include="CodePointEnumerable.cs" />
|
||||
<Compile Include="CodePointEnumerator.cs" />
|
||||
<Compile Include="CoreProperties.cs" />
|
||||
<Compile Include="UcdFields.cs" />
|
||||
<Compile Include="EnumHelper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user