1- //===--- UnicodeStorage .swift ---------------------------------------------===//
1+ //===--- UnicodeViews .swift -- ---------------------------------------------===//
22//
33// This source file is part of the Swift.org open source project
44//
@@ -32,12 +32,12 @@ internal func __swift_stdlib_U_FAILURE(_ x: __swift_stdlib_UErrorCode) -> Bool {
3232
3333/// A collection of `CodeUnit`s to be interpreted by some `Encoding`.
3434///
35- /// View types nested in UnicodeStorage may be suitable *generic* implementation
35+ /// View types nested in _UnicodeViews may be suitable *generic* implementation
3636/// guts for views for models of Unicode, but specific models may want to
3737/// provide their own implementations. For example, the UTF16 view of a
3838/// Latin1String would might be a simple lazy zero-extended mapping, rather than
3939/// something that goes through the transcoding machinery.
40- public struct UnicodeStorage <
40+ public struct _UnicodeViews <
4141 CodeUnits : RandomAccessCollection ,
4242 Encoding : UnicodeEncoding
4343>
@@ -54,15 +54,15 @@ where Encoding.EncodedScalar.Iterator.Element == CodeUnits.Iterator.Element,
5454 public var codeUnits : CodeUnits
5555}
5656
57- /// A straightforward typealias for _UnicodeStorage
57+ /// A straightforward typealias for _UnicodeViews
5858///
5959/// Use this to escape the automatic deduction of the generic arguments given
60- /// the name `UnicodeStorage ` from within nested contexts
60+ /// the name `_UnicodeViews ` from within nested contexts
6161/// (https://bugs.swift.org/browse/SR-4155).
62- internal typealias _UnicodeStorage <
62+ internal typealias _UnicodeViews_ <
6363 CodeUnits : RandomAccessCollection ,
6464 Encoding : UnicodeEncoding
65- > = UnicodeStorage < CodeUnits , Encoding >
65+ > = _UnicodeViews < CodeUnits , Encoding >
6666where Encoding. EncodedScalar . Iterator . Element == CodeUnits . Iterator. Element,
6767 CodeUnits . SubSequence : Rando mAccessCollection,
6868 CodeUnits . SubSequence. Index == CodeUnits . Index,
@@ -71,7 +71,7 @@ CodeUnits.SubSequence.Iterator.Element == CodeUnits.Iterator.Element
7171
7272/// A lazy collection of `Encoding.EncodedScalar` that results
7373/// from parsing an instance of codeUnits using that `Encoding`.
74- extension UnicodeStorage {
74+ extension _UnicodeViews {
7575 public struct EncodedScalars {
7676 let codeUnits : CodeUnits
7777
@@ -81,7 +81,7 @@ extension UnicodeStorage {
8181 }
8282}
8383
84- extension UnicodeStorage . EncodedScalars {
84+ extension _UnicodeViews . EncodedScalars {
8585 // Because parsing produces a buffer and a new index, to avoid
8686 // repeatedly decoding the same data, this index stores that buffer
8787 // and the next index. This would obviously be more complicated if
@@ -108,7 +108,7 @@ extension UnicodeStorage.EncodedScalars {
108108}
109109
110110/// Collection Conformance
111- extension UnicodeStorage . EncodedScalars : BidirectionalCollection {
111+ extension _UnicodeViews . EncodedScalars : BidirectionalCollection {
112112 public var startIndex : Index {
113113 if _slowPath ( codeUnits. isEmpty) { return endIndex }
114114 let s = codeUnits. startIndex
@@ -177,15 +177,15 @@ extension UnicodeStorage.EncodedScalars : BidirectionalCollection {
177177 }
178178}
179179
180- extension UnicodeStorage {
180+ extension _UnicodeViews {
181181 public typealias ScalarsTranscoded < ToEncoding : UnicodeEncoding >
182182 = LazyMapBidirectionalCollection < EncodedScalars , ToEncoding . EncodedScalar >
183183
184184 public func scalarsTranscoded< ToEncoding : UnicodeEncoding > (
185185 to dst: ToEncoding . Type
186186 )
187187 -> ScalarsTranscoded < ToEncoding > {
188- return UnicodeStorage . EncodedScalars ( codeUnits, Encoding . self) . lazy. map {
188+ return _UnicodeViews . EncodedScalars ( codeUnits, Encoding . self) . lazy. map {
189189 dst. encode ( $0) !
190190 }
191191 }
@@ -201,7 +201,7 @@ extension UnicodeStorage {
201201 // Instead, we wrap an instance of Base.
202202 public typealias Base = FlattenBidirectionalCollection <
203203 LazyMapBidirectionalCollection <
204- UnicodeStorage < CodeUnits , FromEncoding > . EncodedScalars ,
204+ _UnicodeViews < CodeUnits , FromEncoding > . EncodedScalars ,
205205 ToEncoding . EncodedScalar
206206 >
207207 >
@@ -211,7 +211,7 @@ extension UnicodeStorage {
211211 from src: FromEncoding . Type = FromEncoding . self,
212212 to dst: ToEncoding . Type = ToEncoding . self
213213 ) {
214- base = Base ( UnicodeStorage ( codeUnits) . scalarsTranscoded ( to: dst) )
214+ base = Base ( _UnicodeViews ( codeUnits) . scalarsTranscoded ( to: dst) )
215215 }
216216
217217 // FIXME: this should go in the extension below but for <rdar://30320012>
@@ -241,7 +241,7 @@ extension UnicodeStorage {
241241 }
242242}
243243
244- extension UnicodeStorage : _UTextable {
244+ extension _UnicodeViews : _UTextable {
245245 internal func _nativeLength( _ uText: inout _UText ) -> Int64 {
246246 uText. validate ( )
247247 return codeUnits. count^
@@ -250,15 +250,15 @@ extension UnicodeStorage : _UTextable {
250250 internal func _parsedSlice(
251251 _ offset: Int64 ,
252252 _ slice: ( CodeUnits . Index ) -> CodeUnits . SubSequence
253- ) -> UnicodeStorage < CodeUnits . SubSequence , Encoding > . EncodedScalars . SubSequence {
254- return _UnicodeStorage (
253+ ) -> _UnicodeViews < CodeUnits . SubSequence , Encoding > . EncodedScalars . SubSequence {
254+ return _UnicodeViews_ (
255255 slice ( codeUnits. index ( atOffset: offset) ) , Encoding . self
256256 ) . scalars. dropFirst ( 0 )
257257 }
258258
259259 internal func _parsedSuffix(
260260 fromOffset offset: Int64
261- ) -> UnicodeStorage < CodeUnits . SubSequence , Encoding > . EncodedScalars . SubSequence {
261+ ) -> _UnicodeViews < CodeUnits . SubSequence , Encoding > . EncodedScalars . SubSequence {
262262 return _parsedSlice ( offset, codeUnits. suffix ( from: ) )
263263 }
264264
@@ -381,7 +381,7 @@ extension UnicodeStorage : _UTextable {
381381 // the generic TranscodedView, which is likely to be less efficient in
382382 // some common cases.
383383 let source
384- = _UnicodeStorage ( base, Encoding . self) . transcoded ( to: UTF16 . self)
384+ = _UnicodeViews_ ( base, Encoding . self) . transcoded ( to: UTF16 . self)
385385 var d = destination // copy due to https://bugs.swift.org/browse/SR-3782
386386 let ( limit, remainder) = d. copy ( from: source)
387387
@@ -426,26 +426,26 @@ extension UnicodeStorage : _UTextable {
426426 ..<
427427 codeUnits. index ( atOffset: nativeIndex) ]
428428
429- return _UnicodeStorage (
429+ return _UnicodeViews_ (
430430 nativeChunk, Encoding . self) . transcoded ( to: UTF16 . self) . count^
431431 }
432432}
433433
434- extension UnicodeStorage {
434+ extension _UnicodeViews {
435435 public var scalars : EncodedScalars {
436436 return EncodedScalars ( codeUnits, Encoding . self)
437437 }
438438}
439439
440- extension UnicodeStorage {
440+ extension _UnicodeViews {
441441
442442 public struct CharacterView : BidirectionalCollection {
443443
444444 public init ( _ codeUnits: CodeUnits , _: Encoding . Type = Encoding . self) {
445- self . storage = UnicodeStorage ( codeUnits)
445+ self . storage = _UnicodeViews ( codeUnits)
446446 }
447447
448- internal let storage : UnicodeStorage
448+ internal let storage : _UnicodeViews
449449
450450 public typealias SubSequence = BidirectionalSlice < CharacterView >
451451
@@ -455,7 +455,7 @@ extension UnicodeStorage {
455455
456456 public subscript( i: Index ) -> Character {
457457 let j = index ( after: i)
458- let contents = UnicodeStorage <
458+ let contents = _UnicodeViews <
459459 // explicit generic parameters shouldn't be needed
460460 // <rdar://problem/30882312>
461461 CodeUnits . SubSequence, Encoding
@@ -532,7 +532,7 @@ internal func _makeFCCNormalizer() -> OpaquePointer {
532532
533533internal var _fccNormalizer = _makeFCCNormalizer ( )
534534
535- extension UnicodeStorage {
535+ extension _UnicodeViews {
536536
537537 public typealias FCCNormalizedUTF16View = [ UInt16 ]
538538
0 commit comments