@@ -32,27 +32,27 @@ private func _utfRangeToCFRange(_ inRange : ClosedRange<Unicode.Scalar>) -> CFRa
32
32
// NOTE: older overlays called this class _CharacterSetStorage.
33
33
// The two must coexist without a conflicting ObjC class name, so it
34
34
// was renamed. The old name must not be used in the new runtime.
35
- fileprivate final class __CharacterSetStorage : Hashable {
36
- fileprivate enum Backing {
35
+ private final class __CharacterSetStorage : Hashable {
36
+ enum Backing {
37
37
case immutable( CFCharacterSet )
38
38
case mutable( CFMutableCharacterSet )
39
39
}
40
40
41
- fileprivate var _backing : Backing
41
+ var _backing : Backing
42
42
43
43
@nonobjc
44
- init ( immutableReference r : CFCharacterSet ) {
44
+ init ( immutableReference r: CFCharacterSet ) {
45
45
_backing = . immutable( r)
46
46
}
47
47
48
48
@nonobjc
49
- init ( mutableReference r : CFMutableCharacterSet ) {
49
+ init ( mutableReference r: CFMutableCharacterSet ) {
50
50
_backing = . mutable( r)
51
51
}
52
52
53
53
// MARK: -
54
54
55
- fileprivate func hash( into hasher: inout Hasher ) {
55
+ func hash( into hasher: inout Hasher ) {
56
56
switch _backing {
57
57
case . immutable( let cs) :
58
58
hasher. combine ( CFHash ( cs) )
@@ -61,7 +61,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
61
61
}
62
62
}
63
63
64
- fileprivate static func == ( lhs : __CharacterSetStorage , rhs : __CharacterSetStorage ) -> Bool {
64
+ static func == ( lhs: __CharacterSetStorage , rhs: __CharacterSetStorage ) -> Bool {
65
65
switch ( lhs. _backing, rhs. _backing) {
66
66
case ( . immutable( let cs1) , . immutable( let cs2) ) :
67
67
return CFEqual ( cs1, cs2)
@@ -76,7 +76,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
76
76
77
77
// MARK: -
78
78
79
- fileprivate func mutableCopy( ) -> __CharacterSetStorage {
79
+ func mutableCopy( ) -> __CharacterSetStorage {
80
80
switch _backing {
81
81
case . immutable( let cs) :
82
82
return __CharacterSetStorage ( mutableReference: CFCharacterSetCreateMutableCopy ( nil , cs) )
@@ -88,7 +88,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
88
88
89
89
// MARK: Immutable Functions
90
90
91
- fileprivate var bitmapRepresentation : Data {
91
+ var bitmapRepresentation : Data {
92
92
switch _backing {
93
93
case . immutable( let cs) :
94
94
return CFCharacterSetCreateBitmapRepresentation ( nil , cs) as Data
@@ -97,7 +97,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
97
97
}
98
98
}
99
99
100
- fileprivate func hasMember( inPlane plane: UInt8 ) -> Bool {
100
+ func hasMember( inPlane plane: UInt8 ) -> Bool {
101
101
switch _backing {
102
102
case . immutable( let cs) :
103
103
return CFCharacterSetHasMemberInPlane ( cs, CFIndex ( plane) )
@@ -108,7 +108,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
108
108
109
109
// MARK: Mutable functions
110
110
111
- fileprivate func insert( charactersIn range: Range < Unicode . Scalar > ) {
111
+ func insert( charactersIn range: Range < Unicode . Scalar > ) {
112
112
switch _backing {
113
113
case . immutable( let cs) :
114
114
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -119,7 +119,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
119
119
}
120
120
}
121
121
122
- fileprivate func insert( charactersIn range: ClosedRange < Unicode . Scalar > ) {
122
+ func insert( charactersIn range: ClosedRange < Unicode . Scalar > ) {
123
123
switch _backing {
124
124
case . immutable( let cs) :
125
125
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -130,7 +130,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
130
130
}
131
131
}
132
132
133
- fileprivate func remove( charactersIn range: Range < Unicode . Scalar > ) {
133
+ func remove( charactersIn range: Range < Unicode . Scalar > ) {
134
134
switch _backing {
135
135
case . immutable( let cs) :
136
136
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -141,7 +141,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
141
141
}
142
142
}
143
143
144
- fileprivate func remove( charactersIn range: ClosedRange < Unicode . Scalar > ) {
144
+ func remove( charactersIn range: ClosedRange < Unicode . Scalar > ) {
145
145
switch _backing {
146
146
case . immutable( let cs) :
147
147
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -152,7 +152,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
152
152
}
153
153
}
154
154
155
- fileprivate func insert( charactersIn string: String ) {
155
+ func insert( charactersIn string: String ) {
156
156
switch _backing {
157
157
case . immutable( let cs) :
158
158
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -163,7 +163,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
163
163
}
164
164
}
165
165
166
- fileprivate func remove( charactersIn string: String ) {
166
+ func remove( charactersIn string: String ) {
167
167
switch _backing {
168
168
case . immutable( let cs) :
169
169
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -174,7 +174,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
174
174
}
175
175
}
176
176
177
- fileprivate func invert( ) {
177
+ func invert( ) {
178
178
switch _backing {
179
179
case . immutable( let cs) :
180
180
let r = CFCharacterSetCreateMutableCopy ( nil , cs) !
@@ -187,31 +187,31 @@ fileprivate final class __CharacterSetStorage : Hashable {
187
187
188
188
// -----
189
189
// MARK: -
190
- // MARK: SetAlgebraType
190
+ // MARK: SetAlgebra
191
191
192
192
@discardableResult
193
- fileprivate func insert( _ character: Unicode . Scalar ) -> ( inserted: Bool , memberAfterInsert: Unicode . Scalar ) {
193
+ func insert( _ character: Unicode . Scalar ) -> ( inserted: Bool , memberAfterInsert: Unicode . Scalar ) {
194
194
insert ( charactersIn: character... character)
195
195
// TODO: This should probably return the truth, but figuring it out requires two calls into NSCharacterSet
196
196
return ( true , character)
197
197
}
198
198
199
199
@discardableResult
200
- fileprivate func update( with character: Unicode . Scalar ) -> Unicode . Scalar ? {
200
+ func update( with character: Unicode . Scalar ) -> Unicode . Scalar ? {
201
201
insert ( character)
202
202
// TODO: This should probably return the truth, but figuring it out requires two calls into NSCharacterSet
203
203
return character
204
204
}
205
205
206
206
@discardableResult
207
- fileprivate func remove( _ character: Unicode . Scalar ) -> Unicode . Scalar ? {
207
+ func remove( _ character: Unicode . Scalar ) -> Unicode . Scalar ? {
208
208
// TODO: Add method to CFCharacterSet to do this in one call
209
209
let result : Unicode . Scalar ? = contains ( character) ? character : nil
210
210
remove ( charactersIn: character... character)
211
211
return result
212
212
}
213
213
214
- fileprivate func contains( _ member: Unicode . Scalar ) -> Bool {
214
+ func contains( _ member: Unicode . Scalar ) -> Bool {
215
215
switch _backing {
216
216
case . immutable( let cs) :
217
217
return CFCharacterSetIsLongCharacterMember ( cs, member. value)
@@ -267,7 +267,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
267
267
268
268
}
269
269
270
- fileprivate var inverted : CharacterSet {
270
+ var inverted : CharacterSet {
271
271
switch _backing {
272
272
case . immutable( let cs) :
273
273
return CharacterSet ( _uncopiedStorage: __CharacterSetStorage ( immutableReference: CFCharacterSetCreateInvertedSet ( nil , cs) ) )
@@ -277,40 +277,40 @@ fileprivate final class __CharacterSetStorage : Hashable {
277
277
}
278
278
}
279
279
280
- fileprivate func union( _ other: __CharacterSetStorage ) -> CharacterSet {
280
+ func union( _ other: __CharacterSetStorage ) -> CharacterSet {
281
281
return __CharacterSetStorage. _apply ( self , other, CFCharacterSetUnion)
282
282
}
283
283
284
- fileprivate func formUnion( _ other: __CharacterSetStorage ) {
284
+ func formUnion( _ other: __CharacterSetStorage ) {
285
285
_applyMutation ( other, CFCharacterSetUnion)
286
286
}
287
287
288
- fileprivate func intersection( _ other: __CharacterSetStorage ) -> CharacterSet {
288
+ func intersection( _ other: __CharacterSetStorage ) -> CharacterSet {
289
289
return __CharacterSetStorage. _apply ( self , other, CFCharacterSetIntersect)
290
290
}
291
291
292
- fileprivate func formIntersection( _ other: __CharacterSetStorage ) {
292
+ func formIntersection( _ other: __CharacterSetStorage ) {
293
293
_applyMutation ( other, CFCharacterSetIntersect)
294
294
}
295
295
296
- fileprivate func subtracting( _ other: __CharacterSetStorage ) -> CharacterSet {
296
+ func subtracting( _ other: __CharacterSetStorage ) -> CharacterSet {
297
297
return intersection ( other. inverted. _storage)
298
298
}
299
299
300
- fileprivate func subtract( _ other: __CharacterSetStorage ) {
300
+ func subtract( _ other: __CharacterSetStorage ) {
301
301
_applyMutation ( other. inverted. _storage, CFCharacterSetIntersect)
302
302
}
303
303
304
- fileprivate func symmetricDifference( _ other: __CharacterSetStorage ) -> CharacterSet {
304
+ func symmetricDifference( _ other: __CharacterSetStorage ) -> CharacterSet {
305
305
return union ( other) . subtracting ( intersection ( other) )
306
306
}
307
307
308
- fileprivate func formSymmetricDifference( _ other: __CharacterSetStorage ) {
308
+ func formSymmetricDifference( _ other: __CharacterSetStorage ) {
309
309
// This feels like cheating
310
310
_backing = symmetricDifference ( other) . _storage. _backing
311
311
}
312
312
313
- fileprivate func isSuperset( of other: __CharacterSetStorage ) -> Bool {
313
+ func isSuperset( of other: __CharacterSetStorage ) -> Bool {
314
314
switch _backing {
315
315
case . immutable( let cs) :
316
316
switch other. _backing {
@@ -331,7 +331,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
331
331
332
332
// MARK: -
333
333
334
- fileprivate var description : String {
334
+ var description : String {
335
335
switch _backing {
336
336
case . immutable( let cs) :
337
337
return CFCopyDescription ( cs) as String
@@ -340,7 +340,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
340
340
}
341
341
}
342
342
343
- fileprivate var debugDescription : String {
343
+ var debugDescription : String {
344
344
return description
345
345
}
346
346
@@ -366,7 +366,7 @@ fileprivate final class __CharacterSetStorage : Hashable {
366
366
public struct CharacterSet : ReferenceConvertible , Equatable , Hashable , SetAlgebra {
367
367
public typealias ReferenceType = NSCharacterSet
368
368
369
- fileprivate var _storage : __CharacterSetStorage
369
+ fileprivate var _storage : __CharacterSetStorage
370
370
371
371
// MARK: Init methods
372
372
@@ -418,19 +418,19 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
418
418
}
419
419
}
420
420
421
- fileprivate init ( _bridged characterSet: __shared NSCharacterSet) {
421
+ private init ( _bridged characterSet: __shared NSCharacterSet) {
422
422
_storage = __CharacterSetStorage ( immutableReference: characterSet. copy ( ) as! CFCharacterSet )
423
423
}
424
424
425
- fileprivate init ( _uncopiedImmutableReference characterSet: CFCharacterSet ) {
425
+ private init ( _uncopiedImmutableReference characterSet: CFCharacterSet ) {
426
426
_storage = __CharacterSetStorage ( immutableReference: characterSet)
427
427
}
428
428
429
- fileprivate init ( _uncopiedStorage : __CharacterSetStorage ) {
429
+ fileprivate init ( _uncopiedStorage: __CharacterSetStorage ) {
430
430
_storage = _uncopiedStorage
431
431
}
432
432
433
- fileprivate init ( _builtIn: __shared CFCharacterSetPredefinedSet) {
433
+ private init ( _builtIn: __shared CFCharacterSetPredefinedSet) {
434
434
_storage = __CharacterSetStorage ( immutableReference: CFCharacterSetGetPredefined ( _builtIn) )
435
435
}
436
436
@@ -657,7 +657,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
657
657
658
658
// -----
659
659
// MARK: -
660
- // MARK: SetAlgebraType
660
+ // MARK: SetAlgebra
661
661
662
662
/// Insert a `Unicode.Scalar` representation of a character into the `CharacterSet`.
663
663
///
0 commit comments