ObjFW  Diff

Differences From Artifact [8625e742ff]:

To Artifact [c2a5ad86a9]:


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
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







-
+





-
-
+
+

-
+



-
+






-
+


-
+
-

-
+


-
+





-
+
-


 *
 * 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 "OFDimensionValue.h"
#import "OFSizeValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"

#import "OFOutOfRangeException.h"

@implementation OFDimensionValue
@synthesize dimensionValue = _dimension;
@implementation OFSizeValue
@synthesize sizeValue = _size;

- (instancetype)initWithDimension: (of_dimension_t)dimension
- (instancetype)initWithSize: (OFSize)size
{
	self = [super init];

	_dimension = dimension;
	_size = size;

	return self;
}

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

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

	memcpy(value, &_dimension, sizeof(_dimension));
	memcpy(value, &_size, sizeof(_size));
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"<OFValue: of_dimension_t { %f, %f }>",
	    @"<OFValue: OFSize { %f, %f }>", _size.width, _size.height];
	    _dimension.width, _dimension.height];
}
@end