|
|
1.1 ! root 1: #import "EOAcceptsNullForScalarsObject.h" ! 2: ! 3: @interface EONullScalarSetter : NSObject ! 4: + (EONullScalarSetter *)sharedInstance; ! 5: @end ! 6: ! 7: @implementation EONullScalarSetter ! 8: static EONullScalarSetter *_instance = nil; ! 9: ! 10: + (EONullScalarSetter *)sharedInstance ! 11: { ! 12: if (!_instance) ! 13: _instance = [self new]; ! 14: return _instance; ! 15: } ! 16: ! 17: - (char)charValue {return 0;} ! 18: - (unsigned char)unsignedCharValue {return 0;} ! 19: - (short)shortValue {return 0;} ! 20: - (unsigned short)unsignedShortValue {return 0;} ! 21: - (int)intValue {return 0;} ! 22: - (unsigned int)unsignedIntValue {return 0;} ! 23: - (long)longValue {return 0;} ! 24: - (unsigned long)unsignedLongValue {return 0;} ! 25: - (long long)longLongValue {return 0;} ! 26: - (unsigned long long)unsignedLongLongValue {return 0;} ! 27: - (float)floatValue {return 0;} ! 28: - (double)doubleValue {return 0;} ! 29: - (BOOL)boolValue {return 0;} ! 30: - (NSString *)stringValue {return 0;} ! 31: @end ! 32: ! 33: ! 34: @implementation EOAcceptsNullForScalarsObject ! 35: ! 36: - (void)unableToSetNullForKey:(NSString *)key ! 37: { ! 38: id value = [EONullScalarSetter sharedInstance]; ! 39: [self takeValuesFromDictionary:[NSDictionary dictionaryWithObjects:&value forKeys:&key count:1]]; ! 40: } ! 41: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.