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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
requestedSize: [string UTF8StringLength]];
if ((tmp = strchr(tmp2, '@')) == NULL)
@throw [OFInvalidFormatException
exceptionWithClass: [self class]];
*tmp = '\0';
hostname = [[OFString alloc] initWithUTF8String: tmp + 1];
if ((tmp = strchr(tmp2, '!')) == NULL)
@throw [OFInvalidFormatException
exceptionWithClass: [self class]];
*tmp = '\0';
username = [[OFString alloc] initWithUTF8String: tmp + 1];
nickname = [[OFString alloc] initWithUTF8String: tmp2];
} @catch (id e) {
[self release];
@throw e;
} @finally {
if (tmp2 != NULL)
free(tmp2);
}
return self;
}
- (void)dealloc
{
[nickname release];
[username release];
[hostname release];
[super dealloc];
}
- (OFString*)username
{
OF_GETTER(username, YES)
}
- (OFString*)nickname
{
OF_GETTER(nickname, YES)
}
- (OFString*)hostname
{
OF_GETTER(hostname, YES)
}
- copy
{
return [self retain];
}
- (OFString*)description
{
return [OFString stringWithFormat: @"%@!%@@%@",
nickname, username, hostname];
}
@end
|
|
|
|
|
|
|
|
|
|
|
|
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
requestedSize: [string UTF8StringLength]];
if ((tmp = strchr(tmp2, '@')) == NULL)
@throw [OFInvalidFormatException
exceptionWithClass: [self class]];
*tmp = '\0';
_hostname = [[OFString alloc] initWithUTF8String: tmp + 1];
if ((tmp = strchr(tmp2, '!')) == NULL)
@throw [OFInvalidFormatException
exceptionWithClass: [self class]];
*tmp = '\0';
_username = [[OFString alloc] initWithUTF8String: tmp + 1];
_nickname = [[OFString alloc] initWithUTF8String: tmp2];
} @catch (id e) {
[self release];
@throw e;
} @finally {
if (tmp2 != NULL)
free(tmp2);
}
return self;
}
- (void)dealloc
{
[_nickname release];
[_username release];
[_hostname release];
[super dealloc];
}
- (OFString*)username
{
OF_GETTER(_username, YES)
}
- (OFString*)nickname
{
OF_GETTER(_nickname, YES)
}
- (OFString*)hostname
{
OF_GETTER(_hostname, YES)
}
- copy
{
return [self retain];
}
- (OFString*)description
{
return [OFString stringWithFormat: @"%@!%@@%@",
_nickname, _username, _hostname];
}
@end
|