Permalink
Browse files

Doxygen experimentation

  • Loading branch information...
1 parent d9c0247 commit a9a171a0604091cbf6a5d2d60280a42a79d2c0b4 @groue committed Nov 13, 2010
View
@@ -1,3 +1,4 @@
+DoxygenDocs.docset
# xcode
build/*
*.pbxuser
View
@@ -22,14 +22,56 @@
#import <Foundation/Foundation.h>
-
+/**
+ The GRYes class provides with a singleton which you can use as a true value
+ when controlling Mustache boolean sections.
+
+ This singleton object is safer and less ambiguous than [NSNumber numberWithBool:YES],
+ which GRMustache essentially considers as the integer 1.
+
+ @see GRYes#yes
+ @see GRMustache#strictBooleanMode
+ @see GRNo
+ @since v1.0.0
+ */
@interface GRYes : NSObject <NSCopying>
+/**
+ @returns the GRYes singleton.
+ @since v1.0.0
+ */
+ (GRYes *)yes;
+
+/**
+ @returns YES
+ @since v1.1.0
+ */
- (BOOL)boolValue;
@end
+/**
+ The GRNo class provides with a singleton which you can use as a false value
+ when controlling Mustache boolean sections.
+
+ This singleton object is safer and less ambiguous than [NSNumber numberWithBool:NO],
+ which GRMustache essentially considers as the integer 0, and not as a false
+ value.
+
+ @see GRNo#no
+ @see GRMustache#strictBooleanMode
+ @see GRYes
+ @since v1.0.0
+ */
@interface GRNo : NSObject <NSCopying>
+/**
+ @returns the GRNo singleton.
+ @since v1.0.0
+ */
+ (GRNo *)no;
+
+/**
+ @returns NO
+ @since v1.1.0
+ */
- (BOOL)boolValue;
@end
View
@@ -22,8 +22,44 @@
#import <Foundation/Foundation.h>
+/**
+ The GRMustache class provides with global-level information and configuration
+ of the GRMustache library.
+ @since v1.0.0
+ */
@interface GRMustache: NSObject
+
+/**
+ A Boolean value that determines whether GRMustache renders templates in strict
+ boolean mode.
+
+ @returns YES if GRMustache renders templates in strict boolean mode,
+ NO otherwise. The default value is NO.
+
+ In strict boolean mode, properties of context objects that are declared as BOOL
+ are interpreted as numbers, and can not be used for controlling Mustache
+ boolean sections.
+
+ In non-strict boolean mode, all properties declared as signed char (including
+ those declared as BOOL), are interpreted as booleans, and can be used for
+ controlling Mustache boolean sections.
+
+ @see GRMustache#setStrictBooleanMode:
+ @see GRYes
+ @see GRNo
+ @since v1.0.0
+ */
+ (BOOL)strictBooleanMode;
+
+/**
+ Sets the strict boolean mode of GMustache.
+
+ @param aBool YES if GRMustache should render templates in strict boolean mode,
+ NO otherwise.
+
+ @see GRMustache#strictBooleanMode
+ @since v1.0.0
+ */
+ (void)setStrictBooleanMode:(BOOL)aBool;
@end
@@ -23,5 +23,12 @@
#import <Foundation/Foundation.h>
+/**
+ The super class of GRMustacheTemplate.
+
+ Don't use it.
+
+ @since v1.0.0
+ */
@interface GRMustacheElement: NSObject
@end
@@ -23,15 +23,40 @@
#import <Foundation/Foundation.h>
-// The domain of returned errors
+/**
+ The domain of a GRMustache-generated NSError
+
+ @since v1.0.0
+*/
extern NSString* const GRMustacheErrorDomain;
-// The key containing the error line
+/**
+ When a GRMustache-generated NSError has the code GRMustacheErrorCodeParseError,
+ its userInfo dictionary contains the line where the parse error occurred, at
+ the key GRMustacheErrorLine.
+
+ @since v1.0.0
+*/
extern NSString* const GRMustacheErrorLine;
-// The codes of returned errors
+/**
+ The codes of a GRMustache-generated NSError
+
+ @since v1.0.0
+*/
typedef enum {
+ /**
+ The error code for parse errors.
+
+ @since v1.0.0
+ */
GRMustacheErrorCodeParseError,
+
+ /**
+ The error code for not found templates and partials.
+
+ @since v1.0.0
+ */
GRMustacheErrorCodeTemplateNotFound,
} GRMustacheErrorCode;
@@ -25,6 +25,11 @@
@class GRMustacheTemplateLoader;
+/**
+ The GRMustacheTemplate class provides with Mustache template rendering services.
+
+ @since v1.0.0
+ */
@interface GRMustacheTemplate: GRMustacheElement {
@private
GRMustacheTemplateLoader *templateLoader;
@@ -36,14 +41,149 @@
NSInteger curline;
NSMutableArray *elems;
}
+
+/**
+ Renders a context object from a template string
+
+ @returns A string containing the rendered template
+ @param object A context object used for interpreting Mustache tags
+ @param templateString The template string
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ @since v1.0.0
+ */
+ (NSString *)renderObject:(id)object fromString:(NSString *)templateString error:(NSError **)outError;
+
+/**
+ Renders a context object from a file template.
+
+ @returns A string containing the rendered template
+ @param object A context object used for interpreting Mustache tags
+ @param url The URL of the template
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ The template at url must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
+
+ @since v1.0.0
+ */
+ (NSString *)renderObject:(id)object fromContentsOfURL:(NSURL *)url error:(NSError **)outError;
+
+/**
+ Renders a context object from a bundle resource template.
+
+ @returns A string containing the rendered template
+ @param object A context object used for interpreting Mustache tags
+ @param name The name of a bundle resource of extension "mustache"
+ @param bundle The bundle where to look for the template resource
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ If you provide nil as a bundle, the resource will be looked in the main bundle.
+
+ The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
+
+ @since v1.0.0
+ */
+ (NSString *)renderObject:(id)object fromResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError;
+
+/**
+ Renders a context object from a bundle resource template.
+
+ @returns A string containing the rendered template
+ @param object A context object used for interpreting Mustache tags
+ @param name The name of a bundle resource
+ @param ext The extension of the bundle resource
+ @param bundle The bundle where to look for the template resource.
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ If you provide nil as a bundle, the resource will be looked in the main bundle.
+
+ The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
+
+ @since v1.0.0
+ */
+ (NSString *)renderObject:(id)object fromResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError;
+
+/**
+ Parses a template string, and returns a compiled template.
+
+ @returns A GRMustacheTemplate instance
+ @param templateString The template string
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ @since v1.0.0
+ */
+ (id)parseString:(NSString *)templateString error:(NSError **)outError;
+
+/**
+ Parses a template file, and returns a compiled template.
+
+ @returns A GRMustacheTemplate instance
+ @param url The URL of the template
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ The template at url must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
+
+ @since v1.0.0
+ */
+ (id)parseContentsOfURL:(NSURL *)url error:(NSError **)outError;
+
+/**
+ Parses a bundle resource template, and returns a compiled template.
+
+ @returns A GRMustacheTemplate instance
+ @param name The name of a bundle resource of extension "mustache"
+ @param bundle The bundle where to look for the template resource
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ If you provide nil as a bundle, the resource will be looked in the main bundle.
+
+ The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
+
+ @since v1.0.0
+ */
+ (id)parseResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError;
+
+/**
+ Parses a bundle resource template, and returns a compiled template.
+
+ @returns A GRMustacheTemplate instance
+ @param name The name of a bundle resource
+ @param ext The extension of the bundle resource
+ @param bundle The bundle where to look for the template resource
+ @param outError If there is an error loading or parsing template and partials, upon return
+ contains an NSError object that describes the problem.
+
+ If you provide nil as a bundle, the resource will be looked in the main bundle.
+
+ The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
+
+ @since v1.0.0
+ */
+ (id)parseResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError;
+
+/**
+ Renders a template with a context object.
+
+ @returns A string containing the rendered template
+ @param object A context object used for interpreting Mustache tags
+
+ @since v1.0.0
+ */
- (NSString *)renderObject:(id)object;
+
+/**
+ Renders a template without any context object for interpreting Mustache tags.
+
+ @returns A string containing the rendered template
+
+ @since v1.0.0
+ */
- (NSString *)render;
@end
Oops, something went wrong. Retry.

0 comments on commit a9a171a

Please sign in to comment.