-
Notifications
You must be signed in to change notification settings - Fork 2
/
DocCategoryPage.m
72 lines (57 loc) · 1.74 KB
/
DocCategoryPage.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
/*
Copyright (C) 2010 Quentin Mathe
Author: Quentin Mathe <quentin.mathe@gmail.com>
Date: December 2010
License: Modified BSD (see COPYING)
*/
#import "DocCategoryPage.h"
#import "DocHeader.h"
#import "DocCDataType.h"
#import "DocFunction.h"
#import "DocIndex.h"
#import "DocMethod.h"
#import "GSDocParser.h"
#import "DocHTMLElement.h"
@interface DocPage ()
- (DocHTMLElement *) HTMLRepresentationWithTitle: (NSString *)aTitle elements: (NSArray *)elements;
@end
@implementation DocCategoryPage
- (void) dealloc
{
methodGroups = nil;
}
- (void) addMethodGroup: (DocElementGroup *)aMethodGroup
{
if (methodGroups == nil)
{
methodGroups = [[NSMutableArray alloc] init];
}
[methodGroups addObject: aMethodGroup];
}
// TODO: This method shouldn't be invoked in DocPageWeaver and should be removed
// in DocPage. The current method group can be memorized in DocPageWeaver.
- (void) addMethod: (DocMethod *)aMethod
{
[[methodGroups lastObject] addElement: aMethod];
}
- (DocHTMLElement *) HTMLRepresentationForHeader: (DocHeader *)aHeader
{
return [aHeader HTMLRepresentationWithTitleBlockElement: [H1 with: [aHeader title]]];
}
- (DocHTMLElement *) HTMLRepresentationForMethodGroupHeader: (DocHeader *)aHeader
{
ETAssert([aHeader categoryName] != nil);
return [aHeader HTMLRepresentationWithTitleBlockElement: [H2 with: [aHeader categoryName]]];
}
- (NSArray *) mainContentHTMLRepresentations
{
NSMutableArray *reps = [NSMutableArray array];
for (DocElementGroup *methodGroup in methodGroups)
{
H hHeader = [[methodGroup header] HTMLRepresentation];
H hMethods = [self HTMLRepresentationWithTitle: nil elements: [methodGroup elementsBySubgroup]];
[reps addObject: [DIV class: @"methodGroup" with: hHeader and: hMethods]];
}
return reps;
}
@end