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

#import "OFOutOfRangeException.h"

@implementation OFDimensionValue
@synthesize dimensionValue = _dimension;

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

	_dimension = dimension;

	return self;
}

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

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

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

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"<OFValue: of_dimension_t { %f, %f }>",
	    _dimension.width, _dimension.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
 *
 * 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 "OFSizeValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"

#import "OFOutOfRangeException.h"

@implementation OFSizeValue
@synthesize sizeValue = _size;

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

	_size = size;

	return self;
}

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

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

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

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

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

}
@end