My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DocumentationPolicy  
Documenting the Core Plot framework
documentation, Phase-Implementation
Updated Jun 20, 2010 by drewmcco...@mac.com

Introduction

Good, concise documentation is essential if other developers want to use the framework. To create the API documentation we use doxygen.

Required Tools

Doxygen is not part of the apple developers tools. It can be downloaded here. Doxygen.app should be installed in /Applications.

Doxygen relies on an external program, Graphviz, to generate graphical class diagrams. It can be downloaded here.

Building the Documentation

Both project files (CorePlot.xcodeproj and CorePlot-CocoaTouch.xcodeproj) contain a build target called "Documentation". This target compiles the documentation and automatically adds a documentation feed to the XCode documentation. Each project builds a documentation set that is specific to the project architecture (Mac or iPhone). The documentation sets have unique names and can be installed concurrently on the same machine.

Documentation Policy

This section describe how and where the code should be documented. Doxygen supports two ways of putting commands in comments, with slashes and with @-signs, we use @-signs. All documentation goes into the implementation(.m) file with the exception of protocol declarations, struct definitions, enum declarations, and grouping commands that doxygen requires to be in the header file.

Classes

The class documentation block goes just before the @implementation of the implementation file. The documentation should consist of a @brief stating the purpose of the class in one sentence and a more elaborate description on the purpose, use and subclassing of the class. Think of this as a 'Overview' section in Apple's API documentation. If the classes has multiple initializers, indicate the designated initializer.

Properties

Properties are documented before their @synthesize or @dynamic using a comment block as follows:

/** @property myProperty
 *  @brief Property is very useful
 *  Useful and there is a lot more to tell about this property **/
@synthesize myProperty;

The @property is required as doxygen cannot find the property name otherwise.

Accessor properties like readonly, copy/retain/assign, and nonatomic are automatically added and should not occur in the manual part of the documentation.

Member functions

Member functions are documented just before the implementation. The documentation block should always include a @brief and a description as well as a description of the parameters and return value using the @param and @return commands.

Structs and enums

Structures and enumerations are defined and documented in the header file. They require at least a @brief description for the struct or enum as a whole and for each component. The single line shorthand documentation comment (///<) can be used for the individual components.

/**
 *	@brief RGBA color for gradients
 **/
typedef struct _CPRGBAColor {
	CGFloat red;	///< The red component (0 ≤ red ≤ 1).
	CGFloat green;	///< The green component (0 ≤ green ≤ 1).
	CGFloat blue;	///< The blue component (0 ≤ blue ≤ 1).
	CGFloat alpha;	///< The alpha component (0 ≤ alpha ≤ 1).
} CPRGBAColor;

Implementation

#import "CPColorSpace.h"

@interface CPColorSpace ()

+(CGColorSpaceRef)createGenericRGBSpace;

-(void)setCGColorSpace:(CGColorSpaceRef)newSpace;

@end

/** @brief Wrapper around CGColorSpaceRef
 *  A wrapper class around CGColorSpaceRef
 *
 * @todo More documentation needed 
 **/

@implementation CPColorSpace

/** @property cgColorSpace. 
 * @brief The CGColorSpace to wrap around **/
@synthesize cgColorSpace;


/** @brief Creates and returns a instance of CPColorSpace initialized with the standard RGB space
 * Creates and returns a instance of CPColorSpace initialized with the standard RGB space. 
 * For the iPhone this is CGColorSpaceCreateDeviceRGB(), for Mac OS X CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB).
 **/
+(CGColorSpaceRef)createGenericRGBSpace;
{
#if TARGET_IPHONE_SIMULATOR ||TARGET_OS_IPHONE
	return CGColorSpaceCreateDeviceRGB();
#else
	return CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); 
#endif
} 

// This caches a generic RGB colorspace for repeated use
/** @brief Returns a shared instance of CPColorSpace initialized with the standard RGB space
 * Creates and returns a instance of CPColorSpace initialized with the standard RGB space. 
 * For the iPhone this is CGColorSpaceCreateDeviceRGB(), for Mac OS X CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB).
 *
 *  @return A shared CPColorSpace object initialized with the standard RGB colorspace.
 **/
+(CPColorSpace *)genericRGBSpace;
{ 
	static CPColorSpace *space = nil;
&hellips;

/** @brief Initializes a newly allocated colorspace object with the specified colorSpace
 *  Initializes a newly allocated colorspace object with the specified colorSpace. This is the designated initializer.
 *  @return The initialized CPColorSpace object.
 **/
-(id)initWithCGColorSpace:(CGColorSpaceRef)colorSpace {
    if ( self = [super init] ) {
...

@end
Comment by andrejs....@gmail.com, May 5, 2010

Cannot install and use the documentation !!

Comment by Mike....@gmail.com, Mar 15, 2011

I recently upgraded to XCode 4 and after manually copying over the docsets. I have experienced crashes in XCode whenever I try to access the documentation window.

Crashes went away after I removed the docsets. Is this an Apple bug or do you need to update your docsets from deoxygen, or does deoxygen need an update?

Comment by o...@onno.com, Apr 5, 2011

Is there any other way to access the documentation? I have the same Xcode 4 problem.

Comment by project member eskr...@mac.com, Apr 5, 2011

After you build the documentation, you should have a docset file in CorePlot?/framework. In the Finder, right-click the docset and select "Show package contents". Inside the docset package, open the html folder and find index.html. Open this file in your favorite browser.

Comment by deratr...@gmail.com, Apr 28, 2011

Someone put the doc online and I found it quite helpful so for these interested here it is: http://florent.clairambault.fr/downloads/iPhone/core-plot-doc/index.html

Comment by benjamin...@gmail.com, Apr 29, 2011

The doc you found online is nearly one year old (Generated on Thu Jun 3 21:52:42 2010). It is not recommendable to use it.

Comment by 28mor...@gmail.com, Sep 21, 2011

Hello everyone, if you want to ONLY VIEW the documentation and experience no crashes with Xcode 4, I highly recommend what eskr...@mac.com is suggesting. You do NOT need deoxygen or any other tool to build the 0.4 Documentations. It has been done for you already. When you unzip "CorePlot?_0.4.zip" in Finder, navigate to Documentation folder, right click and Show Package Contents of the any of the documentation sets (com.CorePlot?.Framework.docset or com.CorePlotTouch?.Framework). Find "index.html" under "Contents/Resources/Documents/".

Good luck!

Comment by emile.co...@gmail.com, Dec 15, 2011

It would be nice if there were an official online copy of the HTML documentation (for the latest stable release). Just about every (serious) open-source library I've ever used has online documentation. I'm surprised core-plot doesn't already have this.

Comment by project member eskr...@mac.com, Dec 17, 2011

Links to the latest MacOS and iOS API documentation have been added to the Core Plot project home page ( http://code.google.com/p/core-plot/ ). Starting with the next release, we will also post links to the docs for each release package.

Comment by emile.co...@gmail.com, Dec 21, 2011

Thank you for the documentation links!


Sign in to add a comment
Powered by Google Project Hosting