forked from onevcat/VVDocumenter-Xcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVVArgument.m
More file actions
executable file
·50 lines (43 loc) · 1.58 KB
/
VVArgument.m
File metadata and controls
executable file
·50 lines (43 loc) · 1.58 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Argument.m
// CommentTest
//
// Created by 王 巍 on 13-7-19.
// Copyright (c) 2013年 OneV's Den. All rights reserved.
//
#import "VVArgument.h"
@implementation VVArgument
-(void)setType:(NSString *)type
{
if (type != _type) {
_type = [[[type vv_stringByReplacingRegexPattern:@"&$" withString:@""]
vv_stringByReplacingRegexPattern:@"\\s*\\*$" withString:@""]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}
}
-(void)setName:(NSString *)name
{
if (name != _name) {
_name = [[[[[[[name vv_stringByReplacingRegexPattern:@"\\(|\\)" withString:@""]
vv_stringByReplacingRegexPattern:@"^&" withString:@""]
vv_stringByReplacingRegexPattern:@"^\\*+" withString:@""]
vv_stringByReplacingRegexPattern:@"\\[.*$" withString:@""]
vv_stringByReplacingRegexPattern:@",$" withString:@""]
vv_stringByReplacingRegexPattern:@";$" withString:@""]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}
}
- (NSString *)description {
return [NSString stringWithFormat:@"%@< type: %@, name: %@>", self.class, self.type, self.name];
}
- (BOOL)isEqual:(id)other {
if (other == self) {
return YES;
}
if ([other isKindOfClass:self.class]) {
return [((VVArgument *)other).type isEqualToString:self.type]
&& [((VVArgument *)other).name isEqualToString:self.name];
}
return NO;
}
@end