ObjFW  Diff

Differences From Artifact [189e76f543]:

To Artifact [15e6c7cc85]:


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFRectangleValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"

#import "OFOutOfRangeException.h"

@implementation OFRectangleValue
@synthesize rectangleValue = _rectangle;

- (instancetype)initWithRectangle: (of_rectangle_t)rectangle
{
	self = [super init];

	_rectangle = rectangle;

	return self;
}

- (const char *)objCType
{
	return @encode(of_rectangle_t);
}

- (void)getValue: (void *)value
	    size: (size_t)size
{
	if (size != sizeof(_rectangle))
		@throw [OFOutOfRangeException exception];

	memcpy(value, &_rectangle, sizeof(_rectangle));
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"<OFValue: of_rectangle_t { %f, %f, %f, %f }>",
	    _rectangle.origin.x, _rectangle.origin.y,
	    _rectangle.size.width, _rectangle.size.height];
}
@end







|





|
|

|



|






|


|
<

|


|





|
|
|


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFRectValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"

#import "OFOutOfRangeException.h"

@implementation OFRectValue
@synthesize rectValue = _rect;

- (instancetype)initWithRect: (OFRect)rect
{
	self = [super init];

	_rect = rect;

	return self;
}

- (const char *)objCType
{
	return @encode(OFRect);
}

- (void)getValue: (void *)value size: (size_t)size

{
	if (size != sizeof(_rect))
		@throw [OFOutOfRangeException exception];

	memcpy(value, &_rect, sizeof(_rect));
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"<OFValue: OFRect { %f, %f, %f, %f }>",
	    _rect.origin.x, _rect.origin.y,
	    _rect.size.width, _rect.size.height];
}
@end