/
GBComment.m
98 lines (76 loc) · 2.1 KB
/
GBComment.m
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
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
91
92
93
94
95
96
97
98
//
// GBComment.m
// appledoc
//
// Created by Tomaz Kragelj on 27.8.10.
// Copyright (C) 2010, Gentle Bytes. All rights reserved.
//
#import "GBDataObjects.h"
#import "GBComment.h"
@implementation GBComment
#pragma mark Initialization & disposal
+ (id)commentWithStringValue:(NSString *)value {
return [self commentWithStringValue:value sourceInfo:nil];
}
+ (id)commentWithStringValue:(NSString *)value sourceInfo:(GBSourceInfo *)info {
GBComment *result = [[self alloc] init];
result.stringValue = value;
result.sourceInfo = info;
return result;
}
- (id)init {
self = [super init];
if (self) {
self.longDescription = [GBCommentComponentsList componentsList];
self.relatedItems = [GBCommentComponentsList componentsList];
self.methodParameters = [NSMutableArray array];
self.methodExceptions = [NSMutableArray array];
self.methodResult = [GBCommentComponentsList componentsList];
self.availability = [GBCommentComponentsList componentsList];
}
return self;
}
#pragma mark Overriden methods
- (NSString *)description {
return [NSString stringWithFormat:@"Comment '%@'", [self.stringValue normalizedDescription]];
}
- (NSString *)debugDescription {
return [self description];
}
#pragma mark Properties
- (BOOL)hasShortDescription {
return self.shortDescription != nil;
}
- (BOOL)hasLongDescription {
return [self.longDescription.components count] > 0;
}
- (BOOL)hasMethodParameters {
return [self.methodParameters count] > 0;
}
- (BOOL)hasMethodExceptions {
return [self.methodExceptions count] > 0;
}
- (BOOL)hasMethodResult {
return [self.methodResult.components count] > 0;
}
- (BOOL)hasRelatedItems {
return [self.relatedItems.components count] > 0;
}
- (BOOL)hasAvailability {
return [self.availability.components count] > 0;
}
- (BOOL)isCopied {
return (self.originalContext != nil);
}
@synthesize originalContext;
@synthesize isProcessed;
@synthesize sourceInfo;
@synthesize stringValue;
@synthesize shortDescription;
@synthesize longDescription;
@synthesize relatedItems;
@synthesize methodParameters;
@synthesize methodExceptions;
@synthesize methodResult;
@synthesize availability;
@end