diff options
Diffstat (limited to 'objective-c/src')
-rw-r--r-- | objective-c/src/Ice/CommunicatorI.mm | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/objective-c/src/Ice/CommunicatorI.mm b/objective-c/src/Ice/CommunicatorI.mm index 97b460ff349..3110c72e47d 100644 --- a/objective-c/src/Ice/CommunicatorI.mm +++ b/objective-c/src/Ice/CommunicatorI.mm @@ -33,120 +33,6 @@ #define COMMUNICATOR dynamic_cast<Ice::Communicator*>(static_cast<IceUtil::Shared*>(cxxObject_)) -namespace IceObjC -{ - -class UnknownSlicedObjectFactoryI : public Ice::ObjectFactory -{ -public: - - virtual Ice::ObjectPtr - create(const std::string&) - { - ICEUnknownSlicedObject* obj = [[ICEUnknownSlicedObject alloc] init]; - Ice::ObjectPtr o = [ICEInputStream createObjectReader:obj]; - [obj release]; - return o; - } - - virtual void - destroy() - { - } -}; - -class ObjectFactoryI : public Ice::ObjectFactory -{ -public: - - // We must explicitely CFRetain/CFRelease so that the garbage - // collector does not trash the dictionaries. - ObjectFactoryI(NSDictionary* factories, NSDictionary* prefixTable) : - _factories(factories), _prefixTable(prefixTable) - { - CFRetain(_factories); - CFRetain(_prefixTable); - } - - ~ObjectFactoryI() - { - CFRelease(_factories); - CFRelease(_prefixTable); - } - - virtual Ice::ObjectPtr - create(const std::string& type) - { - NSString* sliceId = [[NSString alloc] initWithUTF8String:type.c_str()]; - @try - { - id<ICEObjectFactory> factory = nil; - @synchronized(_factories) - { - factory = [_factories objectForKey:sliceId]; - if(factory == nil) - { - factory = [_factories objectForKey:@""]; - } - } - - ICEObject* obj = nil; - if(factory != nil) - { - obj = [factory create:sliceId]; - } - - if(obj == nil) - { - std::string tId = toObjCSliceId(type, _prefixTable); - Class c = objc_lookUpClass(tId.c_str()); - if(c == nil) - { - return 0; // No object factory. - } - if([c isSubclassOfClass:[ICEObject class]]) - { - obj = (ICEObject*)[[c alloc] init]; - } - } - - Ice::ObjectPtr o; - if(obj != nil) - { - o = [ICEInputStream createObjectReader:obj]; - [obj release]; - } - return o; - } - @catch(id ex) - { - rethrowCxxException(ex); - } - @finally - { - [sliceId release]; - } - return nil; // Keep the compiler happy. - } - - virtual void - destroy() - { - for(NSString* k in _factories) - { - [[_factories objectForKey:k] destroy]; - } - } - -private: - - NSDictionary* _factories; - NSDictionary* _prefixTable; -}; - -} - ->>>>>>> origin/3.6 @interface ICEInternalPrefixTable(ICEInternal) +(NSDictionary*) newPrefixTable; @end |