mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
This commit is contained in:
@@ -23,7 +23,7 @@ public enum UnicodeDecodingResult {
|
||||
case EmptyInput
|
||||
case Error
|
||||
|
||||
/// Return true if `self` indicates no more unicode scalars are
|
||||
/// Returns `true` if `self` indicates no more unicode scalars are
|
||||
/// available.
|
||||
public var isEmptyInput: Bool {
|
||||
switch self {
|
||||
@@ -58,7 +58,7 @@ public protocol UnicodeCodec {
|
||||
/// Because of buffering, it is impossible to find the corresponding position
|
||||
/// in the iterator for a given returned `UnicodeScalar` or an error.
|
||||
///
|
||||
/// - parameter next: An *iterator* of code units to be decoded.
|
||||
/// - parameter next: An iterator over the code units to be decoded.
|
||||
mutating func decode<
|
||||
I : IteratorProtocol where I.Element == CodeUnit
|
||||
>(inout next: I) -> UnicodeDecodingResult
|
||||
@@ -140,7 +140,7 @@ public struct UTF8 : UnicodeCodec {
|
||||
/// buffer with a shift, and update flags with a single-bit right shift.
|
||||
var _lookaheadFlags: UInt8 = 0
|
||||
|
||||
/// Return `true` if the LSB bytes in `buffer` are well-formed UTF-8 code
|
||||
/// Returns `true` if the LSB bytes in `buffer` are well-formed UTF-8 code
|
||||
/// unit sequence.
|
||||
@warn_unused_result
|
||||
static func _isValidUTF8Impl(buffer: UInt32, length: UInt8) -> Bool {
|
||||
@@ -191,7 +191,7 @@ public struct UTF8 : UnicodeCodec {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return `true` if the LSB bytes in `buffer` are well-formed UTF-8 code
|
||||
/// Returns `true` if the LSB bytes in `buffer` are well-formed UTF-8 code
|
||||
/// unit sequence.
|
||||
@warn_unused_result
|
||||
static func _isValidUTF8(buffer: UInt32, validBytes: UInt8) -> Bool {
|
||||
@@ -331,7 +331,7 @@ public struct UTF8 : UnicodeCodec {
|
||||
/// Because of buffering, it is impossible to find the corresponding position
|
||||
/// in the iterator for a given returned `UnicodeScalar` or an error.
|
||||
///
|
||||
/// - parameter next: A *iterator* over the code units to be decoded.
|
||||
/// - parameter next: An iterator over the code units to be decoded.
|
||||
public mutating func decode<
|
||||
I : IteratorProtocol where I.Element == CodeUnit
|
||||
>(inout next: I) -> UnicodeDecodingResult {
|
||||
@@ -478,7 +478,7 @@ public struct UTF8 : UnicodeCodec {
|
||||
put(buf3)
|
||||
}
|
||||
|
||||
/// Return `true` if `byte` is a continuation byte of the form
|
||||
/// Returns `true` if `byte` is a continuation byte of the form
|
||||
/// `0b10xxxxxx`.
|
||||
@warn_unused_result
|
||||
public static func isContinuation(byte: CodeUnit) -> Bool {
|
||||
@@ -517,7 +517,7 @@ public struct UTF16 : UnicodeCodec {
|
||||
/// Because of buffering, it is impossible to find the corresponding position
|
||||
/// in the iterator for a given returned `UnicodeScalar` or an error.
|
||||
///
|
||||
/// - parameter next: An *iterator* of code units to be decoded.
|
||||
/// - parameter next: An *iterator* over the code units to be decoded.
|
||||
public mutating func decode<
|
||||
I : IteratorProtocol where I.Element == CodeUnit
|
||||
>(inout input: I) -> UnicodeDecodingResult {
|
||||
@@ -652,7 +652,7 @@ public struct UTF32 : UnicodeCodec {
|
||||
/// Because of buffering, it is impossible to find the corresponding position
|
||||
/// in the iterator for a given returned `UnicodeScalar` or an error.
|
||||
///
|
||||
/// - parameter next: An *iterator* over the code units to be decoded.
|
||||
/// - parameter next: An iterator over the code units to be decoded.
|
||||
public mutating func decode<
|
||||
I : IteratorProtocol where I.Element == CodeUnit
|
||||
>(inout input: I) -> UnicodeDecodingResult {
|
||||
@@ -858,13 +858,13 @@ extension UTF8.CodeUnit : _StringElement {
|
||||
}
|
||||
|
||||
extension UTF16 {
|
||||
/// Return the number of code units required to encode `x`.
|
||||
/// Returns the number of code units required to encode `x`.
|
||||
@warn_unused_result
|
||||
public static func width(x: UnicodeScalar) -> Int {
|
||||
return x.value <= 0xFFFF ? 1 : 2
|
||||
}
|
||||
|
||||
/// Return the high surrogate code unit of a [surrogate pair](http://www.unicode.org/glossary/#surrogate_pair) representing
|
||||
/// Returns the high surrogate code unit of a [surrogate pair](http://www.unicode.org/glossary/#surrogate_pair) representing
|
||||
/// `x`.
|
||||
///
|
||||
/// - Requires: `width(x) == 2`.
|
||||
@@ -874,7 +874,7 @@ extension UTF16 {
|
||||
return UTF16.CodeUnit((x.value - 0x1_0000) >> (10 as UInt32)) + 0xD800
|
||||
}
|
||||
|
||||
/// Return the low surrogate code unit of a [surrogate pair](http://www.unicode.org/glossary/#surrogate_pair) representing
|
||||
/// Returns the low surrogate code unit of a [surrogate pair](http://www.unicode.org/glossary/#surrogate_pair) representing
|
||||
/// `x`.
|
||||
///
|
||||
/// - Requires: `width(x) == 2`.
|
||||
|
||||
Reference in New Issue
Block a user