Structureswift 6.0.1Swift
CanonicalCombiningClass
The classification of a scalar used in the Canonical Ordering Algorithm defined by the Unicode Standard.
struct CanonicalCombiningClass
Canonical combining classes are used by the ordering algorithm to determine if two sequences of combining marks should be considered canonically equivalent (that is, identical in interpretation). Two sequences are canonically equivalent if they are equal when sorting the scalars in ascending order by their combining class.
For example, consider the sequence "\u{0041}\u{0301}\u{0316}"
(LATIN CAPITAL LETTER A, COMBINING ACUTE ACCENT, COMBINING GRAVE ACCENT BELOW). The combining classes of these scalars have the numeric values 0, 230, and 220, respectively. Sorting these scalars by their combining classes yields "\u{0041}\u{0316}\u{0301}"
, so two strings that differ only by the ordering of those scalars would compare as equal:
let aboveBeforeBelow = "\u{0041}\u{0301}\u{0316}"
let belowBeforeAbove = "\u{0041}\u{0316}\u{0301}"
print(aboveBeforeBelow == belowBeforeAbove)
// Prints "true"
Named and Unnamed Combining Classes
Canonical combining classes are defined in the Unicode Standard as integers in the range 0...254
. For convenience, the standard assigns symbolic names to a subset of these combining classes.
The CanonicalCombiningClass
type conforms to RawRepresentable
with a raw value of type UInt8
. You can create instances of the type by using the static members named after the symbolic names, or by using the init(rawValue:)
initializer.
let overlayClass = Unicode.CanonicalCombiningClass(rawValue: 1)
let overlayClassIsOverlay = overlayClass == .overlay
// overlayClassIsOverlay == true
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (11) members.
Types
enum ASCII
enum GeneralCategory
The most general classification of a Unicode scalar.
enum NumericType
The numeric type of a scalar.
enum ParseResult<T>
The result of attempting to parse a
T
from some input.struct Scalar
A Unicode scalar value.
enum UTF16
enum UTF32
enum UTF8
Typealiases
typealias Encoding
typealias Parser
typealias Version
A version of the Unicode Standard represented by its major and minor components.
Citizens in Swift
Conformances
protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol Sendable
Type members
init(rawValue: UInt8
) Creates a new canonical combining class with the given raw integer value.
static let above: Unicode.CanonicalCombiningClass
Distinct marks directly above.
static let aboveLeft: Unicode.CanonicalCombiningClass
Distinct marks at the top left.
static let aboveRight: Unicode.CanonicalCombiningClass
Distinct marks at the top right.
static let attachedAbove: Unicode.CanonicalCombiningClass
Marks attached directly above.
static let attachedAboveRight: Unicode.CanonicalCombiningClass
Marks attached at the top right.
static let attachedBelow: Unicode.CanonicalCombiningClass
Marks attached directly below.
static let attachedBelowLeft: Unicode.CanonicalCombiningClass
Marks attached at the bottom left.
static let below: Unicode.CanonicalCombiningClass
Distinct marks directly below.
static let belowLeft: Unicode.CanonicalCombiningClass
Distinct marks at the bottom left.
static let belowRight: Unicode.CanonicalCombiningClass
Distinct marks at the bottom right.
static let doubleAbove: Unicode.CanonicalCombiningClass
Distinct marks extending above two bases.
static let doubleBelow: Unicode.CanonicalCombiningClass
Distinct marks subtending two bases.
static let iotaSubscript: Unicode.CanonicalCombiningClass
Greek iota subscript only (U+0345 COMBINING GREEK YPOGEGRAMMENI).
static let kanaVoicing: Unicode.CanonicalCombiningClass
Combining marks that are attached to hiragana and katakana to indicate voicing changes.
static let left: Unicode.CanonicalCombiningClass
Distinct marks to the left.
static let notReordered: Unicode.CanonicalCombiningClass
Base glyphs that occupy their own space and do not combine with others.
static let nukta: Unicode.CanonicalCombiningClass
Diacritic nukta marks in Brahmi-derived scripts.
static let overlay: Unicode.CanonicalCombiningClass
Marks that overlay a base letter or symbol.
static let right: Unicode.CanonicalCombiningClass
Distinct marks to the right.
static let virama: Unicode.CanonicalCombiningClass
Diacritic virama marks in Brahmi-derived scripts.
static func < (lhs: Unicode.CanonicalCombiningClass, rhs: Unicode.CanonicalCombiningClass
) -> Bool static func == (lhs: Unicode.CanonicalCombiningClass, rhs: Unicode.CanonicalCombiningClass
) -> Bool
Instance members
var hashValue: Int
let rawValue: UInt8
The raw integer value of the canonical combining class.
func hash(into: inout Hasher
)
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.
static func ... (minimum: Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.
static func <= (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func > (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.