Skip to content
This repository
Browse code

Fixed unknown members links handling.

Instead of "blindly" converting all detected member links to the actual references, each possible link is tested. If the given member exists, the reference is generated, otherwise an error is output so that the user can see and correct it. Note that at this moment, verbose output level would probably need to be set to make it easier to pinpoint the error, although project find would also do it anyway.
  • Loading branch information...
commit b6420bc689cf7d04c6284bd04866e429dee1eebf 1 parent 5bd0e8c
tomaz authored
2  CommandLineParser.h
@@ -68,7 +68,7 @@ are reset and then the given command line parsed.
68 68
 						   ofCount:(int) argc;
69 69
 
70 70
 /** Outputs the utility usage to the standard output.
71  
-
  71
+ 
72 72
 @see parseCommandLineArguments:ofCount:
73 73
 */
74 74
 - (void) printUsage;
30  DoxygenConverter+CleanXML.m
@@ -1060,6 +1060,10 @@ - (void) fixParaLinksForObject:(NSString*) objectName
1060 1060
 	NSMutableDictionary* replacements = [NSMutableDictionary dictionary];
1061 1061
 	NSMutableDictionary* obsfucations = [NSMutableDictionary dictionary];
1062 1062
 	
  1063
+	// Get given object members. This is used for testing links to the members of the
  1064
+	// same object.
  1065
+	NSDictionary* objectMembers = [objectData objectForKey:kTKDataObjectMembersKey];
  1066
+	
1063 1067
 	// We also need to handle broken doxygen member links handling. This is especially
1064 1068
 	// evident in categories where the links to member functions are not properly
1065 1069
 	// handled at all. At the moment we only handle members which are expressed either
@@ -1085,9 +1089,18 @@ - (void) fixParaLinksForObject:(NSString*) objectName
1085 1089
 			{
1086 1090
 				NSString* member = [word substringFromIndex:2];
1087 1091
 				NSString* name = [self memberLinkNameForObject:objectName andMember:member];
1088  
-				NSString* link = [NSString stringWithFormat:@"<ref id=\"#%@\">%@</ref>", member, name];
  1092
+				NSString* link = nil;
  1093
+				if ([objectMembers objectForKey:member])
  1094
+				{
  1095
+					link = [NSString stringWithFormat:@"<ref id=\"#%@\">%@</ref>", member, name];
  1096
+					logDebug(@"  - Found reference to %@ at '#%@'.", member, member);
  1097
+				}
  1098
+				else
  1099
+				{
  1100
+					link = name;
  1101
+					logError(@"- Found reference to unknown member %@!", member);
  1102
+				}
1089 1103
 				[replacements setObject:link forKey:word];
1090  
-				logDebug(@"  - Found reference to %@ at '#%@'.", member, member);
1091 1104
 			}
1092 1105
 			
1093 1106
 			// Fix members that are declated with parenthesis. Skip words which are composed
@@ -1159,9 +1172,18 @@ - (void) fixParaLinksForObject:(NSString*) objectName
1159 1172
 					{
1160 1173
 						NSString* member = [word substringToIndex:[word length] - 2];
1161 1174
 						NSString* name = [self memberLinkNameForObject:objectName andMember:member];
1162  
-						NSString* link = [NSString stringWithFormat:@"<ref id=\"#%@\">%@</ref>", member, name];
  1175
+						NSString* link = nil;
  1176
+						if ([objectMembers objectForKey:member])
  1177
+						{
  1178
+							link = [NSString stringWithFormat:@"<ref id=\"#%@\">%@</ref>", member, name];
  1179
+							logDebug(@"  - Found reference to %@ at '#%@'.", member, member);
  1180
+						}
  1181
+						else
  1182
+						{
  1183
+							link = name;
  1184
+							logError(@"- Found reference to unknown member %@!", member);
  1185
+						}
1163 1186
 						[replacements setObject:link forKey:word];
1164  
-						logDebug(@"  - Found reference to %@ at '#%@'.", member, member);
1165 1187
 					}
1166 1188
 				}
1167 1189
 			}
2  DoxygenConverter+Helpers.h
@@ -31,7 +31,7 @@ will return the transformed object which is either an @c NSXMLDocument if transf
31 31
 created an XML or @c NSData otherwise. If transformation failed, @c nil is returned and
32 32
 error description is passed over the @c error parameter.
33 33
  
34  
-This message internally sends @c applyXSLTFromFile:toDocument:arguments:error() with
  34
+This message internally sends @c applyXSLTFromFile:toDocument:arguments:error:() with
35 35
 arguments set to @c nil.
36 36
 
37 37
 @param filename The name of the XSLT file including full path.
8  GeneratorBase+HierarchySubclassAPI.h
@@ -97,8 +97,8 @@ information about the member by using the hierarchy member data methods from the
97 97
 @param index Zero based index of the member within the group.
98 98
 @exception NSException Thrown if appending fails.
99 99
 @see GeneratorBase::outputDataForHierarchy
100  
-@see appendHierarchyGroupHeaderToData:type:
101  
-@see appendHierarchyGroupFooterToData:type:
  100
+@see appendHierarchyGroupHeaderToData:
  101
+@see appendHierarchyGroupFooterToData:
102 102
 @see generateHierarchyGroupChildrenToData:forItem:
103 103
 */
104 104
 - (void) appendHierarchyGroupItemToData:(NSMutableData*) data
@@ -114,9 +114,9 @@ information about the member by using the hierarchy member data methods from the
114 114
 This should be sent by the subclass from it's @c appendHierarchyGroupItemToData:fromItem:index:()
115 115
 override at the point where all children should be processed. It will check if any
116 116
 children are defined for the given item and will in turn send the subclass all hierarchy
117  
-group appending methods: @c appendHierarchyGroupHeaderToData:type:(), 
  117
+group appending methods: @c appendHierarchyGroupHeaderToData:(), 
118 118
 @c appendHierarchyGroupItemToData:fromItem:index:() and
119  
-@c appendHierarchyGroupFooterToData:type:() for all children, including their children
  119
+@c appendHierarchyGroupFooterToData:() for all children, including their children
120 120
 and so on recursively until no more children are found.
121 121
 
122 122
 @param data The @c NSMutableData to append to.
10  GeneratorBase+ObjectParsingAPI.h
@@ -126,9 +126,9 @@ The result is one of the following:
126 126
 
127 127
 /** Extracts the member prototype item from the given member item.
128 128
 
129  
-The returned item can be used by @c extractPrototypeSubitemsFromItem:() to get 
130  
-individual components. Then use @c extractPrototypeSubnodeTypeFromItem:() and
131  
-@c extractPrototypeSubnodeValueFromItem:() to get data for the individual components.
  129
+The returned item can be used by @c extractObjectMemberPrototypeSubitems:() to get 
  130
+individual components. Then use @c extractObjectMemberPrototypeItemType:() and
  131
+@c extractObjectMemberPrototypeItemValue:() to get data for the individual components.
132 132
  
133 133
 @param item The member item which prototype item to return.
134 134
 @return Returns the member prototype item or @c nil if not found.
@@ -314,7 +314,7 @@ This can be used over the items of the array returned from
314 314
 - @c kTKPrototypeValue: The item represents a value.
315 315
 - @c kTKPrototypeParameter: The item represents a parameter name.
316 316
 
317  
-To get the actual value, use @c extractPrototypeSubnodeValueFromItem:() passing the 
  317
+To get the actual value, use @c extractObjectMemberPrototypeItemValue:() passing the 
318 318
 result of this method as the @c type parameter.
319 319
 
320 320
 @param item The prototype item to check.
@@ -328,7 +328,7 @@ result of this method as the @c type parameter.
328 328
 /** Extracts the given prototype component value from the given prototype item.
329 329
 
330 330
 This can be used over the items of the array returned from
331  
-@c extractPrototypeSubitemsFromItem:().
  331
+@c extractObjectMemberPrototypeSubitems:().
332 332
  
333 333
 @param item The prototype item to check.
334 334
 @return Returns the string value representation of the given prototype item.
2  GeneratorBase+ObjectSubclassAPI.h
@@ -56,7 +56,7 @@ generated. This is ussually the place to "close" open tags or similar.
56 56
 The message is sent from the @c GeneratorBase::outputDataForObject() just before object info 
57 57
 items are generated. It gives subclasses a chance to append data to the output before the 
58 58
 generation for secion items starts. After this message is sent, at least one 
59  
-@c appendObjectInfoItemToData:fromItem:index:() message is sent and then 
  59
+@c appendObjectInfoItemToData:fromItems:index:type:() message is sent and then 
60 60
 @c appendObjectInfoHeaderToData:() is sent at the end.
61 61
 
62 62
 @param data The data to append to. This is guaranteed to be non @c null.
13  GeneratorBase.h
@@ -65,7 +65,7 @@ make their job easier.
65 65
 Each concrete subclass can convert three types of files - index, hierarchy and object files.
66 66
 The subclass can only override the methods for generating output that makes sense for the 
67 67
 implemented output type. The clients send @c generateOutputForIndex:toFile:() to generate the
68  
-main index file, @c generateOutputForHierarchy:toFile() to generate the main hierarchy
  68
+main index file, @c generateOutputForHierarchy:toFile:() to generate the main hierarchy
69 69
 file and @c generateOutputForObject:toFile:() to generate the documentation for
70 70
 individual objects.
71 71
  
@@ -200,26 +200,21 @@ the subclass can get the XML document through the @c objectMarkup property.
200 200
  
201 201
 By default, this will send several higher level messages which can be overriden instead.
202 202
 The messages are sent in the following order:
203  
-- @c appendObjectHeaderToData:()
204  
- 
  203
+- @c appendObjectHeaderToData:() 
205 204
 - @c appendObjectInfoHeaderToData:() @a *
206 205
 - @c appendObjectInfoItemToData:fromItems:index:type:() @a **
207  
-- @c appendObjectInfoFooterToData:() @a *
208  
- 
  206
+- @c appendObjectInfoFooterToData:() @a * 
209 207
 - @c appendObjectOverviewToData:fromItem:() @a *
210  
-
211 208
 - @c appendObjectTasksHeaderToData:() @a *
212 209
 - @c appendObjectTaskHeaderToData:fromItem:index:() @a **
213 210
 - @c appendObjectTaskMemberToData:fromItem:index:() @a **
214 211
 - @c appendObjectTaskFooterToData:fromItem:index:() @a **
215  
-- @c appendObjectTasksFooterToData:() @a *
216  
- 
  212
+- @c appendObjectTasksFooterToData:() @a * 
217 213
 - @c appendObjectMembersHeaderToData:() @a *
218 214
 - @c appendObjectMemberGroupHeaderToData:type:() @a **
219 215
 - @c appendObjectMemberToData:fromItem:index:() @a **
220 216
 - @c appendObjectMemberGroupFooterToData:type:() @a **
221 217
 - @c appendObjectMembersFooterToData:() @a *
222  
- 
223 218
 - @c appendObjectFooterToData:()
224 219
  
225 220
 Note that only a subset of above messages may be sent for a particular object, depending
24  GeneratorBase.m
@@ -45,7 +45,7 @@ @interface GeneratorBase ()
45 45
 @see generateOutputForObject
46 46
 @see generateOverviewSectionToData:
47 47
 @see generateTasksSectionToData:
48  
-@see generateMembersSectionToData:
  48
+@see generateObjectMembersSectionToData:
49 49
 @see generateObjectInfoSectionToData:fromNodes:index:type:
50 50
 */
51 51
 - (void) generateObjectInfoSectionToData:(NSMutableData*) data;
@@ -78,14 +78,14 @@ - (void) generateObjectInfoSectionToData:(NSMutableData*) data
78 78
 /** Generates the object overview data if necessary.
79 79
 
80 80
 This is where the following messages are sent to the subclass:
81  
-- @c appendObjectOverviewToData:()
  81
+- @c appendObjectOverviewToData:fromItem:()
82 82
 
83 83
 @param data The @c NSMutableData to append to.
84 84
 @exception NSException Thrown if generation fails.
85 85
 @see generateOutputForObject
86 86
 @see generateObjectInfoSectionToData:
87 87
 @see generateTasksSectionToData:
88  
-@see generateMembersSectionToData:
  88
+@see generateObjectMembersSectionToData:
89 89
 */
90 90
 - (void) generateObjectOverviewSectionToData:(NSMutableData*) data;
91 91
 
@@ -93,9 +93,9 @@ - (void) generateObjectOverviewSectionToData:(NSMutableData*) data;
93 93
 
94 94
 This is where the following messages are sent to the subclass:
95 95
 - @c appendObjectTasksHeaderToData:()
96  
-- @c appendObjectTaskHeaderToData:fromItem:index()
  96
+- @c appendObjectTaskHeaderToData:fromItem:index:()
97 97
 - @c appendObjectTaskMemberToData:fromItem:index:()
98  
-- @c appendObjectTaskFooterToData:fromItem:index()
  98
+- @c appendObjectTaskFooterToData:fromItem:index:()
99 99
 - @c appendObjectTasksFooterToData:()
100 100
 
101 101
 @param data The @c NSMutableData to append to.
@@ -103,7 +103,7 @@ - (void) generateObjectOverviewSectionToData:(NSMutableData*) data;
103 103
 @see generateOutputForObject
104 104
 @see generateObjectInfoSectionToData:
105 105
 @see generateOverviewSectionToData:
106  
-@see generateMembersSectionToData:
  106
+@see generateObjectMembersSectionToData:
107 107
 */
108 108
 - (void) generateObjectTasksSectionToData:(NSMutableData*) data;
109 109
 
@@ -125,7 +125,7 @@ - (void) generateObjectMembersSectionToData:(NSMutableData*) data;
125 125
 
126 126
 /** Generates the given main members documentation section.
127 127
 
128  
-This is sent from @c generateMembersSectionToData:() for each group of members that
  128
+This is sent from @c generateObjectMembersSectionToData:() for each group of members that
129 129
 has at least one documented entry. This is where the following messages are sent to the 
130 130
 subclass:
131 131
 - @c appendIndexGroupHeaderToData:type:()
@@ -141,7 +141,7 @@ - (void) generateObjectMembersSectionToData:(NSMutableData*) data;
141 141
 @param nodes The array of @c NSXMLElement instances representing individual members.
142 142
 @param type The type of the instances.
143 143
 @exception NSException Thrown if generation fails.
144  
-@see generateMembersSectionToData:
  144
+@see generateObjectMembersSectionToData:
145 145
 */
146 146
 - (void) generateObjectMemberSectionToData:(NSMutableData*) data 
147 147
 								 fromNodes:(NSArray*) nodes 
@@ -168,9 +168,9 @@ - (void) generateIndexGroupSectionsToData:(NSMutableData*) data;
168 168
 
169 169
 This is sent from @c generateIndexGroupSectionsToData:() for each group that has at
170 170
 least one member. This is where the following messages are sent to the subclass:
171  
-- @c appendIndexHeaderToData:type:()
172  
-- @c appendindexGroup()
173  
-- @c appendIndexFooterToData:type:()
  171
+- @c appendIndexGroupHeaderToData:type:()
  172
+- @c appendIndexGroupItemToData:fromItem:index:type:()
  173
+- @c appendIndexGroupFooterToData:type:()
174 174
 
175 175
 The @c type parameter can be one of the following:
176 176
 - @c kTKObjectMemberTypeClass: The @c nodes describes class members.
@@ -181,7 +181,7 @@ - (void) generateIndexGroupSectionsToData:(NSMutableData*) data;
181 181
 @param nodes The array of @c NSXMLElement instances representing individual members.
182 182
 @param type The type of the instances.
183 183
 @exception NSException Thrown if generation fails.
184  
-@see generateMembersSectionToData:
  184
+@see generateObjectMembersSectionToData:
185 185
 */
186 186
 - (void) generateIndexGroupSectionToData:(NSMutableData*) data 
187 187
 							   fromNodes:(NSArray*) nodes 

0 notes on commit b6420bc

Please sign in to comment.
Something went wrong with that request. Please try again.