@@ -105,10 +105,24 @@ + (instancetype)valueWithRect: (OFRect)rect { return [[[OFValue alloc] initWithBytes: &rect objCType: @encode(OFRect)] autorelease]; } + ++ (instancetype)valueWithVector3D: (OFVector3D)vector3D +{ + return [[[OFValue alloc] + initWithBytes: &vector3D + objCType: @encode(OFVector3D)] autorelease]; +} + ++ (instancetype)valueWithVector4D: (OFVector4D)vector4D +{ + return [[[OFValue alloc] + initWithBytes: &vector4D + objCType: @encode(OFVector4D)] autorelease]; +} - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType { if ([self isMemberOfClass: [OFValue class]]) { @@ -247,10 +261,24 @@ { OFRect ret; [self getValue: &ret size: sizeof(ret)]; return ret; } + +- (OFVector3D)vector3DValue +{ + OFVector3D ret; + [self getValue: &ret size: sizeof(ret)]; + return ret; +} + +- (OFVector4D)vector4DValue +{ + OFVector4D ret; + [self getValue: &ret size: sizeof(ret)]; + return ret; +} - (OFString *)description { const char *objCType = self.objCType; OFMutableString *ret; @@ -284,10 +312,25 @@ [self getValue: &rectValue size: sizeof(rectValue)]; return [OFString stringWithFormat: @"", rectValue.origin.x, rectValue.origin.y, rectValue.size.width, rectValue.size.height]; + } else if (strcmp(objCType, @encode(OFVector3D)) == 0 || + strcmp(objCType, @encode(const OFVector3D)) == 0) { + OFVector3D vector3DValue; + [self getValue: &vector3DValue size: sizeof(vector3DValue)]; + return [OFString stringWithFormat: + @"", + vector3DValue.x, vector3DValue.y, vector3DValue.z]; + } else if (strcmp(objCType, @encode(OFVector4D)) == 0 || + strcmp(objCType, @encode(const OFVector4D)) == 0) { + OFVector4D vector4DValue; + [self getValue: &vector4DValue size: sizeof(vector4DValue)]; + return [OFString stringWithFormat: + @"", + vector4DValue.x, vector4DValue.y, vector4DValue.z, + vector4DValue.w]; } ret = [OFMutableString stringWithString: @"