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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
-
-
+
-
|
*/
#import "XMPPDiscoIdentity.h"
@implementation XMPPDiscoIdentity
@synthesize category = _category, name = _name, type = _type;
+ (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type
name: (OFString*)name
+ (instancetype)identityWithCategory: (OFString *)category
type: (OFString *)type
name: (OFString *)name
{
return [[[self alloc] initWithCategory: category
type: type
name: name] autorelease];
}
+ (instancetype)identityWithCategory: (OFString*)category
type: (OFString*)type
+ (instancetype)identityWithCategory: (OFString *)category
type: (OFString *)type
{
return [[[self alloc] initWithCategory: category
type: type] autorelease];
}
- initWithCategory: (OFString*)category
type: (OFString*)type
name: (OFString*)name
- initWithCategory: (OFString *)category
type: (OFString *)type
name: (OFString *)name
{
self = [super init];
@try {
if (category == nil || type == nil)
@throw [OFInvalidArgumentException exception];
_category = [category copy];
_name = [name copy];
_type = [type copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- initWithCategory: (OFString*)category
type: (OFString*)type
- initWithCategory: (OFString *)category
type: (OFString *)type
{
return [self initWithCategory: category
type: type
name: nil];
}
- init
{
@try {
[self doesNotRecognizeSelector: _cmd];
} @catch (id e) {
[self release];
@throw e;
}
OF_INVALID_INIT_METHOD
abort();
}
- (void)dealloc
{
[_category release];
[_name release];
[_type release];
|
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
-
+
|
if (object == self)
return OF_ORDERED_SAME;
if (![object isKindOfClass: [XMPPDiscoIdentity class]])
@throw [OFInvalidArgumentException exception];
identity = (XMPPDiscoIdentity*)object;
identity = (XMPPDiscoIdentity *)object;
categoryResult = [_category compare: identity->_category];
if (categoryResult != OF_ORDERED_SAME)
return categoryResult;
typeResult = [_type compare: identity->_type];
if (typeResult != OF_ORDERED_SAME)
return typeResult;
return [_name compare: identity->_name];
}
@end
|