1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
-
+
-
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
* Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* 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.
*/
#include "config.h"
#import "OFUUID.h"
#import "OFArray.h"
#import "OFString.h"
#import "OFXMLElement.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#define bytesSize 16
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
void *pool = objc_autoreleasePoolPush();
OFString *UUIDString;
@try {
if (![element.name isEqual: self.className] ||
![element.namespace isEqual: OFSerializationNS])
@throw [OFInvalidArgumentException exception];
UUIDString = element.stringValue;
} @catch (id e) {
[self release];
@throw e;
}
self = [self initWithUUIDString: UUIDString];
objc_autoreleasePoolPop(pool);
return self;
}
- (bool)isEqual: (id)object
{
OFUUID *UUID;
if (![object isKindOfClass: [OFUUID class]])
return false;
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
207
208
209
210
211
212
213
214
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
_bytes[12], _bytes[13], _bytes[14], _bytes[15]];
}
- (OFString *)description
{
return self.UUIDString;
}
- (OFXMLElement *)XMLElementBySerializing
{
void *pool = objc_autoreleasePoolPush();
OFXMLElement *element = [OFXMLElement elementWithName: self.className
namespace: OFSerializationNS
stringValue: self.UUIDString];
[element retain];
objc_autoreleasePoolPop(pool);
return [element autorelease];
}
@end
|