Skip to content

Commit

Permalink
Cleaned up source code.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaz committed Feb 14, 2011
1 parent 6d03134 commit 1ad2f9d
Show file tree
Hide file tree
Showing 38 changed files with 86 additions and 5,910 deletions.
58 changes: 29 additions & 29 deletions Generating/GBDocSetOutputGenerator.m
Expand Up @@ -253,41 +253,41 @@ - (void)addTokensXmlModelObjectDataForObject:(GBModelBase *)object toData:(NSMut
[data setObject:[self tokenIdentifierForObject:object] forKey:@"identifier"]; [data setObject:[self tokenIdentifierForObject:object] forKey:@"identifier"];
[data setObject:[[object.sourceInfosSortedByName objectAtIndex:0] filename] forKey:@"declaredin"]; [data setObject:[[object.sourceInfosSortedByName objectAtIndex:0] filename] forKey:@"declaredin"];
if (object.comment) { if (object.comment) {
if (object.comment.hasParagraphs) [data setObject:object.comment.firstParagraph forKey:@"abstract"]; // if (object.comment.hasParagraphs) [data setObject:object.comment.firstParagraph forKey:@"abstract"];
if ([object.comment.crossrefs count] > 0) { // if ([object.comment.crossrefs count] > 0) {
NSMutableArray *related = [NSMutableArray arrayWithCapacity:[object.comment.crossrefs count]]; // NSMutableArray *related = [NSMutableArray arrayWithCapacity:[object.comment.crossrefs count]];
for (GBParagraphLinkItem *crossref in object.comment.crossrefs) { // for (GBParagraphLinkItem *crossref in object.comment.crossrefs) {
if (crossref.member) // if (crossref.member)
[related addObject:[self tokenIdentifierForObject:crossref.member]]; // [related addObject:[self tokenIdentifierForObject:crossref.member]];
else if (crossref.context) // else if (crossref.context)
[related addObject:[self tokenIdentifierForObject:crossref.context]]; // [related addObject:[self tokenIdentifierForObject:crossref.context]];
} // }
if ([related count] > 0) { // if ([related count] > 0) {
[data setObject:[GRYes yes] forKey:@"hasRelatedTokens"]; // [data setObject:[GRYes yes] forKey:@"hasRelatedTokens"];
[data setObject:related forKey:@"relatedTokens"]; // [data setObject:related forKey:@"relatedTokens"];
} // }
} // }
} }
if ([object isKindOfClass:[GBMethodData class]]) { if ([object isKindOfClass:[GBMethodData class]]) {
GBMethodData *method = (GBMethodData *)object; GBMethodData *method = (GBMethodData *)object;
[data setObject:method.formattedComponents forKey:@"formattedComponents"]; [data setObject:method.formattedComponents forKey:@"formattedComponents"];
[data setObject:method.methodPrefix forKey:@"prefix"]; [data setObject:method.methodPrefix forKey:@"prefix"];
if (method.comment) { if (method.comment) {
if (method.comment.hasParameters) { // if (method.comment.hasParameters) {
NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:[method.comment.parameters count]]; // NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:[method.comment.parameters count]];
for (GBCommentArgument *argument in method.comment.parameters) { // for (GBCommentArgument *argument in method.comment.parameters) {
NSMutableDictionary *argData = [NSMutableDictionary dictionaryWithCapacity:2]; // NSMutableDictionary *argData = [NSMutableDictionary dictionaryWithCapacity:2];
[argData setObject:argument.argumentName forKey:@"name"]; // [argData setObject:argument.argumentName forKey:@"name"];
[argData setObject:argument.argumentDescription forKey:@"abstract"]; // [argData setObject:argument.argumentDescription forKey:@"abstract"];
[arguments addObject:argData]; // [arguments addObject:argData];
} // }
[data setObject:arguments forKey:@"parameters"]; // [data setObject:arguments forKey:@"parameters"];
[data setObject:[GRYes yes] forKey:@"hasParameters"]; // [data setObject:[GRYes yes] forKey:@"hasParameters"];
} // }
if (method.comment.result) { // if (method.comment.result) {
NSDictionary *resultData = [NSDictionary dictionaryWithObject:method.comment.result forKey:@"abstract"]; // NSDictionary *resultData = [NSDictionary dictionaryWithObject:method.comment.result forKey:@"abstract"];
[data setObject:resultData forKey:@"returnValue"]; // [data setObject:resultData forKey:@"returnValue"];
} // }
} }
} }
} }
Expand Down
237 changes: 0 additions & 237 deletions Model/GBComment.h
Expand Up @@ -31,11 +31,6 @@
*/ */
@interface GBComment : NSObject { @interface GBComment : NSObject {
@private @private
NSMutableArray *_paragraphs;
NSMutableArray *_descriptionParagraphs;
NSMutableArray *_parameters;
NSMutableArray *_exceptions;
NSMutableArray *_crossrefs;
} }


///--------------------------------------------------------------------------------------- ///---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -63,242 +58,10 @@
*/ */
+ (id)commentWithStringValue:(NSString *)value sourceInfo:(GBSourceInfo *)info; + (id)commentWithStringValue:(NSString *)value sourceInfo:(GBSourceInfo *)info;


///---------------------------------------------------------------------------------------
/// @name Paragraphs handling
///---------------------------------------------------------------------------------------

/** Registers the `GBCommentParagraph` and adds it to the end of `paragraphs` array.
If `paragraphs` is `nil`, a new array is created before adding the given object to it and the given paragraph is assigned as `firstParagraph` (the object is also added to `paragraphs` array!).
@param paragraph Paragraph to register.
@exception NSException Thrown if the given paragraph is `nil`.
@see firstParagraph
@see paragraphs
*/
- (void)registerParagraph:(GBCommentParagraph *)paragraph;

/** The first paragraph from `paragraphs` list or `nil` if no paragraph is registered.
The value is automatically set when registering paragraphs, although it can be changed if needed. By default the value is set to the first paragraph registered.
@see registerParagraph:
@see paragraphs
@see shortDescription
@see descriptionParagraphs
*/
@property (retain) GBCommentParagraph *firstParagraph;

/** Paragraph used for short description.
This value is setup during post processing and represents object's short description. The difference between this and `firstParagraph` is that `firstParagraph` contains the whole of the first paragraph text, including potential special blocks such as warning, bug, lists, example etc. while `shortDescription` only contains text up to the first special block. This makes it much more suitable for using it as short description while generating output and it's in fact the reason for it's introduction.
@see paragraphs
@see descriptionParagraphs
*/
@property (retain) GBCommentParagraph *shortDescription;

/** `NSArray` containing all paragraphs of the comment.
The paragraphs are in same order as in the source code. First paragraph is used for short description and is also available via `firstParagraph`. Each object is a `GBCommentParagraph` instance and should be registered through `registerParagraph:` method.
@see firstParagraph
@see shortDescription
@see descriptionParagraphs
@see registerParagraph:
@see parameters
@see exceptions
@see result
*/
@property (readonly) NSArray *paragraphs;

///---------------------------------------------------------------------------------------
/// @name Description paragraphs handling
///---------------------------------------------------------------------------------------

/** Registers the `GBCommentParagraph` and adds it to the end of `descriptionParagraphs` array.
If `descriptionParagraphs` is `nil`, a new array is created before adding the given object to it.
@param paragraph Paragraph to register.
@exception NSException Thrown if the given paragraph is `nil`.
@see descriptionParagraphs
@see registerParagraph:
*/
- (void)registerDescriptionParagraph:(GBCommentParagraph *)paragraph;

/** `NSArray` containing all paragraphs that should be used for object description.
Description paragraph list's main purpose is to simplify templates. Depending the settings, the list either contains all paragraphs or excludes first one. This takes all guessing from templates and thus greatly simplifies it's work.
The paragraphs are in the same order as in the source code. Each object is a `GBCommentParagraph` instance and should be registered through `registerDescriptionParagraph:` method. This array may be the same as `paragraphs` or it may be different, depending the application settings. It's up to client code to provide the description paragraphs!
@see paragraphs
@see hasDescriptionParagraphs
@see registerDescriptionParagraph:
*/
@property (readonly) NSArray *descriptionParagraphs;

///---------------------------------------------------------------------------------------
/// @name Method arguments handling
///---------------------------------------------------------------------------------------

/** Registers the `GBCommentArgument` that describes a parameter and adds it to the end of `parameters` array.
If `parameters` is `nil`, a new array is created before adding the given object to it. If a parameter with the same name is already registered, a warning is logged and previous item is replaced with the given one.
@param parameter Parameter to register.
@exception NSException Thrown if the given parameter is `nil` or `[GBCommentArgument argumentName]` is `nil` or empty string.
@see parameters
@see replaceParametersWithParametersFromArray:
@see registerResult:
@see registerException:
@see registerCrossReference:
*/
- (void)registerParameter:(GBCommentArgument *)parameter;

/** Replaces all registered `parameters` with the objects from the given array.
The given array should only contain `GBCommentArgument` objects. If there are any parameters registered, they will be removed first! If `nil` or empty array is passed, current parameters are removed only.
@param array The array of parameters to register.
@exception NSException Thrown if any of the objects is invalid, see registerParameter: for details.
*/
- (void)replaceParametersWithParametersFromArray:(NSArray *)array;

/** Registers the `GBCommentParagraph` that describes method return value.
If a result is already registered, a warning is logged and previous result is replaced with the given one.
@param result Result to register.
@exception NSException Thrown if the given result is `nil`.
@see result
@see registerParameter:
@see registerException:
@see registerCrossReference:
*/
- (void)registerResult:(GBCommentParagraph *)result;

/** Registers the `GBCommentArgument` that describes an exception the method can raise and adds it to the end of `exceptions` array.
If `exceptions` is `nil`, a new array is created before adding the given object to it. If an exception with the same name is already registered, a warning is logged and previous item is replaced with the given one.
@param exception Exception to register.
@exception NSException Thrown if the given exception is `nil`.
@see exceptions
@see registerParameter:
@see registerResult:
@see registerCrossReference:
*/
- (void)registerException:(GBCommentArgument *)exception;

/** Registers the `GBParagraphLinkItem` as an explicit, comment-wide, cross reference and adds it to the end of `crossrefs` array.
If `crossrefs` is `nil`, a new array is created before adding the given object to it. If a reference to the same object is already registered, a warning is logged and nothing happens.
@param ref The cross reference to register.
@see crossrefs
@see registerParameter:
@see registerResult:
@see registerException:
@exception NSException Thrown if the given reference is `nil`.
*/
- (void)registerCrossReference:(GBParagraphLinkItem *)ref;

/** `NSArray` containing all method parameters described within the comment.
Parameters are in the order of declaration within code regardless of the order declared in the comment! Each object is a `GBCommentArgument` instance and should be registered through `registerParameter:` method.
@see registerParameter:
@see exceptions
@see result
@see crossrefs
@see paragraphs
*/
@property (readonly) NSArray *parameters;

/** The description of the method result or `nil` if this is not method comment or method has no result.
The description is a `GBCommentParagraph` instance and should be `registerResult:` to register the result.
@see registerResult:
@see parameters
@see exceptions
@see crossrefs
@see paragraphs
*/
@property (readonly,retain) GBCommentParagraph *result;

/** `NSArray` containing all exceptions commented method can raise as described within the comment.
Exceptions are in the order of declaration in the comment. Each object is a `GBCommentArgument` instance and should be registered through `registerException:` method.
@see registerException:
@see parameters
@see result
@see crossrefs
@see paragraphs
*/
@property (readonly) NSArray *exceptions;

/** `NSArray` containing all explicit cross references as described within the comment.
Cross references can point to an URL, local member, another object or remote member. They are listed in the order as declared in the comment. Each object is a `GBParagraphLinkItem` instance and should be registered through `registerCrossReference:` method.
@see registerCrossReference:
@see parameters
@see result
@see exceptions
@see paragraphs
*/
@property (readonly) NSArray *crossrefs;

///--------------------------------------------------------------------------------------- ///---------------------------------------------------------------------------------------
/// @name Output generator helpers /// @name Output generator helpers
///--------------------------------------------------------------------------------------- ///---------------------------------------------------------------------------------------


/** Indicates whether the comment has at least one paragraph or not.
This is used mainly to simplify template output generators. Programmatically this method is equal to testing whether `paragraphs` count is greater than 0, like this: `[object.paragraphs count] > 0`.
@see hasDescriptionParagraphs
@see paragraphs
*/
@property (readonly) BOOL hasParagraphs;

/** Indicates whether the comment has at least two paragraphs or not.
This is used mainly to simplify template output generators. Programmatically this method is equal to testing whether `descriptionParagraphs` count is greater than 0, like this: `[object.descriptionParagraphs count] > 0`.
@see hasParagraphs
@see paragraphs
*/
@property (readonly) BOOL hasDescriptionParagraphs;

/** Indicates whether the comment has at least one parameter or not.
This is used mainly to simplify template output generators. Programmatically this method is equal to testing whether `parameters` count is greater than 0, like this: `[object.parameters count] > 0`.
@see parameters
*/
@property (readonly) BOOL hasParameters;

/** Indicates whether the comment has at least one exception or not.
This is used mainly to simplify template output generators. Programmatically this method is equal to testing whether `exceptions` count is greater than 0, like this: `[object.exceptions count] > 0`.
@see exceptions
*/
@property (readonly) BOOL hasExceptions;

/** Indicates whether the comment has at least one cross reference or not.
This is used mainly to simplify template output generators. Programmatically this method is equal to testing whether `crossrefs` count is greater than 0, like this: `[object.crossrefs count] > 0`.
@see exceptions
*/
@property (readonly) BOOL hasCrossrefs;

/** Specifies whether the comment is copied from another object or this is the original comment from source code. /** Specifies whether the comment is copied from another object or this is the original comment from source code.
This flag is used to ignore unknown cross references warnings for comments copied from another object. This flag is used to ignore unknown cross references warnings for comments copied from another object.
Expand Down

0 comments on commit 1ad2f9d

Please sign in to comment.