summaryrefslogtreecommitdiff
path: root/swift/src/Ice/PropertiesAdminI.swift
blob: eb3304f7bc68451d9cd46d52d80f9b4ea608c02f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

import IceImpl

class PropertiesAdminI: LocalObject<ICEPropertiesAdmin>, PropertiesAdmin, NativePropertiesAdmin {
    private let communicator: Communicator

    init(communicator: Communicator, handle: ICEPropertiesAdmin) {
        self.communicator = communicator
        super.init(handle: handle)
    }

    func getProperty(key: Swift.String, current _: Current) throws -> Swift.String {
        return try autoreleasepool {
            try handle.getProperty(key)
        }
    }

    func getPropertiesForPrefix(prefix: Swift.String, current _: Current) throws -> PropertyDict {
        return try autoreleasepool {
            try handle.getPropertiesForPrefix(prefix)
        }
    }

    func setProperties(newProperties: PropertyDict, current _: Current) throws {
        try autoreleasepool {
            try handle.setProperties(newProperties)
        }
    }

    func addUpdateCallback(_ cb: @escaping PropertiesAdminUpdateCallback) -> PropertiesAdminRemoveCallback {
        return handle.addUpdateCallback { (props: PropertyDict) in
            cb(props)
        }
    }
}