properties

This module provides common characters properties: category class, canonical combining class, bidirectional class and quick check (QC)

Types

UnicodeCategorySet = distinct int32
A set of UnicodeCategory elements
UnicodeProp = enum
  upropCat, upropCcc, upropBi, upropQc
A type for getting a single property from the Props type
UnicodeProps = array[UnicodeProp, int32]
A type holding all common properties for a character. Use UnicodeProp to get one of them. It contains raw data for some of them.

Consts

ctgL = 31
ctgM = 224
ctgN = 1792
ctgZ = 14336
ctgC = 507904
ctgP = 66584576
ctgS = 1006632960

Procs

proc contains(a: UnicodeCategorySet; b: UnicodeCategory): bool {...}{.inline, raises: [],
    tags: [].}
Check if the given category is within the categories.
assert Rune(0x0097).unicodeCategory() in ctgL
proc `+`(a: UnicodeCategorySet; b: UnicodeCategory): UnicodeCategorySet {...}{.inline,
    raises: [], tags: [].}
proc `+`(a: UnicodeCategory; b: UnicodeCategorySet): UnicodeCategorySet {...}{.inline,
    raises: [], tags: [].}
proc `+`(a, b: UnicodeCategorySet): UnicodeCategorySet {...}{.inline, raises: [], tags: [].}
proc `+`(a, b: UnicodeCategory): UnicodeCategorySet {...}{.inline, raises: [], tags: [].}
proc `==`(a, b: UnicodeCategory): bool {...}{.inline, raises: [], tags: [].}
proc categorySetMap(s: string): UnicodeCategorySet {...}{.raises: [ValueError], tags: [].}
Map category string to UnicodeCategorySet. Raise ValueError if there's no match
proc categoryMap(s: string): UnicodeCategory {...}{.raises: [ValueError], tags: [].}
Map category string to UnicodeCategory. Raise ValueError if there's no match
proc properties(cp: Rune): UnicodeProps {...}{.raises: [], tags: [].}
Return properties for a given code point. Includes: Category, Canonical Combining Class, Bidi Class and QC. This may be used as an optimization when more than one property is required. This contains raw data for some of the properties, so one of the auxiliary procedures must be used in conjuntion.
proc unicodeCategory(props: UnicodeProps): UnicodeCategory {...}{.inline, raises: [],
    tags: [].}
Return category for a given UnicodeProps
proc unicodeCategory(cp: Rune): UnicodeCategory {...}{.raises: [], tags: [].}
Return category for a given code point
proc bidirectional(props: UnicodeProps): string {...}{.inline, raises: [], tags: [].}
Return bidirectional class name for a given UnicodeProps
proc bidirectional(cp: Rune): string {...}{.raises: [], tags: [].}
Return bidirectional class name for a given code point
proc combining(props: UnicodeProps): int {...}{.inline, raises: [], tags: [].}
Return canonical combining class property for a given Props
proc combining(cp: Rune): int {...}{.raises: [], tags: [].}
Return canonical combining class property for a given code point
proc quickCheck(props: UnicodeProps): int {...}{.inline, raises: [], tags: [].}
Return quick check property for a given UnicodeProps
proc quickCheck(cp: Rune): int {...}{.raises: [], tags: [].}
Return quick check property
proc contains(qc: int; m: NfMask): bool {...}{.inline, raises: [], tags: [].}
Check if the given NF mask is within the quick-check values.
assert nfcQcNo in Rune(0x0374).quickCheck()