This repository has been archived by the owner on Apr 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract constants into separate files.
- Loading branch information
Showing
5 changed files
with
90 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// DispatchIOConstants.swift | ||
// DispatchKit <https://github.com/anpol/DispatchKit> | ||
// | ||
// Copyright (c) 2014 Andrei Polushin. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum DKDispatchIOType { | ||
|
||
case Stream, | ||
Random | ||
|
||
public var rawValue: dispatch_io_type_t { | ||
switch self { | ||
case .Stream: | ||
return DISPATCH_IO_STREAM | ||
case .Random: | ||
return DISPATCH_IO_RANDOM | ||
} | ||
} | ||
|
||
} | ||
|
||
public struct DKDispatchIOCloseFlags: OptionSetType { | ||
|
||
public typealias RawValue = dispatch_io_close_flags_t | ||
public let rawValue: RawValue | ||
public init(rawValue: dispatch_io_close_flags_t) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
public static let Unspecified = DKDispatchIOCloseFlags(rawValue: 0) | ||
public static let Stop = DKDispatchIOCloseFlags(rawValue: DISPATCH_IO_STOP) | ||
|
||
} | ||
|
||
|
||
|
||
public struct DKDispatchIOIntervalFlags: OptionSetType { | ||
|
||
public typealias RawValue = dispatch_io_interval_flags_t | ||
public let rawValue: RawValue | ||
public init(rawValue: RawValue) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
public static let Unspecified = DKDispatchIOIntervalFlags(rawValue: 0) | ||
public static let Strict = DKDispatchIOIntervalFlags(rawValue: DISPATCH_IO_STRICT_INTERVAL) | ||
|
||
} | ||
|
||
public typealias DispatchIOType = DKDispatchIOType | ||
public typealias DispatchIOCloseFlags = DKDispatchIOCloseFlags | ||
public typealias DispatchIOIntervalFlags = DKDispatchIOIntervalFlags |
16 changes: 15 additions & 1 deletion
16
Sources/DispatchQOSClass.swift → Sources/DispatchQueueConstants.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/DispatchSourceType.swift → Sources/DispatchSourceConstants.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters