Exposed cross-references, and added them to the UI.
This commit is contained in:
@@ -21,8 +21,10 @@ namespace System.Unicode.Builder
|
||||
"UnicodeData.txt",
|
||||
"PropList.txt",
|
||||
"DerivedCoreProperties.txt",
|
||||
//"Jamo.txt", // Not used right now, as the hangul syllable algorithm implementation takes care of this.
|
||||
"NameAliases.txt",
|
||||
"NamesList.txt",
|
||||
"Blocks.txt",
|
||||
"Jamo.txt",
|
||||
};
|
||||
|
||||
public static readonly string[] unihanRequiredFiles = new[]
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace System.Unicode.Builder
|
||||
private CoreProperties coreProperties;
|
||||
|
||||
private readonly List<UnicodeNameAlias> nameAliases = new List<UnicodeNameAlias>();
|
||||
private readonly List<int> relatedCodePoints = new List<int>();
|
||||
private readonly List<int> crossRerefences = new List<int>();
|
||||
|
||||
public UnicodeCharacterRange CodePointRange { get { return codePointRange; } }
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace System.Unicode.Builder
|
||||
set { coreProperties = value; }
|
||||
}
|
||||
|
||||
public ICollection<int> RelatedCodePoints { get { return relatedCodePoints; } }
|
||||
public ICollection<int> CrossRerefences { get { return crossRerefences; } }
|
||||
|
||||
public UnicodeCharacterDataBuilder(int codePoint)
|
||||
: this(new UnicodeCharacterRange(codePoint))
|
||||
@@ -158,7 +158,7 @@ namespace System.Unicode.Builder
|
||||
SimpleTitleCaseMapping,
|
||||
ContributoryProperties,
|
||||
CoreProperties,
|
||||
RelatedCodePoints.Count > 0 ? RelatedCodePoints.ToArray() : null
|
||||
CrossRerefences.Count > 0 ? CrossRerefences.ToArray() : null
|
||||
);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace System.Unicode.Builder
|
||||
if (simpleTitleCaseMapping != null) fields |= UcdFields.SimpleTitleCaseMapping;
|
||||
if (contributoryProperties != 0) fields |= UcdFields.ContributoryProperties;
|
||||
if (coreProperties != 0) fields |= UcdFields.CoreProperties;
|
||||
if (relatedCodePoints.Count > 0) fields |= UcdFields.RelatedCodePoints;
|
||||
if (crossRerefences.Count > 0) fields |= UcdFields.CrossRerefences;
|
||||
|
||||
writer.Write((ushort)fields);
|
||||
|
||||
@@ -232,11 +232,11 @@ namespace System.Unicode.Builder
|
||||
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);
|
||||
if ((fields & UcdFields.RelatedCodePoints) != 0)
|
||||
if ((fields & UcdFields.CrossRerefences) != 0)
|
||||
{
|
||||
writer.Write(checked((byte)(relatedCodePoints.Count - 1)));
|
||||
foreach (int relatedCodePoint in relatedCodePoints)
|
||||
writer.WriteCodePoint(relatedCodePoint);
|
||||
writer.Write(checked((byte)(crossRerefences.Count - 1)));
|
||||
foreach (int crossReference in crossRerefences)
|
||||
writer.WriteCodePoint(crossReference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace System.Unicode.Builder
|
||||
await ProcessDerivedCorePropertiesFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessNameAliasesFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessNamesListFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessBlocksFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessBlocksFile(ucdSource, builder).ConfigureAwait(false);
|
||||
await ProcessUnihanReadings(unihanSource, builder).ConfigureAwait(false);
|
||||
await ProcessUnihanVariants(unihanSource, builder).ConfigureAwait(false);
|
||||
await ProcessUnihanNumericValues(unihanSource, builder).ConfigureAwait(false);
|
||||
@@ -255,12 +255,12 @@ namespace System.Unicode.Builder
|
||||
if (length < 0) length = line.Length;
|
||||
length -= 3;
|
||||
|
||||
characterData.RelatedCodePoints.Add(int.Parse(line.Substring(3, length), NumberStyles.HexNumber));
|
||||
characterData.CrossRerefences.Add(int.Parse(line.Substring(3, length), NumberStyles.HexNumber));
|
||||
}
|
||||
else if (line[3] == '(')
|
||||
{
|
||||
bool hasBrackets = line[4] == '<';
|
||||
int codePointOffset = line.IndexOf(hasBrackets ? "> - " : "- ", 4);
|
||||
int codePointOffset = line.IndexOf(hasBrackets ? "> - " : "- ", 4);
|
||||
|
||||
if (codePointOffset < 0) throw new InvalidDataException();
|
||||
codePointOffset += hasBrackets ? 4 : 2;
|
||||
@@ -269,7 +269,7 @@ namespace System.Unicode.Builder
|
||||
if (length < 0) throw new InvalidDataException();
|
||||
length -= codePointOffset;
|
||||
|
||||
characterData.RelatedCodePoints.Add(int.Parse(line.Substring(codePointOffset, length), NumberStyles.HexNumber));
|
||||
characterData.CrossRerefences.Add(int.Parse(line.Substring(codePointOffset, length), NumberStyles.HexNumber));
|
||||
}
|
||||
else throw new InvalidDataException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user