Skip to content

Commit

Permalink
Swift cleanup (#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Jun 5, 2024
1 parent 6f87143 commit 63fa33b
Show file tree
Hide file tree
Showing 282 changed files with 947 additions and 1,768 deletions.
5 changes: 1 addition & 4 deletions swift/src/Glacier2/Glacier2Swift.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

// Copyright (c) ZeroC, Inc.
#import <Cocoa/Cocoa.h>

FOUNDATION_EXPORT double Glacier2VersionNumber;
Expand Down
4 changes: 1 addition & 3 deletions swift/src/Ice/Blobject.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
// Copyright (c) ZeroC, Inc.

import Foundation
import PromiseKit
Expand Down
4 changes: 1 addition & 3 deletions swift/src/Ice/BlobjectAsync.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
// Copyright (c) ZeroC, Inc.

import Foundation
import PromiseKit
Expand Down
4 changes: 1 addition & 3 deletions swift/src/Ice/ClassResolver.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
// Copyright (c) ZeroC, Inc.

import Foundation

Expand Down
142 changes: 30 additions & 112 deletions swift/src/Ice/Communicator.swift
Original file line number Diff line number Diff line change
@@ -1,93 +1,11 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
//
// Ice version 3.7.10
//
// <auto-generated>
//
// Generated from file `Communicator.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
// Copyright (c) ZeroC, Inc.

import Foundation
import PromiseKit

/// The output mode for xxxToString method such as identityToString and proxyToString. The actual encoding format for
/// the string is the same for all modes: you don't need to specify an encoding format or mode when reading such a
/// string.
public enum ToStringMode: Swift.UInt8 {
/// Unicode Characters with ordinal values greater than 127 are kept as-is in the resulting string. Non-printable
/// ASCII characters with ordinal values 127 and below are encoded as \\t, \\n (etc.) or \\unnnn.
case Unicode = 0
/// ASCII Characters with ordinal values greater than 127 are encoded as universal character names in the resulting
/// string: \\unnnn for BMP characters and \\Unnnnnnnn for non-BMP characters. Non-printable ASCII characters
/// with ordinal values 127 and below are encoded as \\t, \\n (etc.) or \\unnnn.
case ASCII = 1
/// Compat Characters with ordinal values greater than 127 are encoded as a sequence of UTF-8 bytes using octal
/// escapes.
/// Characters with ordinal values 127 and below are encoded as \\t, \\n (etc.) or an octal escape. Use this mode
/// to generate strings compatible with Ice 3.6 and earlier.
case Compat = 2
public init() {
self = .Unicode
}
}

/// An `Ice.InputStream` extension to read `ToStringMode` enumerated values from the stream.
extension InputStream {
/// Read an enumerated value.
///
/// - returns: `ToStringMode` - The enumarated value.
public func read() throws -> ToStringMode {
let rawValue: Swift.UInt8 = try read(enumMaxValue: 2)
guard let val = ToStringMode(rawValue: rawValue) else {
throw MarshalException(reason: "invalid enum value")
}
return val
}

/// Read an optional enumerated value from the stream.
///
/// - parameter tag: `Int32` - The numeric tag associated with the value.
///
/// - returns: `ToStringMode` - The enumerated value.
public func read(tag: Swift.Int32) throws -> ToStringMode? {
guard try readOptional(tag: tag, expectedFormat: .Size) else {
return nil
}
return try read() as ToStringMode
}
}

/// An `Ice.OutputStream` extension to write `ToStringMode` enumerated values to the stream.
extension OutputStream {
/// Writes an enumerated value to the stream.
///
/// parameter _: `ToStringMode` - The enumerator to write.
public func write(_ v: ToStringMode) {
write(enum: v.rawValue, maxValue: 2)
}

/// Writes an optional enumerated value to the stream.
///
/// parameter tag: `Int32` - The numeric tag associated with the value.
///
/// parameter _: `ToStringMode` - The enumerator to write.
public func write(tag: Swift.Int32, value: ToStringMode?) {
guard let v = value else {
return
}
write(tag: tag, val: v.rawValue, maxValue: 2)
}
}

/// The central object in Ice. One or more communicators can be instantiated for an Ice application. Communicator
/// instantiation is language-specific, and not specified in Slice code.
public protocol Communicator: Swift.AnyObject {
public protocol Communicator: AnyObject {
/// Destroy the communicator. This operation calls shutdown implicitly. Calling destroy cleans up
/// memory, and shuts down this communicator's client functionality and destroys all object adapters. Subsequent
/// calls to destroy are ignored.
Expand All @@ -111,8 +29,8 @@ public protocol Communicator: Swift.AnyObject {

/// Check whether communicator has been shut down.
///
/// - returns: `Swift.Bool` - True if the communicator has been shut down; false otherwise.
func isShutdown() -> Swift.Bool
/// - returns: `Bool` - True if the communicator has been shut down; false otherwise.
func isShutdown() -> Bool

/// Convert a stringified proxy into a proxy.
/// For example, MyCategory/MyObject:tcp -h some_host -p 10000 creates a proxy that refers to the Ice
Expand All @@ -121,44 +39,44 @@ public protocol Communicator: Swift.AnyObject {
/// ProxyParseException, EndpointParseException, or IdentityParseException. Refer to the Ice manual for a detailed
/// description of the syntax supported by stringified proxies.
///
/// - parameter _: `Swift.String` The stringified proxy to convert into a proxy.
/// - parameter _: `String` The stringified proxy to convert into a proxy.
///
/// - returns: `ObjectPrx?` - The proxy, or nil if str is an empty string.
func stringToProxy(_ str: Swift.String) throws -> ObjectPrx?
func stringToProxy(_ str: String) throws -> ObjectPrx?

/// Convert a proxy into a string.
///
/// - parameter _: `ObjectPrx?` The proxy to convert into a stringified proxy.
///
/// - returns: `Swift.String` - The stringified proxy, or an empty string if
/// - returns: `String` - The stringified proxy, or an empty string if
/// obj is nil.
func proxyToString(_ obj: ObjectPrx?) -> Swift.String
func proxyToString(_ obj: ObjectPrx?) -> String

/// Convert a set of proxy properties into a proxy. The "base" name supplied in the property argument
/// refers to a property containing a stringified proxy, such as MyProxy=id:tcp -h localhost -p 10000.
/// Additional properties configure local settings for the proxy, such as MyProxy.PreferSecure=1. The
/// "Properties" appendix in the Ice manual describes each of the supported proxy properties.
///
/// - parameter _: `Swift.String` The base property name.
/// - parameter _: `String` The base property name.
///
/// - returns: `ObjectPrx?` - The proxy.
func propertyToProxy(_ property: Swift.String) throws -> ObjectPrx?
func propertyToProxy(_ property: String) throws -> ObjectPrx?

/// Convert a proxy to a set of proxy properties.
///
/// - parameter proxy: `ObjectPrx` The proxy.
///
/// - parameter property: `Swift.String` The base property name.
/// - parameter property: `String` The base property name.
///
/// - returns: `PropertyDict` - The property set.
func proxyToProperty(proxy: ObjectPrx, property: Swift.String) -> PropertyDict
func proxyToProperty(proxy: ObjectPrx, property: String) -> PropertyDict

/// Convert an identity into a string.
///
/// - parameter _: `Identity` The identity to convert into a string.
///
/// - returns: `Swift.String` - The "stringified" identity.
func identityToString(_ ident: Identity) -> Swift.String
/// - returns: `String` - The "stringified" identity.
func identityToString(_ ident: Identity) -> String

/// Create a new object adapter. The endpoints for the object adapter are taken from the property
/// name.Endpoints.
Expand All @@ -167,33 +85,33 @@ public protocol Communicator: Swift.AnyObject {
/// by the adapter. Attempts to create a named object adapter for which no configuration can be found raise
/// InitializationException.
///
/// - parameter _: `Swift.String` The object adapter name.
/// - parameter _: `String` The object adapter name.
///
/// - returns: `ObjectAdapter` - The new object adapter.
func createObjectAdapter(_ name: Swift.String) throws -> ObjectAdapter
func createObjectAdapter(_ name: String) throws -> ObjectAdapter

/// Create a new object adapter with endpoints. This operation sets the property
/// name.Endpoints, and then calls createObjectAdapter. It is provided as a
/// convenience function. Calling this operation with an empty name will result in a UUID being generated for the
/// name.
///
/// - parameter name: `Swift.String` The object adapter name.
/// - parameter name: `String` The object adapter name.
///
/// - parameter endpoints: `Swift.String` The endpoints for the object adapter.
/// - parameter endpoints: `String` The endpoints for the object adapter.
///
/// - returns: `ObjectAdapter` - The new object adapter.
func createObjectAdapterWithEndpoints(name: Swift.String, endpoints: Swift.String) throws
func createObjectAdapterWithEndpoints(name: String, endpoints: String) throws
-> ObjectAdapter

/// Create a new object adapter with a router. This operation creates a routed object adapter.
/// Calling this operation with an empty name will result in a UUID being generated for the name.
///
/// - parameter name: `Swift.String` The object adapter name.
/// - parameter name: `String` The object adapter name.
///
/// - parameter rtr: `RouterPrx` The router.
///
/// - returns: `ObjectAdapter` - The new object adapter.
func createObjectAdapterWithRouter(name: Swift.String, rtr: RouterPrx) throws -> ObjectAdapter
func createObjectAdapterWithRouter(name: String, rtr: RouterPrx) throws -> ObjectAdapter

/// Get the implicit context associated with this communicator.
///
Expand Down Expand Up @@ -265,15 +183,15 @@ public protocol Communicator: Swift.AnyObject {
/// - parameter sentFlags: `Dispatch.DispatchWorkItemFlags?` - Optional dispatch flags used
/// to dispatch the sent callback
///
/// - parameter sent: `((Swift.Bool) -> Swift.Void)` - Optional sent callback.
/// - parameter sent: `((Bool) -> Void)` - Optional sent callback.
///
/// - returns: `PromiseKit.Promise<>` - The result of the operation
func flushBatchRequestsAsync(
_ compress: CompressBatch,
sentOn: Dispatch.DispatchQueue?,
sentFlags: Dispatch.DispatchWorkItemFlags?,
sent: ((Swift.Bool) -> Swift.Void)?
) -> PromiseKit.Promise<Swift.Void>
sent: ((Bool) -> Void)?
) -> PromiseKit.Promise<Void>

/// Add the Admin object with all its facets to the provided object adapter. If Ice.Admin.ServerId is
/// set and the provided object adapter has a Locator, createAdmin registers the Admin's Process facet with
Expand Down Expand Up @@ -303,25 +221,25 @@ public protocol Communicator: Swift.AnyObject {
///
/// - parameter servant: `Dispatcher` The servant that implements the new Admin facet.
///
/// - parameter facet: `Swift.String` The name of the new Admin facet.
func addAdminFacet(servant: Dispatcher, facet: Swift.String) throws
/// - parameter facet: `String` The name of the new Admin facet.
func addAdminFacet(servant: Dispatcher, facet: String) throws

/// Remove the following facet to the Admin object. Removing a facet that was not previously registered throws
/// NotRegisteredException.
///
/// - parameter _: `Swift.String` The name of the Admin facet.
/// - parameter _: `String` The name of the Admin facet.
///
/// - returns: `Dispatcher` - The servant associated with this Admin facet.
@discardableResult
func removeAdminFacet(_ facet: Swift.String) throws -> Dispatcher
func removeAdminFacet(_ facet: String) throws -> Dispatcher

/// Returns a facet of the Admin object.
///
/// - parameter _: `Swift.String` The name of the Admin facet.
/// - parameter _: `String` The name of the Admin facet.
///
/// - returns: `Dispatcher?` - The servant associated with this Admin facet, or null if no facet is registered with the
/// given name.
func findAdminFacet(_ facet: Swift.String) -> Dispatcher?
func findAdminFacet(_ facet: String) -> Dispatcher?

/// Returns a map of all facets of the Admin object.
///
Expand Down
4 changes: 1 addition & 3 deletions swift/src/Ice/CommunicatorI.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
// Copyright (c) ZeroC, Inc.

import IceImpl
import PromiseKit
Expand Down
Loading

0 comments on commit 63fa33b

Please sign in to comment.