zeroc-ice 3.6.5 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ICE_LICENSE +17 -17
- data/LICENSE +12 -12
- data/bin/slice2rb +1 -6
- data/ext/Communicator.cpp +223 -61
- data/ext/Communicator.h +1 -6
- data/ext/Config.h +23 -7
- data/ext/Connection.cpp +108 -76
- data/ext/Connection.h +4 -6
- data/ext/Endpoint.cpp +16 -54
- data/ext/Endpoint.h +1 -6
- data/ext/ImplicitContext.cpp +1 -10
- data/ext/ImplicitContext.h +1 -6
- data/ext/Init.cpp +4 -6
- data/ext/Logger.cpp +1 -6
- data/ext/Logger.h +1 -6
- data/ext/Operation.cpp +38 -54
- data/ext/Operation.h +1 -6
- data/ext/Properties.cpp +3 -8
- data/ext/Properties.h +1 -6
- data/ext/Proxy.cpp +111 -70
- data/ext/Proxy.h +1 -6
- data/ext/Slice.cpp +5 -20
- data/ext/Slice.h +1 -6
- data/ext/Types.cpp +313 -224
- data/ext/Types.h +118 -71
- data/ext/Util.cpp +69 -36
- data/ext/Util.h +117 -42
- data/ext/ValueFactoryManager.cpp +440 -0
- data/ext/ValueFactoryManager.h +95 -0
- data/ext/extconf.rb +52 -48
- data/ext/ice/cpp/include/Ice/Application.h +275 -105
- data/ext/ice/cpp/include/Ice/AsyncResult.h +124 -337
- data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -7
- data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +39 -16
- data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -6
- data/ext/ice/cpp/include/Ice/Buffer.h +10 -15
- data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +56 -17
- data/ext/ice/cpp/include/Ice/Comparable.h +205 -0
- data/ext/ice/cpp/include/Ice/Config.h +16 -39
- data/ext/ice/cpp/include/Ice/ConnectionAsync.h +203 -16
- data/ext/ice/cpp/include/Ice/ConnectionIF.h +7 -6
- data/ext/ice/cpp/include/Ice/ConsoleUtil.h +23 -0
- data/ext/ice/cpp/include/Ice/DefaultValueFactory.h +57 -0
- data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +20 -12
- data/ext/ice/cpp/include/Ice/Dispatcher.h +35 -19
- data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -10
- data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -6
- data/ext/ice/cpp/include/Ice/Exception.h +110 -63
- data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +74 -0
- data/ext/ice/cpp/include/Ice/FactoryTable.h +22 -18
- data/ext/ice/cpp/include/Ice/FactoryTableInit.h +28 -31
- data/ext/ice/cpp/include/Ice/Format.h +17 -18
- data/ext/ice/cpp/include/Ice/Functional.h +38 -38
- data/ext/ice/cpp/include/Ice/GCObject.h +9 -10
- data/ext/ice/cpp/include/Ice/Handle.h +6 -16
- data/ext/ice/cpp/include/Ice/Ice.h +9 -10
- data/ext/ice/cpp/include/Ice/IconvStringConverter.h +377 -0
- data/ext/ice/cpp/include/Ice/Incoming.h +132 -38
- data/ext/ice/cpp/include/Ice/IncomingAsync.h +109 -31
- data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -6
- data/ext/ice/cpp/include/Ice/Initialize.h +872 -60
- data/ext/ice/cpp/include/Ice/InputStream.h +1514 -0
- data/ext/ice/cpp/include/Ice/InstanceF.h +1 -7
- data/ext/ice/cpp/include/Ice/InterfaceByValue.h +57 -0
- data/ext/ice/cpp/include/Ice/LocalObject.h +13 -14
- data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -6
- data/ext/ice/cpp/include/Ice/LoggerUtil.h +56 -24
- data/ext/ice/cpp/include/Ice/MetricsAdminI.h +124 -71
- data/ext/ice/cpp/include/Ice/MetricsFunctional.h +25 -10
- data/ext/ice/cpp/include/Ice/MetricsObserverI.h +116 -32
- data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +61 -30
- data/ext/ice/cpp/include/Ice/Object.h +413 -78
- data/ext/ice/cpp/include/Ice/ObjectF.h +12 -8
- data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -13
- data/ext/ice/cpp/include/Ice/Optional.h +1114 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +684 -89
- data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -11
- data/ext/ice/cpp/include/Ice/OutputStream.h +1092 -0
- data/ext/ice/cpp/include/Ice/Protocol.h +49 -17
- data/ext/ice/cpp/include/Ice/Proxy.h +3438 -745
- data/ext/ice/cpp/include/Ice/ProxyF.h +13 -38
- data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -6
- data/ext/ice/cpp/include/Ice/ProxyHandle.h +43 -55
- data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -6
- data/ext/ice/cpp/include/Ice/RegisterPlugins.h +84 -12
- data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -9
- data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -6
- data/ext/ice/cpp/include/Ice/SHA1.h +42 -0
- data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -6
- data/ext/ice/cpp/include/Ice/Service.h +273 -154
- data/ext/ice/cpp/include/Ice/SliceChecksums.h +5 -6
- data/ext/ice/cpp/include/Ice/SlicedData.h +121 -53
- data/ext/ice/cpp/include/Ice/SlicedDataF.h +17 -11
- data/ext/ice/cpp/include/Ice/StreamHelpers.h +453 -140
- data/ext/ice/cpp/include/Ice/StringConverter.h +78 -0
- data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -6
- data/ext/ice/cpp/include/Ice/UUID.h +19 -0
- data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +22 -28
- data/ext/ice/cpp/include/Ice/UniqueRef.h +97 -0
- data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +45 -13
- data/ext/ice/cpp/include/Ice/Value.h +139 -0
- data/ext/ice/cpp/include/Ice/ValueF.h +21 -0
- data/ext/ice/cpp/include/IceSSL/Config.h +8 -28
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -11
- data/ext/ice/cpp/include/IceSSL/OpenSSL.h +147 -0
- data/ext/ice/cpp/include/IceSSL/Plugin.h +461 -448
- data/ext/ice/cpp/include/IceSSL/SChannel.h +72 -0
- data/ext/ice/cpp/include/IceSSL/SecureTransport.h +72 -0
- data/ext/ice/cpp/include/IceSSL/UWP.h +62 -0
- data/ext/ice/cpp/include/IceUtil/Atomic.h +7 -14
- data/ext/ice/cpp/include/IceUtil/Cond.h +17 -23
- data/ext/ice/cpp/include/IceUtil/Config.h +166 -46
- data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +92 -0
- data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -10
- data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +63 -41
- data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +5 -13
- data/ext/ice/cpp/include/IceUtil/Exception.h +284 -75
- data/ext/ice/cpp/include/IceUtil/FileUtil.h +143 -0
- data/ext/ice/cpp/include/IceUtil/Functional.h +4 -6
- data/ext/ice/cpp/include/IceUtil/Handle.h +11 -16
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -15
- data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -8
- data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -7
- data/ext/ice/cpp/include/IceUtil/Lock.h +8 -15
- data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -7
- data/ext/ice/cpp/include/IceUtil/Mutex.h +19 -23
- data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -7
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -9
- data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -9
- data/ext/ice/cpp/include/IceUtil/Optional.h +134 -23
- data/ext/ice/cpp/include/IceUtil/Options.h +17 -23
- data/ext/ice/cpp/include/IceUtil/OutputUtil.h +61 -37
- data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -11
- data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +18 -15
- data/ext/ice/cpp/include/IceUtil/Random.h +39 -8
- data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -13
- data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +53 -0
- data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +10 -15
- data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -7
- data/ext/ice/cpp/include/IceUtil/Shared.h +5 -12
- data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -7
- data/ext/ice/cpp/include/IceUtil/StringConverter.h +146 -126
- data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -26
- data/ext/ice/cpp/include/IceUtil/Thread.h +10 -17
- data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -47
- data/ext/ice/cpp/include/IceUtil/Time.h +3 -8
- data/ext/ice/cpp/include/IceUtil/Timer.h +18 -18
- data/ext/ice/cpp/include/IceUtil/UUID.h +6 -7
- data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -6
- data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +170 -0
- data/ext/ice/cpp/include/generated/Ice/Communicator.h +1156 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +51 -16
- data/ext/ice/cpp/include/generated/Ice/Connection.h +1660 -0
- data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +119 -0
- data/ext/ice/cpp/include/generated/Ice/Current.h +322 -0
- data/ext/ice/cpp/include/generated/Ice/Endpoint.h +943 -0
- data/ext/ice/cpp/include/generated/Ice/EndpointF.h +166 -0
- data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +118 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +31 -15
- data/ext/ice/cpp/include/generated/Ice/Identity.h +264 -0
- data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +278 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +51 -16
- data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +1143 -0
- data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +128 -0
- data/ext/ice/cpp/include/generated/Ice/LocalException.h +7041 -0
- data/ext/ice/cpp/include/generated/Ice/Locator.h +3850 -0
- data/ext/ice/cpp/include/generated/Ice/LocatorF.h +147 -0
- data/ext/ice/cpp/include/generated/Ice/Logger.h +231 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +51 -16
- data/ext/ice/cpp/include/generated/Ice/Metrics.h +4717 -0
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +1175 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +51 -16
- data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +197 -0
- data/ext/ice/cpp/include/generated/Ice/Plugin.h +306 -0
- data/ext/ice/cpp/include/generated/Ice/PluginF.h +110 -0
- data/ext/ice/cpp/include/generated/Ice/Process.h +971 -0
- data/ext/ice/cpp/include/generated/Ice/ProcessF.h +125 -0
- data/ext/ice/cpp/include/generated/Ice/Properties.h +446 -0
- data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +1360 -0
- data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +134 -0
- data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +2689 -0
- data/ext/ice/cpp/include/generated/Ice/Router.h +1838 -0
- data/ext/ice/cpp/include/generated/Ice/RouterF.h +125 -0
- data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +299 -0
- data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +51 -16
- data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +34 -14
- data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +318 -0
- data/ext/ice/cpp/include/generated/Ice/Version.h +357 -0
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +223 -0
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +101 -0
- data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +181 -0
- data/ext/ice/cpp/src/Ice/ACM.cpp +38 -27
- data/ext/ice/cpp/src/Ice/ACM.h +9 -7
- data/ext/ice/cpp/src/Ice/ACMF.h +30 -0
- data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -6
- data/ext/ice/cpp/src/Ice/Acceptor.h +4 -8
- data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -6
- data/ext/ice/cpp/src/Ice/ArgVector.cpp +59 -0
- data/ext/ice/cpp/src/Ice/ArgVector.h +36 -0
- data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -544
- data/ext/ice/cpp/src/Ice/Base64.cpp +22 -28
- data/ext/ice/cpp/src/Ice/Base64.h +1 -6
- data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +41 -18
- data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -15
- data/ext/ice/cpp/src/Ice/Buffer.cpp +75 -18
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +21 -12
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +86 -197
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -23
- data/ext/ice/cpp/src/Ice/Communicator.cpp +43 -15
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +318 -117
- data/ext/ice/cpp/src/Ice/CommunicatorI.h +95 -40
- data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -8
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +55 -122
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +15 -31
- data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -7
- data/ext/ice/cpp/src/Ice/Connection.cpp +111 -20
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +300 -107
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +44 -28
- data/ext/ice/cpp/src/Ice/ConnectionFactoryF.h +30 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +785 -713
- data/ext/ice/cpp/src/Ice/ConnectionI.h +105 -80
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -20
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +5 -9
- data/ext/ice/cpp/src/Ice/Connector.cpp +6 -6
- data/ext/ice/cpp/src/Ice/Connector.h +4 -8
- data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -6
- data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -9
- data/ext/ice/cpp/src/Ice/Current.cpp +30 -12
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -16
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -6
- data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -6
- data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +13 -25
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +34 -28
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +107 -19
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -6
- data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -11
- data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -6
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +41 -36
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -9
- data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -6
- data/ext/ice/cpp/src/Ice/EndpointI.cpp +18 -7
- data/ext/ice/cpp/src/Ice/EndpointI.h +39 -18
- data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -10
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +19 -12
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -9
- data/ext/ice/cpp/src/Ice/EventHandler.h +13 -13
- data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -7
- data/ext/ice/cpp/src/Ice/Exception.cpp +102 -98
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +21 -12
- data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -33
- data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -9
- data/ext/ice/cpp/src/Ice/GCObject.cpp +29 -31
- data/ext/ice/cpp/src/Ice/HashUtil.h +3 -9
- data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -7
- data/ext/ice/cpp/src/Ice/HttpParser.h +1 -6
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +128 -111
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +23 -19
- data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -7
- data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +51 -0
- data/ext/ice/cpp/src/Ice/Identity.cpp +25 -16
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -13
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +11 -28
- data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -10
- data/ext/ice/cpp/src/Ice/Incoming.cpp +284 -255
- data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -214
- data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -9
- data/ext/ice/cpp/src/Ice/Initialize.cpp +309 -193
- data/ext/ice/cpp/src/Ice/InputStream.cpp +2726 -0
- data/ext/ice/cpp/src/Ice/Instance.cpp +243 -262
- data/ext/ice/cpp/src/Ice/Instance.h +30 -23
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +137 -23
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +118 -105
- data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -36
- data/ext/ice/cpp/src/Ice/LocalException.cpp +1191 -422
- data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -7
- data/ext/ice/cpp/src/Ice/Locator.cpp +1282 -1222
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +30 -12
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +150 -186
- data/ext/ice/cpp/src/Ice/LocatorInfo.h +31 -36
- data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -6
- data/ext/ice/cpp/src/Ice/Logger.cpp +39 -12
- data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +182 -88
- data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -9
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +26 -55
- data/ext/ice/cpp/src/Ice/LoggerI.h +7 -18
- data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -17
- data/ext/ice/cpp/src/Ice/Metrics.cpp +1280 -1107
- data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +58 -33
- data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -7
- data/ext/ice/cpp/src/Ice/Network.cpp +753 -408
- data/ext/ice/cpp/src/Ice/Network.h +99 -36
- data/ext/ice/cpp/src/Ice/NetworkF.h +2 -7
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +20 -19
- data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -7
- data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -6
- data/ext/ice/cpp/src/Ice/OSLogLoggerI.cpp +57 -0
- data/ext/ice/cpp/src/Ice/OSLogLoggerI.h +40 -0
- data/ext/ice/cpp/src/Ice/Object.cpp +227 -232
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +45 -13
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +83 -33
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -12
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +25 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +298 -191
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +44 -39
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -13
- data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -37
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +67 -67
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +15 -11
- data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +801 -366
- data/ext/ice/cpp/src/Ice/OutputStream.cpp +1367 -0
- data/ext/ice/cpp/src/Ice/Plugin.cpp +52 -14
- data/ext/ice/cpp/src/Ice/PluginF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +27 -51
- data/ext/ice/cpp/src/Ice/PluginManagerI.h +7 -13
- data/ext/ice/cpp/src/Ice/Process.cpp +294 -128
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +30 -12
- data/ext/ice/cpp/src/Ice/Properties.cpp +42 -15
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +382 -340
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +83 -24
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -10
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +30 -12
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +46 -57
- data/ext/ice/cpp/src/Ice/PropertiesI.h +18 -26
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +112 -19
- data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -7
- data/ext/ice/cpp/src/Ice/Protocol.cpp +6 -19
- data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -7
- data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -25
- data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -6
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -6
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -6
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -6
- data/ext/ice/cpp/src/Ice/Proxy.cpp +729 -957
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +33 -38
- data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -16
- data/ext/ice/cpp/src/Ice/Reference.cpp +190 -106
- data/ext/ice/cpp/src/Ice/Reference.h +39 -28
- data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +69 -118
- data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -17
- data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -6
- data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +19 -9
- data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -6
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +766 -565
- data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -6
- data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -8
- data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -18
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -11
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -7
- data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -11
- data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -12
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +12 -20
- data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -11
- data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -6
- data/ext/ice/cpp/src/Ice/Router.cpp +614 -492
- data/ext/ice/cpp/src/Ice/RouterF.cpp +30 -12
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +93 -99
- data/ext/ice/cpp/src/Ice/RouterInfo.h +42 -38
- data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -6
- data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +23 -28
- data/ext/ice/cpp/src/Ice/Selector.cpp +948 -855
- data/ext/ice/cpp/src/Ice/Selector.h +100 -152
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -13
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +28 -11
- data/ext/ice/cpp/src/Ice/ServantManager.cpp +24 -45
- data/ext/ice/cpp/src/Ice/ServantManager.h +1 -6
- data/ext/ice/cpp/src/Ice/SharedContext.h +2 -7
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +21 -12
- data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -7
- data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -25
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +208 -76
- data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -9
- data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +57 -22
- data/ext/ice/cpp/src/Ice/StringUtil.h +30 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +6 -7
- data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -8
- data/ext/ice/cpp/src/Ice/SystemdJournalI.cpp +66 -0
- data/ext/ice/cpp/src/Ice/SystemdJournalI.h +39 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +169 -49
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -10
- data/ext/ice/cpp/src/Ice/TcpConnector.cpp +6 -12
- data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -7
- data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +51 -46
- data/ext/ice/cpp/src/Ice/TcpEndpointI.h +12 -14
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +17 -32
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -15
- data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +41 -54
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +242 -274
- data/ext/ice/cpp/src/Ice/ThreadPool.h +46 -48
- data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +38 -26
- data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -7
- data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -6
- data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -7
- data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -36
- data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -11
- data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -7
- data/ext/ice/cpp/src/Ice/Transceiver.h +8 -12
- data/ext/ice/cpp/src/Ice/TransceiverF.h +3 -8
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +5 -13
- data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -7
- data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +118 -60
- data/ext/ice/cpp/src/Ice/UdpEndpointI.h +13 -10
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +177 -236
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -22
- data/ext/ice/cpp/src/Ice/Value.cpp +76 -0
- data/ext/ice/cpp/src/Ice/ValueFactory.cpp +83 -0
- data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +61 -0
- data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +37 -0
- data/ext/ice/cpp/src/Ice/Version.cpp +25 -20
- data/ext/ice/cpp/src/Ice/VirtualShared.h +38 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -14
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -12
- data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -16
- data/ext/ice/cpp/src/Ice/WSConnector.h +3 -11
- data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +188 -89
- data/ext/ice/cpp/src/Ice/WSEndpoint.h +22 -37
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +65 -66
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -27
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +596 -281
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1383 -543
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +89 -32
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -28
- data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -66
- data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -41
- data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -64
- data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -8
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +450 -172
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +863 -406
- data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +47 -0
- data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +636 -144
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +20 -173
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -22
- data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +279 -0
- data/ext/ice/cpp/src/IceSSL/CertificateI.h +64 -0
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -17
- data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +61 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +15 -64
- data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -18
- data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +207 -204
- data/ext/ice/cpp/src/IceSSL/EndpointI.h +43 -40
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +42 -16
- data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -11
- data/ext/ice/cpp/src/IceSSL/Instance.h +7 -12
- data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -12
- data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +583 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +134 -115
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +59 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +27 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +127 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +477 -182
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +32 -26
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +286 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +58 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -46
- data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -23
- data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -60
- data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -12
- data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +580 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +523 -74
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +123 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +31 -0
- data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +73 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +187 -221
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +24 -26
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +97 -94
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +26 -192
- data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -24
- data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +868 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +69 -201
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +59 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +29 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +75 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +174 -161
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +29 -33
- data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +864 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +45 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +12 -22
- data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -9
- data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -8
- data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +266 -0
- data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +338 -0
- data/ext/ice/cpp/src/IceSSL/UWPEngine.h +41 -0
- data/ext/ice/cpp/src/IceSSL/UWPEngineF.h +26 -0
- data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +89 -0
- data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +383 -0
- data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +71 -0
- data/ext/ice/cpp/src/IceSSL/Util.cpp +71 -1260
- data/ext/ice/cpp/src/IceSSL/Util.h +48 -142
- data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +157 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -27
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -31
- data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +22 -36
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +30 -126
- data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -6
- data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -6
- data/ext/ice/cpp/src/IceUtil/Options.cpp +20 -33
- data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +47 -21
- data/ext/ice/cpp/src/IceUtil/Random.cpp +15 -20
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +4 -19
- data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -8
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -269
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +582 -244
- data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -79
- data/ext/ice/cpp/src/IceUtil/Time.cpp +6 -11
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +17 -22
- data/ext/ice/cpp/src/IceUtil/Unicode.cpp +97 -101
- data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -40
- data/ext/ice/cpp/src/IceUtil/UtilException.cpp +839 -0
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +894 -234
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +72 -0
- data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -7
- data/ext/ice/cpp/src/Slice/Checksum.h +21 -0
- data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -83
- data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -14
- data/ext/ice/cpp/src/Slice/Grammar.cpp +1981 -1944
- data/ext/ice/cpp/src/Slice/Grammar.h +39 -19
- data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -20
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2752 -1948
- data/ext/ice/cpp/src/Slice/JavaUtil.h +398 -0
- data/ext/ice/cpp/src/Slice/MD5.cpp +1 -6
- data/ext/ice/cpp/src/Slice/MD5.h +1 -6
- data/ext/ice/cpp/src/Slice/MD5I.cpp +8 -1
- data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +17 -20
- data/ext/ice/cpp/src/Slice/PHPUtil.h +36 -0
- data/ext/ice/cpp/src/Slice/Parser.cpp +1190 -426
- data/ext/ice/cpp/{include → src}/Slice/Parser.h +143 -91
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +67 -36
- data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +8 -18
- data/ext/ice/cpp/src/Slice/Python.cpp +218 -111
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +787 -699
- data/ext/ice/cpp/src/Slice/PythonUtil.h +70 -0
- data/ext/ice/cpp/src/Slice/Ruby.cpp +42 -43
- data/ext/ice/cpp/src/Slice/RubyUtil.cpp +175 -445
- data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -11
- data/ext/ice/cpp/src/Slice/Scanner.cpp +390 -399
- data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +36 -69
- data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +456 -0
- data/ext/ice/cpp/src/Slice/Util.h +50 -0
- data/ice.gemspec +2 -9
- data/lib/Glacier2.rb +1 -6
- data/lib/Glacier2/Metrics.rb +6 -50
- data/lib/Glacier2/PermissionsVerifier.rb +23 -99
- data/lib/Glacier2/PermissionsVerifierF.rb +2 -7
- data/lib/Glacier2/Router.rb +31 -78
- data/lib/Glacier2/RouterF.rb +2 -7
- data/lib/Glacier2/SSLInfo.rb +3 -11
- data/lib/Glacier2/Session.rb +87 -311
- data/lib/Ice.rb +84 -58
- data/lib/Ice/BuiltinSequences.rb +3 -8
- data/lib/Ice/Communicator.rb +54 -61
- data/lib/Ice/CommunicatorF.rb +2 -7
- data/lib/Ice/Connection.rb +152 -166
- data/lib/Ice/ConnectionF.rb +2 -7
- data/lib/Ice/Current.rb +3 -15
- data/lib/Ice/Endpoint.rb +56 -137
- data/lib/Ice/EndpointF.rb +2 -7
- data/lib/Ice/EndpointTypes.rb +2 -11
- data/lib/Ice/FacetMap.rb +3 -8
- data/lib/Ice/Identity.rb +4 -12
- data/lib/Ice/ImplicitContext.rb +4 -38
- data/lib/Ice/ImplicitContextF.rb +2 -7
- data/lib/Ice/Instrumentation.rb +22 -279
- data/lib/Ice/InstrumentationF.rb +2 -7
- data/lib/Ice/LocalException.rb +94 -145
- data/lib/Ice/Locator.rb +50 -169
- data/lib/Ice/LocatorF.rb +2 -7
- data/lib/Ice/Logger.rb +4 -38
- data/lib/Ice/LoggerF.rb +2 -7
- data/lib/Ice/Metrics.rb +60 -420
- data/lib/Ice/ObjectAdapter.rb +29 -0
- data/lib/Ice/ObjectAdapterF.rb +2 -7
- data/lib/Ice/ObjectFactory.rb +4 -34
- data/lib/Ice/Plugin.rb +6 -64
- data/lib/Ice/PluginF.rb +2 -7
- data/lib/Ice/Process.rb +15 -56
- data/lib/Ice/ProcessF.rb +2 -7
- data/lib/Ice/Properties.rb +4 -45
- data/lib/Ice/PropertiesAdmin.rb +18 -60
- data/lib/Ice/PropertiesF.rb +2 -7
- data/lib/Ice/RemoteLogger.rb +33 -119
- data/lib/Ice/Router.rb +28 -105
- data/lib/Ice/RouterF.rb +2 -7
- data/lib/Ice/ServantLocator.rb +26 -0
- data/lib/Ice/ServantLocatorF.rb +24 -0
- data/lib/Ice/SliceChecksumDict.rb +2 -7
- data/lib/Ice/ValueFactory.rb +28 -0
- data/lib/Ice/Version.rb +4 -15
- data/lib/IceBox.rb +1 -6
- data/lib/IceBox/IceBox.rb +43 -152
- data/lib/IceGrid.rb +1 -9
- data/lib/IceGrid/Admin.rb +550 -431
- data/lib/IceGrid/Descriptor.rb +61 -533
- data/lib/IceGrid/Exception.rb +23 -49
- data/lib/IceGrid/FileParser.rb +13 -54
- data/lib/IceGrid/PluginFacade.rb +35 -0
- data/lib/IceGrid/Registry.rb +150 -62
- data/lib/IceGrid/Session.rb +24 -68
- data/lib/IceGrid/UserAccountMapper.rb +13 -54
- data/lib/IcePatch2.rb +1 -6
- data/lib/IcePatch2/FileInfo.rb +4 -15
- data/lib/IcePatch2/FileServer.rb +32 -80
- data/lib/IceStorm.rb +1 -6
- data/lib/IceStorm/IceStorm.rb +78 -210
- data/lib/IceStorm/Metrics.rb +10 -93
- data/slice/Glacier2/Metrics.ice +20 -10
- data/slice/Glacier2/PermissionsVerifier.ice +19 -12
- data/slice/Glacier2/PermissionsVerifierF.ice +16 -9
- data/slice/Glacier2/Router.ice +19 -13
- data/slice/Glacier2/RouterF.ice +16 -9
- data/slice/Glacier2/SSLInfo.ice +17 -10
- data/slice/Glacier2/Session.ice +24 -18
- data/slice/Ice/BuiltinSequences.ice +18 -9
- data/slice/Ice/Communicator.ice +180 -64
- data/slice/Ice/CommunicatorF.ice +18 -9
- data/slice/Ice/Connection.ice +208 -75
- data/slice/Ice/ConnectionF.ice +18 -9
- data/slice/Ice/Current.ice +37 -28
- data/slice/Ice/Endpoint.ice +73 -21
- data/slice/Ice/EndpointF.ice +19 -10
- data/slice/Ice/EndpointTypes.ice +21 -13
- data/slice/Ice/FacetMap.ice +19 -10
- data/slice/Ice/Identity.ice +24 -10
- data/slice/Ice/ImplicitContext.ice +41 -33
- data/slice/Ice/ImplicitContextF.ice +17 -9
- data/slice/Ice/Instrumentation.ice +37 -30
- data/slice/Ice/InstrumentationF.ice +19 -10
- data/slice/Ice/LocalException.ice +118 -112
- data/slice/Ice/Locator.ice +28 -21
- data/slice/Ice/LocatorF.ice +18 -9
- data/slice/Ice/Logger.ice +26 -18
- data/slice/Ice/LoggerF.ice +18 -9
- data/slice/Ice/Metrics.ice +42 -30
- data/slice/Ice/ObjectAdapter.ice +88 -53
- data/slice/Ice/ObjectAdapterF.ice +18 -9
- data/slice/Ice/ObjectFactory.ice +28 -17
- data/slice/Ice/Plugin.ice +25 -13
- data/slice/Ice/PluginF.ice +22 -9
- data/slice/Ice/Process.ice +20 -11
- data/slice/Ice/ProcessF.ice +18 -9
- data/slice/Ice/Properties.ice +42 -28
- data/slice/Ice/PropertiesAdmin.ice +20 -10
- data/slice/Ice/PropertiesF.ice +18 -9
- data/slice/Ice/RemoteLogger.ice +23 -19
- data/slice/Ice/Router.ice +28 -13
- data/slice/Ice/RouterF.ice +18 -9
- data/slice/Ice/ServantLocator.ice +40 -29
- data/slice/Ice/ServantLocatorF.ice +18 -9
- data/slice/Ice/SliceChecksumDict.ice +18 -9
- data/slice/Ice/ValueFactory.ice +132 -0
- data/slice/Ice/Version.ice +20 -10
- data/slice/IceBT/ConnectionInfo.ice +58 -0
- data/slice/IceBT/EndpointInfo.ice +56 -0
- data/slice/IceBT/Types.ice +44 -0
- data/slice/IceBox/IceBox.ice +45 -27
- data/slice/IceDiscovery/IceDiscovery.ice +75 -10
- data/slice/IceGrid/Admin.ice +410 -44
- data/slice/IceGrid/Descriptor.ice +47 -34
- data/slice/IceGrid/Exception.ice +43 -32
- data/slice/IceGrid/FileParser.ice +21 -12
- data/slice/IceGrid/PluginFacade.ice +26 -18
- data/slice/IceGrid/Registry.ice +150 -21
- data/slice/IceGrid/Session.ice +25 -17
- data/slice/IceGrid/UserAccountMapper.ice +23 -14
- data/slice/IceIAP/ConnectionInfo.ice +73 -0
- data/slice/IceIAP/EndpointInfo.ice +67 -0
- data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +19 -12
- data/slice/IcePatch2/FileInfo.ice +19 -13
- data/slice/IcePatch2/FileServer.ice +27 -18
- data/slice/IceSSL/ConnectionInfo.ice +27 -23
- data/slice/IceSSL/ConnectionInfoF.ice +30 -0
- data/slice/IceSSL/EndpointInfo.ice +21 -36
- data/slice/IceStorm/IceStorm.ice +33 -24
- data/slice/IceStorm/Metrics.ice +19 -11
- metadata +148 -120
- data/ext/ObjectFactory.cpp +0 -140
- data/ext/ObjectFactory.h +0 -50
- data/ext/ice/cpp/include/Ice/ACMF.h +0 -30
- data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
- data/ext/ice/cpp/include/Ice/BuiltinSequences.h +0 -82
- data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
- data/ext/ice/cpp/include/Ice/Connection.h +0 -497
- data/ext/ice/cpp/include/Ice/ConnectionF.h +0 -74
- data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +0 -30
- data/ext/ice/cpp/include/Ice/Current.h +0 -102
- data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +0 -48
- data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
- data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
- data/ext/ice/cpp/include/Ice/EndpointF.h +0 -93
- data/ext/ice/cpp/include/Ice/EndpointTypes.h +0 -82
- data/ext/ice/cpp/include/Ice/Identity.h +0 -168
- data/ext/ice/cpp/include/Ice/ImplicitContext.h +0 -102
- data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
- data/ext/ice/cpp/include/Ice/InstrumentationF.h +0 -75
- data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
- data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
- data/ext/ice/cpp/include/Ice/LocatorF.h +0 -93
- data/ext/ice/cpp/include/Ice/Logger.h +0 -100
- data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
- data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
- data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +0 -26
- data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
- data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
- data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +0 -26
- data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
- data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
- data/ext/ice/cpp/include/Ice/PluginF.h +0 -70
- data/ext/ice/cpp/include/Ice/Process.h +0 -574
- data/ext/ice/cpp/include/Ice/ProcessF.h +0 -83
- data/ext/ice/cpp/include/Ice/Properties.h +0 -136
- data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
- data/ext/ice/cpp/include/Ice/PropertiesF.h +0 -87
- data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
- data/ext/ice/cpp/include/Ice/Router.h +0 -1159
- data/ext/ice/cpp/include/Ice/RouterF.h +0 -83
- data/ext/ice/cpp/include/Ice/ServantLocator.h +0 -96
- data/ext/ice/cpp/include/Ice/Stream.h +0 -447
- data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
- data/ext/ice/cpp/include/Ice/Version.h +0 -262
- data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
- data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
- data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
- data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
- data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +0 -302
- data/ext/ice/cpp/include/IceUtil/SHA1.h +0 -47
- data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
- data/ext/ice/cpp/include/Slice/Checksum.h +0 -26
- data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
- data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
- data/ext/ice/cpp/include/Slice/JavaUtil.h +0 -279
- data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
- data/ext/ice/cpp/include/Slice/PHPUtil.h +0 -50
- data/ext/ice/cpp/include/Slice/PythonUtil.h +0 -64
- data/ext/ice/cpp/include/Slice/Util.h +0 -56
- data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
- data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
- data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +0 -44
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
- data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
- data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
- data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
- data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
- data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
- data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +0 -64
- data/ext/ice/cpp/src/IceUtil/ArgVector.h +0 -41
- data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
- data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
- data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
- data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
- data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
- data/lib/Ice/ObjectFactoryF.rb +0 -29
- data/lib/IceGrid/Locator.rb +0 -106
- data/lib/IceGrid/Observer.rb +0 -572
- data/lib/IceGrid/Query.rb +0 -169
- data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
- data/slice/Freeze/CatalogData.ice +0 -49
- data/slice/Freeze/Connection.ice +0 -121
- data/slice/Freeze/ConnectionF.ice +0 -20
- data/slice/Freeze/DB.ice +0 -37
- data/slice/Freeze/Evictor.ice +0 -346
- data/slice/Freeze/EvictorF.ice +0 -22
- data/slice/Freeze/EvictorStorage.ice +0 -72
- data/slice/Freeze/Exception.ice +0 -100
- data/slice/Freeze/Transaction.ice +0 -58
- data/slice/Freeze/TransactionalEvictor.ice +0 -50
- data/slice/Ice/ObjectFactoryF.ice +0 -21
- data/slice/IceGrid/Locator.ice +0 -57
- data/slice/IceGrid/Observer.ice +0 -395
- data/slice/IceGrid/Query.ice +0 -131
@@ -1,11 +1,6 @@
|
|
1
|
-
// **********************************************************************
|
2
1
|
//
|
3
|
-
// Copyright (c)
|
2
|
+
// Copyright (c) ZeroC, Inc. All rights reserved.
|
4
3
|
//
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
7
|
-
//
|
8
|
-
// **********************************************************************
|
9
4
|
|
10
5
|
#include <IceUtil/Shared.h>
|
11
6
|
|
@@ -29,6 +24,11 @@ IceUtil::SimpleShared::SimpleShared(const SimpleShared&) :
|
|
29
24
|
{
|
30
25
|
}
|
31
26
|
|
27
|
+
IceUtil::SimpleShared::~SimpleShared()
|
28
|
+
{
|
29
|
+
// Out of line to avoid weak vtable
|
30
|
+
}
|
31
|
+
|
32
32
|
IceUtil::Shared::Shared() :
|
33
33
|
_ref(0),
|
34
34
|
_flags(0)
|
@@ -41,14 +41,14 @@ IceUtil::Shared::Shared(const Shared&) :
|
|
41
41
|
{
|
42
42
|
}
|
43
43
|
|
44
|
-
void
|
44
|
+
void
|
45
45
|
IceUtil::Shared::__incRef()
|
46
46
|
{
|
47
47
|
assert(_ref >= 0);
|
48
48
|
++_ref;
|
49
49
|
}
|
50
50
|
|
51
|
-
void
|
51
|
+
void
|
52
52
|
IceUtil::Shared::__decRef()
|
53
53
|
{
|
54
54
|
assert(_ref > 0);
|
@@ -1,18 +1,18 @@
|
|
1
|
-
// **********************************************************************
|
2
1
|
//
|
3
|
-
// Copyright (c)
|
2
|
+
// Copyright (c) ZeroC, Inc. All rights reserved.
|
4
3
|
//
|
5
|
-
// This copy of Ice is licensed to you under the terms described in the
|
6
|
-
// ICE_LICENSE file included in this distribution.
|
7
|
-
//
|
8
|
-
// **********************************************************************
|
9
4
|
|
10
5
|
#include <IceUtil/StringConverter.h>
|
11
6
|
#include <IceUtil/MutexPtrLock.h>
|
12
7
|
#include <IceUtil/Mutex.h>
|
13
|
-
#include <IceUtil/ScopedArray.h>
|
14
8
|
#include <IceUtil/StringUtil.h>
|
9
|
+
|
10
|
+
#ifdef ICE_HAS_CODECVT_UTF8
|
11
|
+
#include <codecvt>
|
12
|
+
#include <locale>
|
13
|
+
#else
|
15
14
|
#include <IceUtil/Unicode.h>
|
15
|
+
#endif
|
16
16
|
|
17
17
|
using namespace IceUtil;
|
18
18
|
using namespace IceUtilInternal;
|
@@ -25,268 +25,290 @@ IceUtil::Mutex* processStringConverterMutex = 0;
|
|
25
25
|
IceUtil::StringConverterPtr processStringConverter;
|
26
26
|
IceUtil::WstringConverterPtr processWstringConverter;
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
Init()
|
33
|
-
{
|
34
|
-
processStringConverterMutex = new IceUtil::Mutex;
|
35
|
-
}
|
28
|
+
#ifndef ICE_HAS_THREAD_SAFE_LOCAL_STATIC
|
29
|
+
IceUtil::WstringConverterPtr unicodeWstringConverter;
|
30
|
+
#endif
|
36
31
|
|
37
|
-
|
38
|
-
{
|
39
|
-
delete processStringConverterMutex;
|
40
|
-
processStringConverterMutex = 0;
|
41
|
-
}
|
42
|
-
};
|
32
|
+
#ifdef ICE_HAS_CODECVT_UTF8
|
43
33
|
|
44
|
-
|
34
|
+
template<size_t wcharSize>
|
35
|
+
struct SelectCodeCvt;
|
45
36
|
|
46
|
-
|
37
|
+
template<>
|
38
|
+
struct SelectCodeCvt<2>
|
39
|
+
{
|
40
|
+
typedef std::codecvt_utf8_utf16<wchar_t> Type;
|
41
|
+
};
|
47
42
|
|
48
|
-
|
43
|
+
template<>
|
44
|
+
struct SelectCodeCvt<4>
|
49
45
|
{
|
46
|
+
typedef std::codecvt_utf8<wchar_t> Type;
|
47
|
+
};
|
50
48
|
|
51
|
-
class
|
49
|
+
class UnicodeWstringConverter : public WstringConverter
|
52
50
|
{
|
53
51
|
public:
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
#if defined(_MSC_VER) && (_MSC_VER <= 1800)
|
54
|
+
//
|
55
|
+
// VS 2013 needs a default ctor
|
56
|
+
//
|
57
|
+
UnicodeWstringConverter()
|
58
58
|
{
|
59
59
|
}
|
60
|
+
#endif
|
60
61
|
|
61
|
-
|
62
|
+
virtual Byte* toUTF8(const wchar_t* sourceStart, const wchar_t* sourceEnd, UTF8Buffer& buffer) const
|
62
63
|
{
|
63
|
-
|
64
|
+
//
|
65
|
+
// Max bytes for a character encoding in UTF-8 is 4,
|
66
|
+
// however MSVC returns 6
|
67
|
+
//
|
68
|
+
#ifdef _MSC_VER
|
69
|
+
assert(_codecvt.max_length() == 4 || _codecvt.max_length() == 6);
|
70
|
+
#else
|
71
|
+
assert(_codecvt.max_length() == 4);
|
72
|
+
#endif
|
73
|
+
if(sourceStart == sourceEnd)
|
74
|
+
{
|
75
|
+
return buffer.getMoreBytes(1, 0);
|
76
|
+
}
|
77
|
+
|
78
|
+
char* targetStart = 0;
|
79
|
+
char* targetEnd = 0;
|
80
|
+
char* targetNext = 0;
|
81
|
+
|
82
|
+
mbstate_t state = mbstate_t(); // must be initialized!
|
83
|
+
const wchar_t* sourceNext = sourceStart;
|
84
|
+
|
85
|
+
bool more = false;
|
86
|
+
|
87
|
+
//
|
88
|
+
// The number of bytes we request from buffer for each remaining source character
|
89
|
+
//
|
90
|
+
size_t factor = 2;
|
91
|
+
|
92
|
+
do
|
93
|
+
{
|
94
|
+
assert(factor <= 4);
|
95
|
+
const size_t chunkSize = std::max<size_t>(static_cast<size_t>(sourceEnd - sourceStart) * factor, 4);
|
96
|
+
++factor; // at the next round, we'll allocate more bytes per remaining source character
|
97
|
+
|
98
|
+
targetStart = reinterpret_cast<char*>(buffer.getMoreBytes(chunkSize, reinterpret_cast<Byte*>(targetNext)));
|
99
|
+
targetEnd = targetStart + chunkSize;
|
100
|
+
targetNext = targetStart;
|
101
|
+
|
102
|
+
codecvt_base::result result =
|
103
|
+
_codecvt.out(state, sourceStart, sourceEnd, sourceNext, targetStart, targetEnd, targetNext);
|
104
|
+
|
105
|
+
switch(result)
|
106
|
+
{
|
107
|
+
case codecvt_base::ok:
|
108
|
+
//
|
109
|
+
// MSVC returns ok when target is exhausted
|
110
|
+
//
|
111
|
+
more = sourceNext < sourceEnd;
|
112
|
+
break;
|
113
|
+
|
114
|
+
case codecvt_base::partial:
|
115
|
+
//
|
116
|
+
// clang/libc++ and g++5 return partial when target is exhausted
|
117
|
+
//
|
118
|
+
more = true;
|
119
|
+
assert(sourceNext < sourceEnd);
|
120
|
+
break;
|
121
|
+
|
122
|
+
case codecvt_base::noconv:
|
123
|
+
//
|
124
|
+
// Unexpected
|
125
|
+
//
|
126
|
+
assert(0);
|
127
|
+
throw IllegalConversionException(__FILE__, __LINE__, "codecvt.out noconv");
|
128
|
+
|
129
|
+
default:
|
130
|
+
throw IllegalConversionException(__FILE__, __LINE__, "codecvt.out error");
|
131
|
+
}
|
132
|
+
|
133
|
+
if(targetStart == targetNext)
|
134
|
+
{
|
135
|
+
// We didn't convert a single character
|
136
|
+
throw IllegalConversionException(__FILE__, __LINE__,
|
137
|
+
"no character converted by codecvt.out");
|
138
|
+
}
|
139
|
+
|
140
|
+
sourceStart = sourceNext;
|
141
|
+
} while (more);
|
142
|
+
|
143
|
+
return reinterpret_cast<Byte*>(targetNext);
|
64
144
|
}
|
65
145
|
|
66
|
-
Byte*
|
146
|
+
virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, wstring& target) const
|
67
147
|
{
|
68
|
-
|
148
|
+
const size_t sourceSize = static_cast<size_t>(sourceEnd - sourceStart);
|
149
|
+
|
150
|
+
if(sourceSize == 0)
|
69
151
|
{
|
70
|
-
|
152
|
+
target = L"";
|
71
153
|
}
|
72
154
|
else
|
73
155
|
{
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if(!_buffer)
|
80
|
-
{
|
81
|
-
throw std::bad_alloc();
|
82
|
-
}
|
83
|
-
return _buffer + _offset;
|
84
|
-
}
|
156
|
+
target.resize(sourceSize);
|
157
|
+
wchar_t* targetStart = const_cast<wchar_t*>(target.data());
|
158
|
+
wchar_t* targetEnd = targetStart + sourceSize;
|
159
|
+
wchar_t* targetNext = targetStart;
|
85
160
|
|
86
|
-
|
87
|
-
{
|
88
|
-
return _buffer;
|
89
|
-
}
|
161
|
+
const char* sourceNext = reinterpret_cast<const char*>(sourceStart);
|
90
162
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
163
|
+
mbstate_t state = mbstate_t();
|
164
|
+
|
165
|
+
codecvt_base::result result = _codecvt.in(state,
|
166
|
+
reinterpret_cast<const char*>(sourceStart),
|
167
|
+
reinterpret_cast<const char*>(sourceEnd),
|
168
|
+
sourceNext,
|
169
|
+
targetStart, targetEnd, targetNext);
|
170
|
+
|
171
|
+
if(result != codecvt_base::ok)
|
172
|
+
{
|
173
|
+
throw IllegalConversionException(__FILE__, __LINE__, "codecvt.in failure");
|
174
|
+
}
|
175
|
+
|
176
|
+
target.resize(static_cast<size_t>(targetNext - targetStart));
|
177
|
+
}
|
96
178
|
}
|
97
|
-
|
179
|
+
|
98
180
|
private:
|
99
181
|
|
100
|
-
|
101
|
-
|
182
|
+
typedef SelectCodeCvt<sizeof(wchar_t)>::Type CodeCvt;
|
183
|
+
const CodeCvt _codecvt;
|
102
184
|
};
|
103
185
|
|
104
|
-
|
186
|
+
#else
|
105
187
|
|
188
|
+
class UnicodeWstringConverter : public WstringConverter
|
189
|
+
{
|
190
|
+
public:
|
106
191
|
|
192
|
+
virtual Byte* toUTF8(const wchar_t* sourceStart, const wchar_t* sourceEnd, UTF8Buffer& buffer) const
|
193
|
+
{
|
194
|
+
if(sourceStart == sourceEnd)
|
195
|
+
{
|
196
|
+
return buffer.getMoreBytes(1, 0);
|
197
|
+
}
|
107
198
|
|
108
|
-
|
109
|
-
|
110
|
-
{
|
111
|
-
}
|
199
|
+
Byte* targetStart = 0;
|
200
|
+
Byte* targetEnd = 0;
|
112
201
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
{
|
118
|
-
//
|
119
|
-
// The "chunk size" is the maximum of the number of characters in the
|
120
|
-
// source and 6 (== max bytes necessary to encode one Unicode character).
|
121
|
-
//
|
122
|
-
size_t chunkSize = std::max<size_t>(static_cast<size_t>(sourceEnd - sourceStart), 6);
|
202
|
+
//
|
203
|
+
// The number of bytes we request from buffer for each remaining source character
|
204
|
+
//
|
205
|
+
size_t factor = 2;
|
123
206
|
|
124
|
-
|
125
|
-
|
207
|
+
do
|
208
|
+
{
|
209
|
+
assert(factor <= 4);
|
210
|
+
const size_t chunkSize = std::max<size_t>((sourceEnd - sourceStart) * factor, 4);
|
211
|
+
++factor; // at the next round, we'll allocate more bytes per remaining source character
|
126
212
|
|
127
|
-
|
213
|
+
targetStart = buffer.getMoreBytes(chunkSize, targetStart);
|
214
|
+
targetEnd = targetStart + chunkSize;
|
215
|
+
}
|
216
|
+
while(convertUTFWstringToUTF8(sourceStart, sourceEnd, targetStart, targetEnd) == false);
|
128
217
|
|
129
|
-
|
130
|
-
convertUTFWstringToUTF8(sourceStart, sourceEnd,
|
131
|
-
targetStart, targetEnd, _conversionFlags))
|
132
|
-
== targetExhausted)
|
133
|
-
{
|
134
|
-
targetStart = buffer.getMoreBytes(chunkSize, targetStart);
|
135
|
-
targetEnd = targetStart + chunkSize;
|
218
|
+
return targetStart;
|
136
219
|
}
|
137
|
-
|
138
|
-
|
220
|
+
|
221
|
+
virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, wstring& target) const
|
139
222
|
{
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "wide string source illegal");
|
146
|
-
default:
|
223
|
+
if(sourceStart == sourceEnd)
|
224
|
+
{
|
225
|
+
target = L"";
|
226
|
+
}
|
227
|
+
else
|
147
228
|
{
|
148
|
-
|
149
|
-
throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
|
229
|
+
convertUTF8ToUTFWstring(sourceStart, sourceEnd, target);
|
150
230
|
}
|
151
231
|
}
|
152
|
-
|
153
|
-
}
|
232
|
+
};
|
154
233
|
|
234
|
+
#endif
|
155
235
|
|
156
|
-
|
157
|
-
UnicodeWstringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
|
158
|
-
wstring& target) const
|
236
|
+
class Init
|
159
237
|
{
|
160
|
-
|
238
|
+
public:
|
239
|
+
|
240
|
+
Init()
|
161
241
|
{
|
162
|
-
|
163
|
-
|
242
|
+
processStringConverterMutex = new IceUtil::Mutex;
|
243
|
+
#ifndef ICE_HAS_THREAD_SAFE_LOCAL_STATIC
|
244
|
+
unicodeWstringConverter = ICE_MAKE_SHARED(UnicodeWstringConverter);
|
245
|
+
#endif
|
164
246
|
}
|
165
247
|
|
166
|
-
|
167
|
-
convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, _conversionFlags);
|
168
|
-
|
169
|
-
switch(result)
|
248
|
+
~Init()
|
170
249
|
{
|
171
|
-
|
172
|
-
|
173
|
-
case sourceExhausted:
|
174
|
-
throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
|
175
|
-
case sourceIllegal:
|
176
|
-
throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
|
177
|
-
default:
|
178
|
-
{
|
179
|
-
assert(0);
|
180
|
-
throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
|
181
|
-
}
|
250
|
+
delete processStringConverterMutex;
|
251
|
+
processStringConverterMutex = 0;
|
182
252
|
}
|
183
|
-
}
|
253
|
+
};
|
184
254
|
|
185
|
-
|
186
|
-
|
187
|
-
|
255
|
+
Init init;
|
256
|
+
|
257
|
+
const WstringConverterPtr&
|
258
|
+
getUnicodeWstringConverter()
|
188
259
|
{
|
260
|
+
#ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC
|
261
|
+
static const WstringConverterPtr unicodeWstringConverter = ICE_MAKE_SHARED(UnicodeWstringConverter);
|
262
|
+
#endif
|
263
|
+
return unicodeWstringConverter;
|
189
264
|
}
|
190
265
|
|
191
|
-
|
192
|
-
WindowsStringConverter::toUTF8(const char* sourceStart,
|
193
|
-
const char* sourceEnd,
|
194
|
-
UTF8Buffer& buffer) const
|
266
|
+
class UTF8BufferI : public UTF8Buffer
|
195
267
|
{
|
196
|
-
|
197
|
-
// First convert to UTF-16
|
198
|
-
//
|
199
|
-
int sourceSize = static_cast<int>(sourceEnd - sourceStart);
|
200
|
-
if(sourceSize == 0)
|
201
|
-
{
|
202
|
-
return buffer.getMoreBytes(1, 0);
|
203
|
-
}
|
268
|
+
public:
|
204
269
|
|
205
|
-
int size = 0;
|
206
|
-
int writtenWchar = 0;
|
207
|
-
ScopedArray<wchar_t> wbuffer;
|
208
|
-
|
209
270
|
//
|
210
|
-
//
|
211
|
-
// see http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx
|
271
|
+
// Returns the first unused byte in the resized buffer
|
212
272
|
//
|
213
|
-
|
214
|
-
(_cp == 50220 || _cp == 50221 || _cp == 50222 ||
|
215
|
-
_cp == 50225 || _cp == 50227 || _cp == 50229 ||
|
216
|
-
_cp == 65000 || _cp == 42 || (_cp >= 57002 && _cp <= 57011)) ? 0 : MB_ERR_INVALID_CHARS;
|
217
|
-
|
218
|
-
do
|
219
|
-
{
|
220
|
-
size = size == 0 ? sourceSize + 2 : 2 * size;
|
221
|
-
wbuffer.reset(new wchar_t[size]);
|
222
|
-
|
223
|
-
writtenWchar = MultiByteToWideChar(_cp, flags, sourceStart,
|
224
|
-
sourceSize, wbuffer.get(), size);
|
225
|
-
} while(writtenWchar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
226
|
-
|
227
|
-
if(writtenWchar == 0)
|
273
|
+
Byte* getMoreBytes(size_t howMany, Byte* firstUnused)
|
228
274
|
{
|
229
|
-
|
230
|
-
|
275
|
+
size_t bytesUsed = 0;
|
276
|
+
if(firstUnused != 0)
|
277
|
+
{
|
278
|
+
bytesUsed = static_cast<size_t>(firstUnused - reinterpret_cast<const Byte*>(_buffer.data()));
|
279
|
+
}
|
231
280
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
}
|
281
|
+
if(_buffer.size() < howMany + bytesUsed)
|
282
|
+
{
|
283
|
+
_buffer.resize(bytesUsed + howMany);
|
284
|
+
}
|
237
285
|
|
238
|
-
|
239
|
-
WindowsStringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
|
240
|
-
string& target) const
|
241
|
-
{
|
242
|
-
if(sourceStart == sourceEnd)
|
243
|
-
{
|
244
|
-
target = "";
|
245
|
-
return;
|
286
|
+
return const_cast<Byte*>(reinterpret_cast<const Byte*>(_buffer.data())) + bytesUsed;
|
246
287
|
}
|
247
288
|
|
248
|
-
|
289
|
+
void swap(string& other, const Byte* tail)
|
249
290
|
{
|
250
|
-
|
251
|
-
|
252
|
-
|
291
|
+
assert(tail >= reinterpret_cast<const Byte*>(_buffer.data()));
|
292
|
+
_buffer.resize(static_cast<size_t>(tail - reinterpret_cast<const Byte*>(_buffer.data())));
|
293
|
+
other.swap(_buffer);
|
253
294
|
}
|
254
295
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
wstring wtarget;
|
259
|
-
_unicodeWstringConverter.fromUTF8(sourceStart, sourceEnd, wtarget);
|
260
|
-
|
261
|
-
//
|
262
|
-
// WC_ERR_INVALID_CHARS conversion flag is only supported with 65001 (UTF-8) and
|
263
|
-
// 54936 (GB18030 Simplified Chinese)
|
264
|
-
//
|
265
|
-
DWORD flags = (_cp == 65001 || _cp == 54936) ? WC_ERR_INVALID_CHARS : 0;
|
266
|
-
//
|
267
|
-
// And then to a multi-byte narrow string
|
268
|
-
//
|
269
|
-
int size = 0;
|
270
|
-
int writtenChar = 0;
|
271
|
-
ScopedArray<char> buffer;
|
272
|
-
do
|
273
|
-
{
|
274
|
-
size = size == 0 ? static_cast<int>(sourceEnd - sourceStart) + 2 : 2 * size;
|
275
|
-
buffer.reset(new char[size]);
|
276
|
-
writtenChar = WideCharToMultiByte(_cp, flags, wtarget.data(), static_cast<int>(wtarget.size()),
|
277
|
-
buffer.get(), size, 0, 0);
|
278
|
-
} while(writtenChar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
279
|
-
|
280
|
-
if(writtenChar == 0)
|
281
|
-
{
|
282
|
-
throw IllegalConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
283
|
-
}
|
296
|
+
private:
|
297
|
+
string _buffer;
|
298
|
+
};
|
284
299
|
|
285
|
-
target.assign(buffer.get(), writtenChar);
|
286
300
|
}
|
287
301
|
|
288
|
-
|
302
|
+
IceUtil::UTF8Buffer::~UTF8Buffer()
|
303
|
+
{
|
304
|
+
// Out of line to avoid weak vtable
|
305
|
+
}
|
289
306
|
|
307
|
+
WstringConverterPtr
|
308
|
+
IceUtil::createUnicodeWstringConverter()
|
309
|
+
{
|
310
|
+
return getUnicodeWstringConverter();
|
311
|
+
}
|
290
312
|
|
291
313
|
StringConverterPtr
|
292
314
|
IceUtil::getProcessStringConverter()
|
@@ -298,75 +320,54 @@ IceUtil::getProcessStringConverter()
|
|
298
320
|
void
|
299
321
|
IceUtil::setProcessStringConverter(const StringConverterPtr& converter)
|
300
322
|
{
|
301
|
-
|
302
|
-
|
323
|
+
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(processStringConverterMutex);
|
324
|
+
processStringConverter = converter;
|
303
325
|
}
|
304
326
|
|
305
327
|
WstringConverterPtr
|
306
328
|
IceUtil::getProcessWstringConverter()
|
307
329
|
{
|
308
330
|
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(processStringConverterMutex);
|
309
|
-
|
331
|
+
if(processWstringConverter)
|
332
|
+
{
|
333
|
+
return processWstringConverter;
|
334
|
+
}
|
335
|
+
else
|
336
|
+
{
|
337
|
+
return getUnicodeWstringConverter();
|
338
|
+
}
|
310
339
|
}
|
311
340
|
|
312
341
|
void
|
313
342
|
IceUtil::setProcessWstringConverter(const WstringConverterPtr& converter)
|
314
343
|
{
|
315
|
-
|
316
|
-
|
344
|
+
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(processStringConverterMutex);
|
345
|
+
processWstringConverter = converter;
|
317
346
|
}
|
318
347
|
|
319
348
|
string
|
320
|
-
IceUtil::wstringToString(const wstring& v, const StringConverterPtr& converter, const WstringConverterPtr& wConverter
|
321
|
-
IceUtil::ConversionFlags flags)
|
349
|
+
IceUtil::wstringToString(const wstring& v, const StringConverterPtr& converter, const WstringConverterPtr& wConverter)
|
322
350
|
{
|
323
351
|
string target;
|
324
352
|
if(!v.empty())
|
325
353
|
{
|
354
|
+
const WstringConverterPtr& wConverterWithDefault = wConverter ? wConverter : getUnicodeWstringConverter();
|
355
|
+
|
326
356
|
//
|
327
|
-
// First convert to
|
357
|
+
// First convert to UTF-8 narrow string.
|
328
358
|
//
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
Byte* last = wConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
|
333
|
-
target = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
|
334
|
-
}
|
335
|
-
else
|
336
|
-
{
|
337
|
-
size_t size = v.size() * 4 * sizeof(char);
|
338
|
-
|
339
|
-
Byte* outBuf = new Byte[size];
|
340
|
-
Byte* targetStart = outBuf;
|
341
|
-
Byte* targetEnd = outBuf + size;
|
342
|
-
|
343
|
-
const wchar_t* sourceStart = v.data();
|
344
|
-
|
345
|
-
ConversionResult cr =
|
346
|
-
convertUTFWstringToUTF8(
|
347
|
-
sourceStart, sourceStart + v.size(),
|
348
|
-
targetStart, targetEnd, flags);
|
349
|
-
|
350
|
-
if(cr != conversionOK)
|
351
|
-
{
|
352
|
-
delete[] outBuf;
|
353
|
-
assert(cr == sourceExhausted || cr == sourceIllegal);
|
354
|
-
throw IllegalConversionException(__FILE__, __LINE__,
|
355
|
-
cr == sourceExhausted ? "partial character" : "bad encoding");
|
356
|
-
}
|
357
|
-
|
358
|
-
target = string(reinterpret_cast<char*>(outBuf), static_cast<size_t>(targetStart - outBuf));
|
359
|
-
delete[] outBuf;
|
360
|
-
}
|
359
|
+
UTF8BufferI buffer;
|
360
|
+
Byte* last = wConverterWithDefault->toUTF8(v.data(), v.data() + v.size(), buffer);
|
361
|
+
buffer.swap(target, last);
|
361
362
|
|
362
363
|
//
|
363
|
-
// If narrow string converter is present convert to the native narrow string encoding, otherwise
|
364
|
+
// If narrow string converter is present convert to the native narrow string encoding, otherwise
|
364
365
|
// native narrow string encoding is UTF8 and we are done.
|
365
366
|
//
|
366
367
|
if(converter)
|
367
368
|
{
|
368
369
|
string tmp;
|
369
|
-
converter->fromUTF8(reinterpret_cast<const Byte*>(target.data()),
|
370
|
+
converter->fromUTF8(reinterpret_cast<const Byte*>(target.data()),
|
370
371
|
reinterpret_cast<const Byte*>(target.data() + target.size()), tmp);
|
371
372
|
tmp.swap(target);
|
372
373
|
}
|
@@ -375,8 +376,7 @@ IceUtil::wstringToString(const wstring& v, const StringConverterPtr& converter,
|
|
375
376
|
}
|
376
377
|
|
377
378
|
wstring
|
378
|
-
IceUtil::stringToWstring(const string& v, const StringConverterPtr& converter,
|
379
|
-
const WstringConverterPtr& wConverter, IceUtil::ConversionFlags flags)
|
379
|
+
IceUtil::stringToWstring(const string& v, const StringConverterPtr& converter, const WstringConverterPtr& wConverter)
|
380
380
|
{
|
381
381
|
wstring target;
|
382
382
|
if(!v.empty())
|
@@ -390,36 +390,21 @@ IceUtil::stringToWstring(const string& v, const StringConverterPtr& converter,
|
|
390
390
|
{
|
391
391
|
UTF8BufferI buffer;
|
392
392
|
Byte* last = converter->toUTF8(v.data(), v.data() + v.size(), buffer);
|
393
|
-
|
393
|
+
buffer.swap(tmp, last);
|
394
394
|
}
|
395
395
|
else
|
396
396
|
{
|
397
397
|
tmp = v;
|
398
398
|
}
|
399
399
|
|
400
|
+
const WstringConverterPtr& wConverterWithDefault = wConverter ? wConverter : getUnicodeWstringConverter();
|
401
|
+
|
400
402
|
//
|
401
|
-
//
|
403
|
+
// Convert from UTF-8 to the wide string encoding
|
402
404
|
//
|
403
|
-
|
404
|
-
|
405
|
-
wConverter->fromUTF8(reinterpret_cast<const Byte*>(tmp.data()),
|
406
|
-
reinterpret_cast<const Byte*>(tmp.data() + tmp.size()), target);
|
407
|
-
}
|
408
|
-
else
|
409
|
-
{
|
410
|
-
const Byte* sourceStart = reinterpret_cast<const Byte*>(tmp.data());
|
411
|
-
|
412
|
-
ConversionResult cr =
|
413
|
-
convertUTF8ToUTFWstring(sourceStart, sourceStart + tmp.size(), target, flags);
|
405
|
+
wConverterWithDefault->fromUTF8(reinterpret_cast<const Byte*>(tmp.data()),
|
406
|
+
reinterpret_cast<const Byte*>(tmp.data() + tmp.size()), target);
|
414
407
|
|
415
|
-
if(cr != conversionOK)
|
416
|
-
{
|
417
|
-
assert(cr == sourceExhausted || cr == sourceIllegal);
|
418
|
-
|
419
|
-
throw IllegalConversionException(__FILE__, __LINE__,
|
420
|
-
cr == sourceExhausted ? "partial character" : "bad encoding");
|
421
|
-
}
|
422
|
-
}
|
423
408
|
}
|
424
409
|
return target;
|
425
410
|
}
|
@@ -430,10 +415,12 @@ IceUtil::nativeToUTF8(const string& str, const IceUtil::StringConverterPtr& conv
|
|
430
415
|
if(!converter || str.empty())
|
431
416
|
{
|
432
417
|
return str;
|
433
|
-
}
|
418
|
+
}
|
434
419
|
UTF8BufferI buffer;
|
435
420
|
Byte* last = converter->toUTF8(str.data(), str.data() + str.size(), buffer);
|
436
|
-
|
421
|
+
string result;
|
422
|
+
buffer.swap(result, last);
|
423
|
+
return result;
|
437
424
|
}
|
438
425
|
|
439
426
|
string
|
@@ -448,3 +435,248 @@ IceUtil::UTF8ToNative(const string& str, const IceUtil::StringConverterPtr& conv
|
|
448
435
|
reinterpret_cast<const Byte*>(str.data() + str.size()), tmp);
|
449
436
|
return tmp;
|
450
437
|
}
|
438
|
+
|
439
|
+
#ifdef ICE_HAS_CODECVT_UTF8
|
440
|
+
|
441
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
|
442
|
+
//
|
443
|
+
// Workaround for compiler bug - see http://stackoverflow.com/questions/32055357
|
444
|
+
//
|
445
|
+
typedef unsigned short Char16T;
|
446
|
+
typedef unsigned int Char32T;
|
447
|
+
|
448
|
+
#else
|
449
|
+
typedef char16_t Char16T;
|
450
|
+
typedef char32_t Char32T;
|
451
|
+
#endif
|
452
|
+
|
453
|
+
#endif
|
454
|
+
|
455
|
+
vector<unsigned short>
|
456
|
+
IceUtilInternal::toUTF16(const vector<Byte>& source)
|
457
|
+
{
|
458
|
+
vector<unsigned short> result;
|
459
|
+
if(!source.empty())
|
460
|
+
{
|
461
|
+
|
462
|
+
#ifdef ICE_HAS_CODECVT_UTF8
|
463
|
+
assert(sizeof(Char16T) == sizeof(unsigned short));
|
464
|
+
|
465
|
+
typedef wstring_convert<codecvt_utf8_utf16<Char16T>, Char16T> Convert;
|
466
|
+
|
467
|
+
Convert convert;
|
468
|
+
|
469
|
+
try
|
470
|
+
{
|
471
|
+
Convert::wide_string ws = convert.from_bytes(reinterpret_cast<const char*>(&source.front()),
|
472
|
+
reinterpret_cast<const char*>(&source.front() + source.size()));
|
473
|
+
|
474
|
+
result = vector<unsigned short>(reinterpret_cast<const unsigned short*>(ws.data()),
|
475
|
+
reinterpret_cast<const unsigned short*>(ws.data()) + ws.length());
|
476
|
+
}
|
477
|
+
catch(const std::range_error& ex)
|
478
|
+
{
|
479
|
+
throw IllegalConversionException(__FILE__, __LINE__, ex.what());
|
480
|
+
}
|
481
|
+
|
482
|
+
#else
|
483
|
+
convertUTF8ToUTF16(source, result);
|
484
|
+
#endif
|
485
|
+
}
|
486
|
+
return result;
|
487
|
+
}
|
488
|
+
|
489
|
+
vector<unsigned int>
|
490
|
+
IceUtilInternal::toUTF32(const vector<Byte>& source)
|
491
|
+
{
|
492
|
+
vector<unsigned int> result;
|
493
|
+
if(!source.empty())
|
494
|
+
{
|
495
|
+
|
496
|
+
#ifdef ICE_HAS_CODECVT_UTF8
|
497
|
+
assert(sizeof(Char32T) == sizeof(unsigned int));
|
498
|
+
|
499
|
+
typedef wstring_convert<codecvt_utf8<Char32T>, Char32T> Convert;
|
500
|
+
Convert convert;
|
501
|
+
|
502
|
+
try
|
503
|
+
{
|
504
|
+
Convert::wide_string ws = convert.from_bytes(reinterpret_cast<const char*>(&source.front()),
|
505
|
+
reinterpret_cast<const char*>(&source.front() + source.size()));
|
506
|
+
|
507
|
+
result = vector<unsigned int>(reinterpret_cast<const unsigned int*>(ws.data()),
|
508
|
+
reinterpret_cast<const unsigned int*>(ws.data()) + ws.length());
|
509
|
+
}
|
510
|
+
catch(const std::range_error& ex)
|
511
|
+
{
|
512
|
+
throw IllegalConversionException(__FILE__, __LINE__, ex.what());
|
513
|
+
}
|
514
|
+
|
515
|
+
#else
|
516
|
+
convertUTF8ToUTF32(source, result);
|
517
|
+
#endif
|
518
|
+
}
|
519
|
+
return result;
|
520
|
+
}
|
521
|
+
|
522
|
+
vector<Byte>
|
523
|
+
IceUtilInternal::fromUTF32(const vector<unsigned int>& source)
|
524
|
+
{
|
525
|
+
vector<Byte> result;
|
526
|
+
if(!source.empty())
|
527
|
+
{
|
528
|
+
|
529
|
+
#ifdef ICE_HAS_CODECVT_UTF8
|
530
|
+
assert(sizeof(Char32T) == sizeof(unsigned int));
|
531
|
+
|
532
|
+
typedef wstring_convert<codecvt_utf8<Char32T>, Char32T> Convert;
|
533
|
+
Convert convert;
|
534
|
+
|
535
|
+
try
|
536
|
+
{
|
537
|
+
Convert::byte_string bs = convert.to_bytes(reinterpret_cast<const Char32T*>(&source.front()),
|
538
|
+
reinterpret_cast<const Char32T*>(&source.front() + source.size()));
|
539
|
+
|
540
|
+
result = vector<Byte>(reinterpret_cast<const Byte*>(bs.data()),
|
541
|
+
reinterpret_cast<const Byte*>(bs.data()) + bs.length());
|
542
|
+
}
|
543
|
+
catch(const std::range_error& ex)
|
544
|
+
{
|
545
|
+
throw IllegalConversionException(__FILE__, __LINE__, ex.what());
|
546
|
+
}
|
547
|
+
|
548
|
+
#else
|
549
|
+
convertUTF32ToUTF8(source, result);
|
550
|
+
#endif
|
551
|
+
}
|
552
|
+
return result;
|
553
|
+
}
|
554
|
+
|
555
|
+
#ifdef _WIN32
|
556
|
+
|
557
|
+
namespace
|
558
|
+
{
|
559
|
+
//
|
560
|
+
// Converts to/from UTF-8 using MultiByteToWideChar and WideCharToMultiByte
|
561
|
+
//
|
562
|
+
class WindowsStringConverter : public StringConverter
|
563
|
+
{
|
564
|
+
public:
|
565
|
+
|
566
|
+
explicit WindowsStringConverter(unsigned int);
|
567
|
+
|
568
|
+
virtual Byte* toUTF8(const char*, const char*, UTF8Buffer&) const;
|
569
|
+
|
570
|
+
virtual void fromUTF8(const Byte*, const Byte*, string& target) const;
|
571
|
+
|
572
|
+
private:
|
573
|
+
unsigned int _cp;
|
574
|
+
};
|
575
|
+
|
576
|
+
WindowsStringConverter::WindowsStringConverter(unsigned int cp) :
|
577
|
+
_cp(cp)
|
578
|
+
{
|
579
|
+
}
|
580
|
+
|
581
|
+
Byte*
|
582
|
+
WindowsStringConverter::toUTF8(const char* sourceStart, const char* sourceEnd, UTF8Buffer& buffer) const
|
583
|
+
{
|
584
|
+
//
|
585
|
+
// First convert to UTF-16
|
586
|
+
//
|
587
|
+
int sourceSize = static_cast<int>(sourceEnd - sourceStart);
|
588
|
+
if(sourceSize == 0)
|
589
|
+
{
|
590
|
+
return buffer.getMoreBytes(1, 0);
|
591
|
+
}
|
592
|
+
|
593
|
+
int writtenWchar = 0;
|
594
|
+
wstring wbuffer;
|
595
|
+
|
596
|
+
//
|
597
|
+
// The following code pages doesn't support MB_ERR_INVALID_CHARS flag
|
598
|
+
// see http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072(v=vs.85).aspx
|
599
|
+
//
|
600
|
+
DWORD flags =
|
601
|
+
(_cp == 50220 || _cp == 50221 || _cp == 50222 ||
|
602
|
+
_cp == 50225 || _cp == 50227 || _cp == 50229 ||
|
603
|
+
_cp == 65000 || _cp == 42 || (_cp >= 57002 && _cp <= 57011)) ? 0 : MB_ERR_INVALID_CHARS;
|
604
|
+
|
605
|
+
do
|
606
|
+
{
|
607
|
+
wbuffer.resize(wbuffer.size() == 0 ? sourceSize + 2 : 2 * wbuffer.size());
|
608
|
+
writtenWchar = MultiByteToWideChar(_cp, flags, sourceStart, sourceSize,
|
609
|
+
const_cast<wchar_t*>(wbuffer.data()), static_cast<int>(wbuffer.size()));
|
610
|
+
} while(writtenWchar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
611
|
+
|
612
|
+
if(writtenWchar == 0)
|
613
|
+
{
|
614
|
+
throw IllegalConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
615
|
+
}
|
616
|
+
|
617
|
+
wbuffer.resize(static_cast<size_t>(writtenWchar));
|
618
|
+
|
619
|
+
//
|
620
|
+
// Then convert this UTF-16 wbuffer into UTF-8
|
621
|
+
//
|
622
|
+
return getUnicodeWstringConverter()->toUTF8(wbuffer.data(), wbuffer.data() + wbuffer.size(), buffer);
|
623
|
+
}
|
624
|
+
|
625
|
+
void
|
626
|
+
WindowsStringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, string& target) const
|
627
|
+
{
|
628
|
+
if(sourceStart == sourceEnd)
|
629
|
+
{
|
630
|
+
target = "";
|
631
|
+
return;
|
632
|
+
}
|
633
|
+
|
634
|
+
if(_cp == CP_UTF8)
|
635
|
+
{
|
636
|
+
string tmp(reinterpret_cast<const char*>(sourceStart), sourceEnd - sourceStart);
|
637
|
+
tmp.swap(target);
|
638
|
+
return;
|
639
|
+
}
|
640
|
+
|
641
|
+
//
|
642
|
+
// First convert to wstring (UTF-16)
|
643
|
+
//
|
644
|
+
wstring wtarget;
|
645
|
+
getUnicodeWstringConverter()->fromUTF8(sourceStart, sourceEnd, wtarget);
|
646
|
+
|
647
|
+
//
|
648
|
+
// WC_ERR_INVALID_CHARS conversion flag is only supported with 65001 (UTF-8) and
|
649
|
+
// 54936 (GB18030 Simplified Chinese)
|
650
|
+
//
|
651
|
+
DWORD flags = (_cp == 65001 || _cp == 54936) ? WC_ERR_INVALID_CHARS : 0;
|
652
|
+
|
653
|
+
//
|
654
|
+
// And then to a multi-byte narrow string
|
655
|
+
//
|
656
|
+
int writtenChar = -1;
|
657
|
+
do
|
658
|
+
{
|
659
|
+
target.resize(writtenChar == -1 ?
|
660
|
+
std::max<size_t>(sourceEnd - sourceStart + 2, target.size()) :
|
661
|
+
2 * target.size());
|
662
|
+
|
663
|
+
writtenChar = WideCharToMultiByte(_cp, flags, wtarget.data(), static_cast<int>(wtarget.size()),
|
664
|
+
const_cast<char*>(target.data()), static_cast<int>(target.size()),
|
665
|
+
0, 0);
|
666
|
+
} while(writtenChar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
|
667
|
+
|
668
|
+
if(writtenChar == 0)
|
669
|
+
{
|
670
|
+
throw IllegalConversionException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
671
|
+
}
|
672
|
+
|
673
|
+
target.resize(static_cast<size_t>(writtenChar));
|
674
|
+
}
|
675
|
+
}
|
676
|
+
|
677
|
+
StringConverterPtr
|
678
|
+
IceUtil::createWindowsStringConverter(unsigned int cp)
|
679
|
+
{
|
680
|
+
return ICE_MAKE_SHARED(WindowsStringConverter, cp);
|
681
|
+
}
|
682
|
+
#endif
|