-
Notifications
You must be signed in to change notification settings - Fork 644
/
GBRealLifeDataProvider.m
117 lines (104 loc) · 2.53 KB
/
GBRealLifeDataProvider.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//
// GBRealLifeDataProvider.m
// appledoc
//
// Created by Tomaz Kragelj on 27.7.10.
// Copyright (C) 2010, Gentle Bytes. All rights reserved.
//
#import "GBRealLifeDataProvider.h"
@implementation GBRealLifeDataProvider
+ (NSString *)headerWithClassCategoryAndProtocol {
return
@"#import <Foundation/Foundation.h>\n"
@"\n"
@"@class DeclaredClass;\n"
@"@protocol DeclaredProtocol;\n"
@"\n"
@"@interface GBCalculator : NSObject {\n"
@" NSString *_cachedResult;\n"
@"}\n"
@"\n"
@"- (NSInteger)add:(NSInteger)value1 to:(NSInteger)value2;\n"
@"- (NSInteger)subtract:(NSInteger)value1 from:(NSInteger)value2;\n"
@"@property (readonly) NSInteger cachedResult;\n"
@"\n"
@"@end"
@"\n"
@"@interface GBCalculator (Multiplication)\n"
@"- (NSInteger)multiply:(NSInteger)value1 with:(NSInteger)value2;\n"
@"@end\n"
@"\n"
@"@interface GBCalculator ()\n"
@"- (NSInteger)setCachedResult:(NSInteger)value;\n"
@"@end\n"
@"\n"
@"@protocol GBObserving\n"
@"- (void)observeCachedData;\n"
@"@end\n"
@"\n";
}
+ (NSString *)codeWithClassAndCategory {
return
@"#import \"Header.h\"\n"
@"\n"
@"@implementation GBCalculator\n"
@"\n"
@"- (NSInteger)add:(NSInteger)value1 to:(NSInteger)value2 {\n"
@" if (!_cachedResult) { _cachedResult = @\"Ready\"; }\n"
@" return value1 + value2;\n"
@"}\n"
@"\n"
@"@end\n"
@"\n"
@"@implementation GBCalculator (Multiplication)\n"
@"\n"
@"- (NSInteger)multiply:(NSInteger)value1 with:(NSInteger)value2 {\n"
@" return value1 * value2;\n"
@"}\n"
@"\n"
@"@end\n"
@"\n";
}
+ (NSString *)trickyMethodComment {
return
// Short description.
@"Short description.\n"
@"\n"
// Second paragraph with several empty lines to make sure empty paragraphs are not created.
@"Second paragraph with lot's of text\n"
@"split into two lines.\n"
@"\n\n\n"
// Nested lists.
@"- Nested 1\n"
@" - Nested 1.1\n"
@"- Nested 2\n"
@" 999. Nested 2.1\n"
@" 1. Nested 2.1.1\n"
@" 2. Nested 2.2\n"
@"\n"
// Example with empty line and tabs.
@"\tSource line 1\n"
@"\t\n"
@"\t\tSource line with tab\n"
@"\n"
// Third paragraph.
@"Third paragraph.\n"
@"\n"
// Warning and bug.
@"@warning *Important:* There is something important about this!\n"
@"We even write it in two lines!\n"
@"\n"
@"@bug *ID215:* Khm, still not working...\n"
@"\n"
// Method block.
@"@param name1 Description1\n"
@"@param name2 Description2\n"
@"@return Return value\n"
@"\tsplit into several lines.\n"
@"@exception exc1 Exception1\n"
@"@exception exc2 Exception2\n"
// Cross references.
@"@see link1\n"
@"@sa link2\n";
}
@end