Skip to content

NSData options should typealias to Data options #4968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 5 additions & 41 deletions Sources/Foundation/NSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,11 @@ import Dispatch
#endif

extension NSData {
public struct ReadingOptions : OptionSet {
public let rawValue : UInt
public init(rawValue: UInt) { self.rawValue = rawValue }

public static let mappedIfSafe = ReadingOptions(rawValue: UInt(1 << 0))
public static let uncached = ReadingOptions(rawValue: UInt(1 << 1))
public static let alwaysMapped = ReadingOptions(rawValue: UInt(1 << 2))
}

public struct WritingOptions : OptionSet {
public let rawValue : UInt
public init(rawValue: UInt) { self.rawValue = rawValue }

public static let atomic = WritingOptions(rawValue: UInt(1 << 0))
public static let withoutOverwriting = WritingOptions(rawValue: UInt(1 << 1))
}

public struct SearchOptions : OptionSet {
public let rawValue : UInt
public init(rawValue: UInt) { self.rawValue = rawValue }

public static let backwards = SearchOptions(rawValue: UInt(1 << 0))
public static let anchored = SearchOptions(rawValue: UInt(1 << 1))
}

public struct Base64EncodingOptions : OptionSet {
public let rawValue : UInt
public init(rawValue: UInt) { self.rawValue = rawValue }

public static let lineLength64Characters = Base64EncodingOptions(rawValue: UInt(1 << 0))
public static let lineLength76Characters = Base64EncodingOptions(rawValue: UInt(1 << 1))
public static let endLineWithCarriageReturn = Base64EncodingOptions(rawValue: UInt(1 << 4))
public static let endLineWithLineFeed = Base64EncodingOptions(rawValue: UInt(1 << 5))
}

public struct Base64DecodingOptions : OptionSet {
public let rawValue : UInt
public init(rawValue: UInt) { self.rawValue = rawValue }

public static let ignoreUnknownCharacters = Base64DecodingOptions(rawValue: UInt(1 << 0))
}
public typealias ReadingOptions = Data.ReadingOptions
public typealias WritingOptions = Data.WritingOptions
public typealias SearchOptions = Data.SearchOptions
public typealias Base64EncodingOptions = Data.Base64EncodingOptions
public typealias Base64DecodingOptions = Data.Base64DecodingOptions
}

private final class _NSDataDeallocator {
Expand Down