Download presentation
Presentation is loading. Please wait.
Published byRosalyn Edwards Modified over 8 years ago
1
Using HeaderDoc to make complete documentation as Html file. By Naveed Khalid
2
// // File Name.ext // Project Name // // Created by on dd/mm/yyyy. // Copyright 2014 (c). All rights reserved. // File Header Comment
3
HeaderDoc is a tool that you can run from the command-line. Basically it scans your files for comments made in a particular style. Following that particular style will help in documentation on the go! Which particular style? HeaderDoc Comment
4
Three styles of comments that HeaderDoc scans for: Option 1: /// Your documentation comment will go here Option 2: /** * Your documentation comment will go here */ Option 3: /*! * Your documentation comment will go here */ HeaderDoc Comment
5
Three styles of comments that HeaderDoc scans for: Option 1: /// Your documentation comment will go here Option 2: /** * Your documentation comment will go here */ Option 3: /*! * Your documentation comment will go here */ HeaderDoc Comment These are similar to “normal” comments, except that there’s an extra / in option 1, and an extra character in the first line of options 2 and 3 (* and !, respectively).
6
For single line comments, use the triple forward slash syntax (///) For multiline comments, use the style used in Apple’s documentation (/*!) Best Way?
7
A tag starts with the @ symbol and a keyword, followed by a space, and a string that contains a description relative to that keyword (such as @param foo). Top-Level Tags: These are tags that declare the type of thing you are commenting (Headers, classes, methods, etc). An example of a top-level tag is @typedef. Second-Level Tags: These tags help to give more detail about the specific thing you are commenting. Such as @brief, @abstract etc. HeaderDoc Tags?
8
Some Second-level Tags @abstractA short string that briefly describes anything. This should not contain multiple lines @briefEquivalent to @abstract. Provided for better Doxygen compatibility. @discussionA block of text that describes a function, class, header, or data type in detail. @paramThe name and description of a parameter to a function @returnDescribes the return values expected from this function. Don't include if the return value is void @resultSame as @return
9
Example of @class tag in Objective-C /*! @class myClass @inherits Base class @conforms List of protocol name those this class conforms to @discussion This is a discussion. It can span many lines or paragraphs. */ @interface myClass : NSObject @end Classes, Protocols, and Interfaces
10
Example of @protocol tag in Objective-C /*! @protocol myProtocol @discussion This is a discussion. It can span many lines or paragraphs. */ @protocol myProtocol @end Classes, Protocols, and Interfaces
11
Example of @category tag in Objective-C /*! @category myMainClass(myCategory) @discussion This is a discussion. It can span many lines or paragraphs. */ @interface myMainClass(myCategory) @end Classes, Protocols, and Interfaces
12
/*! * @discussion A really simple way to calculate the sum of two numbers. * @param firstNumber An NSInteger to be used in the summation of two numbers * @param secondNumber The second half of the equation. * @return The sum of the two numbers passed in. */ Documenting Methods
13
To inform about add a @warning tag. Add the following text just above the @return tag: * @warning Please make note that this method is only good for adding non-negative numbers. Warnings
14
Example of @property tag /*! @property Property name @brief The ViewController class' car object. */ Documenting Property
15
Example of @var tag /*! @var we_are_root @abstract Tells whether this device is the root power domain @discussion TRUE if this device is the root power domain. For more information on power domains.... */ bool we_are_root; Documenting Variables
16
Example of @const tag /*! @const kCFTypeArrayCallBacks @abstract Predefined CFArrayCallBacks structure containing a set of callbacks appropriate... @discussion Extended discussion goes here. */ const CFArrayCallBacks kCFTypeArrayCallBacks; Documenting Constants
17
Example of @enum tag /*! @enum Enumeration name @discussion Detail description of enum */ Documenting Enumeration
18
/*! * @typedef OldCarType * @brief A list of older car types. * @constant OldCarTypeModelT A cool old car. * @constant OldCarTypeModelA A sophisticated old car. */ typedef enum { OldCarTypeModelT, OldCarTypeModelA } OldCarType; Documenting Enumeration
19
typedef enum { /// A cool, old car. OldCarTypeModelT, /// A sophisticated older car. OldCarTypeModelA } OldCarType; Documenting Enumeration
20
/*! * @brief The car will drive, and then execute the drive block * @param completion A driveCompletion block * @code [car driveCarWithCompletion:^(CGFloat distance){ NSLog(@"Distance driven %f", distance); }]; */ Adding Formatted Code
21
// FIXME: This is broken // !!!: Holy cow, it should be checked! // ???: Perhaps check if the block is not nil first? Other Comments
22
/*! * @discussion * @param * @return */ Code Snippet for comments
23
Open terminal cd /path/to/your/folder headerdoc2html -o ~/Desktop/destinationFolder sourceFolder/ Now to create a Master TOC cd ~/Desktop/documentation gatherheaderdoc. Finalizing: Creating Html
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.