-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from qutheory/fluent-7
fluent 7 + driver cleanup
- Loading branch information
Showing
39 changed files
with
469 additions
and
445 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
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
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 |
---|---|---|
@@ -1,34 +1,35 @@ | ||
public class Console { | ||
public init(driver: ConsoleDriver) { | ||
self.driver = driver | ||
} | ||
|
||
let driver: ConsoleDriver | ||
|
||
public enum Style { | ||
case plain | ||
case info | ||
case warning | ||
case error | ||
case custom(Color) | ||
} | ||
/** | ||
Objects capable of sending output to | ||
and receiving input from a console can | ||
conform to this protocol to power the Console. | ||
*/ | ||
public protocol Console { | ||
func output(_ string: String, style: ConsoleStyle, newLine: Bool) | ||
func input() -> String | ||
} | ||
|
||
public enum Color { | ||
case black | ||
case red | ||
case green | ||
case yellow | ||
case blue | ||
case magenta | ||
case cyan | ||
case white | ||
} | ||
public enum ConsoleStyle { | ||
case plain | ||
case info | ||
case warning | ||
case error | ||
case success | ||
case custom(ConsoleColor) | ||
} | ||
|
||
public func output(_ string: String, style: Console.Style = .plain, newLine: Bool = true) { | ||
driver.output(string, style: style, newLine: newLine) | ||
} | ||
public enum ConsoleColor { | ||
case black | ||
case red | ||
case green | ||
case yellow | ||
case blue | ||
case magenta | ||
case cyan | ||
case white | ||
} | ||
|
||
public func input() -> String { | ||
return driver.input() | ||
extension Console { | ||
public func output(_ string: String, style: ConsoleStyle = .plain, newLine: Bool = true) { | ||
output(string, style: style, newLine: newLine) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +0,0 @@ | ||
/** | ||
Objects capable of sending output to | ||
and receiving input from a console can | ||
conform to this protocol to power the Console. | ||
*/ | ||
public protocol ConsoleDriver { | ||
func output(_ string: String, style: Console.Style, newLine: Bool) | ||
func input() -> String | ||
} | ||
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
Oops, something went wrong.