return NO;
}
-// convenience methods
-
-// description
+/* description */
- (NSString *)description {
- return [NSString stringWithFormat:@"<WOAssociation[0x%08X]>", self];
+ return [NSString stringWithFormat:@"<0x%08X[%@]>",
+ self, NSStringFromClass([self class])];
}
-@end /* WOAssociation */
-
-@implementation WOAssociation(SpecialsValues)
-
/* special values */
- (void)setUnsignedCharValue:(unsigned char)_v inComponent:(WOComponent *)_c {
[self setValue:[NSNumber numberWithUnsignedChar:_v] inComponent:_c];
}
-- (void)setCharValue:(char)_value inComponent:(WOComponent *)_component {
- [self setValue:[NSNumber numberWithChar:_value] inComponent:_component];
+- (void)setCharValue:(signed char)_val inComponent:(WOComponent *)_component {
+ [self setValue:[NSNumber numberWithChar:_val] inComponent:_component];
}
- (void)setUnsignedIntValue:(unsigned int)_v inComponent:(WOComponent *)_c {
[self setValue:[NSNumber numberWithUnsignedInt:_v] inComponent:_c];
}
-- (void)setIntValue:(int)_value inComponent:(WOComponent *)_component {
+- (void)setIntValue:(signed int)_value inComponent:(WOComponent *)_component {
[self setValue:[NSNumber numberWithInt:_value] inComponent:_component];
}
- (void)setBoolValue:(BOOL)_value inComponent:(WOComponent *)_component {
- (unsigned char)unsignedCharValueInComponent:(WOComponent *)_component {
return [[self valueInComponent:_component] unsignedCharValue];
}
-- (char)charValueInComponent:(WOComponent *)_component {
- return [[self valueInComponent:_component] charValue];
+- (signed char)charValueInComponent:(WOComponent *)_component {
+ return [(id<NGBaseTypeValues>)[self valueInComponent:_component] charValue];
}
- (unsigned int)unsignedIntValueInComponent:(WOComponent *)_component {
return [[self valueInComponent:_component] unsignedIntValue];
}
-- (int)intValueInComponent:(WOComponent *)_component {
+- (signed int)intValueInComponent:(WOComponent *)_component {
return [[self valueInComponent:_component] intValue];
}
- (BOOL)boolValueInComponent:(WOComponent *)_component {
- (void)setUnsignedCharValue:(unsigned char)_v inContext:(WOContext *)_c {
[self setUnsignedCharValue:_v inComponent:(id)[_c cursor]];
}
-- (void)setCharValue:(char)_value inContext:(WOContext *)_ctx {
+- (void)setCharValue:(signed char)_value inContext:(WOContext *)_ctx {
[self setCharValue:_value inComponent:(id)[_ctx cursor]];
}
- (void)setUnsignedIntValue:(unsigned int)_v inContext:(WOContext *)_c {
[self setUnsignedIntValue:_v inComponent:(id)[_c cursor]];
}
-- (void)setIntValue:(int)_value inContext:(WOContext *)_ctx {
+- (void)setIntValue:(signed int)_value inContext:(WOContext *)_ctx {
[self setIntValue:_value inComponent:(id)[_ctx cursor]];
}
- (void)setBoolValue:(BOOL)_value inContext:(WOContext *)_ctx {
- (unsigned char)unsignedCharValueInContext:(WOContext *)_ctx {
return [self unsignedCharValueInComponent:[_ctx cursor]];
}
-- (char)charValueInContext:(WOContext *)_ctx {
+- (signed char)charValueInContext:(WOContext *)_ctx {
return [self charValueInComponent:[_ctx cursor]];
}
- (unsigned int)unsignedIntValueInContext:(WOContext *)_ctx {
return [self unsignedIntValueInComponent:[_ctx cursor]];
}
-- (int)intValueInContext:(WOContext *)_ctx {
+- (signed int)intValueInContext:(WOContext *)_ctx {
return [self intValueInComponent:[_ctx cursor]];
}
- (BOOL)boolValueInContext:(WOContext *)_ctx {
- (id)copyWithZone:(NSZone *)_zone {
// WOAssociations are immutable
- return RETAIN(self);
+ return [self retain];
}
-@end /* WOAssociation(SpecialsValues) */
-
-@implementation WOAssociation(BugTrap)
+/* BugTrap */
- (unsigned int)unsignedIntValue {
[self notImplemented:_cmd];
return 0;
}
-- (int)intValue {
+- (signed int)intValue {
[self notImplemented:_cmd];
return 0;
}
return nil;
}
-@end /* WOAssociation(BugTrap) */
+@end /* WOAssociation */
@interface WOAssociation(SpecialsValues)
- (void)setUnsignedCharValue:(unsigned char)_v inComponent:(WOComponent *)_c;
-- (void)setCharValue:(char)_value inComponent:(WOComponent *)_component;
+- (void)setCharValue:(signed char)_value inComponent:(WOComponent *)_component;
- (void)setUnsignedIntValue:(unsigned int)_v inComponent:(WOComponent *)_comp;
-- (void)setIntValue:(int)_value inComponent:(WOComponent *)_component;
+- (void)setIntValue:(signed int)_value inComponent:(WOComponent *)_component;
- (void)setBoolValue:(BOOL)_value inComponent:(WOComponent *)_component;
- (unsigned char)unsignedCharValueInComponent:(WOComponent *)_component;
-- (char)charValueInComponent:(WOComponent *)_component;
+- (signed char)charValueInComponent:(WOComponent *)_component;
- (unsigned int)unsignedIntValueInComponent:(WOComponent *)_component;
-- (int)intValueInComponent:(WOComponent *)_component;
+- (signed int)intValueInComponent:(WOComponent *)_component;
- (BOOL)boolValueInComponent:(WOComponent *)_component;
- (void)setStringValue:(NSString *)_v inComponent:(WOComponent *)_component;
/* special context values */
- (void)setUnsignedCharValue:(unsigned char)_v inContext:(WOContext *)_c;
-- (void)setCharValue:(char)_value inContext:(WOContext *)_ctx;
+- (void)setCharValue:(signed char)_value inContext:(WOContext *)_ctx;
- (void)setUnsignedIntValue:(unsigned int)_v inContext:(WOContext *)_c;
-- (void)setIntValue:(int)_value inContext:(WOContext *)_ctx;
+- (void)setIntValue:(signed int)_value inContext:(WOContext *)_ctx;
- (void)setBoolValue:(BOOL)_value inContext:(WOContext *)_ctx;
- (unsigned char)unsignedCharValueInContext:(WOContext *)_ctx;
-- (char)charValueInContext:(WOContext *)_ctx;
+- (signed char)charValueInContext:(WOContext *)_ctx;
- (unsigned int)unsignedIntValueInContext:(WOContext *)_ctx;
-- (int)intValueInContext:(WOContext *)_ctx;
+- (signed int)intValueInContext:(WOContext *)_ctx;
- (BOOL)boolValueInContext:(WOContext *)_ctx;
- (void)setStringValue:(NSString *)_v inContext:(WOContext *)_ctx;
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
-@interface NSObject(NGValues)
+@protocol NGBaseTypeValues
-- (BOOL)boolValue; // this returns always YES (the id != nil)
+- (BOOL)boolValue;
-/*
- these methods perform their operation on the string-representation of the
- object
-*/
- (signed char)charValue;
- (unsigned char)unsignedCharValue;
- (signed short)shortValue;
- (signed long long)longLongValue;
- (unsigned long long)unsignedLongLongValue;
- (float)floatValue;
+
+@end
+
+/*
+ The default basetype methods perform their operation on the
+ string-representation of the object.
+
+ -boolValue returns YES per default. (id != nil)
+*/
+@interface NSObject(NGValues) < NGBaseTypeValues >
+
- (double)doubleValue;
- (NSString *)stringValue;