Functions
The following functions are available globally.
-
Wrapper for POSIX
getopt()
to return a Swift tuple. Returnsnil
if thegetopt()
returned -1, otherwise returns a tuple of the option character with an optional argumentDeclaration
Swift
public func get_opt(_ options: String) -> (Character, String?)?
-
return setter/getter pairs from a list of methods
Declaration
Swift
public func getterSetterPairs(for allMethods: [GIR.Method]) -> [GetterSetterPair]
-
SwiftDoc representation of comments
Declaration
Swift
public func commentCode(_ thing: GIR.Thing, indentation: String = "") -> String
-
Swift representation of deprecation
Declaration
Swift
public func deprecatedCode(_ thing: GIR.Thing, indentation: String) -> String?
-
Swift code representation with code following the comments
Declaration
Swift
public func swiftCode(_ thing: GIR.Thing, _ postfix: String = "", indentation: String = "") -> String
-
Swift code representation of a type alias
Declaration
Swift
public func swiftCode(alias: GIR.Alias) -> String
-
Swift code representation of a callback as a type alias
Declaration
Swift
public func swiftCallbackAliasCode(callback: GIR.Callback) -> String
-
Swift code representation of a constant
Declaration
Swift
public func swiftCode(constant: GIR.Constant) -> String
-
Swift code type alias representation of an enum
Declaration
Swift
public func typeAlias(_ e: GIR.Enumeration) -> String
-
Swift code representation of an enum
Declaration
Swift
public func swiftCode(_ e: GIR.Enumeration) -> String
-
Swift code representation of an enum value
Declaration
Swift
public func valueCode(_ indentation: String) -> (GIR.Enumeration.Member) -> String
-
Swift protocol representation of a record/class as a wrapper of a pointer
Declaration
Swift
public func recordProtocolCode(_ e: GIR.Record, parent: String, indentation: String = " ", ptr: String = "ptr") -> String
-
Default implementation for record methods as protocol extension
Declaration
-
Default implementation for functions
Declaration
Swift
public func functionCode(_ f: GIR.Function, indentation: String = " ", initialIndentation i: String = "") -> String
-
Swift code for methods (with a given indentation)
Declaration
-
Swift code for computed properties
Declaration
Swift
public func computedPropertyCode(_ indentation: String, record: GIR.Record, publicDesignation: String = "public ", ptr ptrName: String = "ptr") -> (GetterSetterPair) -> String
-
Swift code for convenience constructors
Declaration
-
Return the return type of a method,
Declaration
-
Return code declaration for functions/methods/convenience constructors
Declaration
-
Return code for functions/methods/convenience constructors
Declaration
-
Swift code for calling the underlying function and assigning the raw return value
Declaration
-
Swift code for calling the underlying setter function and assigning the raw return value
Declaration
-
Swift code for the parameters of a constructor
Declaration
Swift
public func constructorParam(_ method: GIR.Method, prefix: String?) -> String
-
Swift code for constructor first argument prefix extracted from a method name
Declaration
Swift
public func constructorPrefix(_ method: GIR.Method) -> String?
-
Swift code for auto-prefixed arguments
Declaration
Swift
public func codeFor(argument a: GIR.Argument) -> String
-
Swift code for methods
Declaration
Swift
public func codeFor(argument a: GIR.Argument, prefix: String) -> String
-
Swift code for passing an argument to a free standing function
Declaration
Swift
public func toSwift(_ arg: GIR.Argument, ptr: String = "ptr") -> String
-
Swift code for passing a setter to a method of a record / class
Declaration
-
Swift code for signal names without prefixes
Declaration
Swift
public func signalNameCode(indentation indent: String, convertName: @escaping (String) -> String = { $0.camelSignal }) -> (GIR.CType) -> String
-
Swift code for signal names with prefixes
Declaration
Swift
public func signalNameCode(indentation indent: String, prefixes: (String, String), convertName: @escaping (String) -> String = { $0.camelSignalComponent }) -> (GIR.CType) -> String
-
Swift struct representation of a record/class as a wrapper of a pointer
Declaration
Swift
public func recordStructCode(_ e: GIR.Record, indentation: String = " ", ptr: String = "ptr") -> String
-
Swift struct representation of a record/class as a wrapper of a pointer
Declaration
Swift
public func recordClassCode(_ e: GIR.Record, parent: String, indentation: String = " ", ptr: String = "ptr") -> String
-
Swift code representation of a record
Declaration
-
Swift code representation of a free standing function
Declaration
Swift
public func swiftCode(_ f: GIR.Function) -> String
-
Comparator to check whether two
Thing
s are equalParameters
lhs
Thing
to comparerhs
Thing
to compare with -
Comparator to check the ordering of two
Thing
sParameters
lhs
first
Thing
to comparerhs
second
Thing
to compare
-
Convert the given String to SwiftDoc
Declaration
Swift
public func gtkDoc2SwiftDoc(_ gtkDoc: String, linePrefix: String = "/// ") -> String
Parameters
gtkDoc
String in
gtk-doc
formatlinePrefix
string to prefix each line with (e.g. indentation and/or
///
)Return Value
String in SwiftDoc format
-
memory map the given file with the given protection and flags, then call the
process
function with the memory address of the mapped fileDeclaration
Swift
public func with_mmap(_ file: String, protection: Int32 = PROT_READ, flags: Int32 = MAP_PRIVATE, process: (UnsafeMutableRawPointer, Int) -> Void)
Parameters
file
Name of the file to
open()
andmmap()
protection
memory protection flags to use
flags
memory mapping flags to use
process
callback for processing the content of the file while memory mapped
-
memory map the given file to an unsafe buffer pointer then call the
process
function with the memory address of the mapped fileDeclaration
Swift
public func with_mmap<Element>(_ file: String, protection p: Int32 = PROT_READ, flags f: Int32 = MAP_PRIVATE, process: (UnsafeBufferPointer<Element>) -> Void)
Parameters
file
Name of the file to
open()
andmmap()
to memory pointing to the givenElement
typep
memory protection flags to use
f
memory mapping flags to use
process
callback for processing the content of the file while memory mapped and bound to
Element