Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding TODO macros (+ ObjcSubscripting support for older SDKs). Reorg…

…anizing repo.
  • Loading branch information...
commit bb47f42d74ecdabcd6ecd6f315a0a522f722eee1 1 parent 319570f
@AliSoftware authored
View
28 ObjcSubscriptingSupport.h
@@ -0,0 +1,28 @@
+//
+// ObjcSubscriptingSupport.h
+//
+// Created by Olivier Halligon on 02/10/12.
+//
+//
+
+#import <Foundation/Foundation.h>
+
+#if __has_feature(objc_subscripting)
+#if (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED < 1070) /* Define this on OSX only if prior to 10.7 */ \
+|| (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < 60000) /* Define this on iOS only if prior to 6.0 */
+
+@interface NSArray(ObjcLiterals)
+-(id)objectAtIndexedSubscript:(NSUInteger)index;
+@end
+@interface NSMutableArray(ObjcLiterals)
+-(void)setObject:(id)anObject atIndexedSubscript:(NSUInteger)index;
+@end
+@interface NSDictionary(ObjcLiterals)
+-(id)objectForKeyedSubscript:(id)aKey;
+@end
+@interface NSMutableDictionary(ObjcLiterals)
+-(void)setObject:(id)anObject forKeyedSubscript:(id<NSCopying>)aKey;
+@end
+
+#endif
+#endif
View
30 TODOMacros.h
@@ -0,0 +1,30 @@
+//
+// TODOMacros.h
+//
+// Created by Olivier Halligon on 02/10/12.
+//
+//
+
+#define GENERATE_PRAGMA(x) _Pragma(#x)
+
+/*
+ * Usage: Use TODO("some message") / FIXME("some message") / NOTE("some message") to generate appropriate warnings
+ */
+#define TODO(x) GENERATE_PRAGMA(message("[TODO] " #x))
+#define FIXME(x) GENERATE_PRAGMA(message("[FIXME] " #x))
+#define NOTE(x) GENERATE_PRAGMA(message("[NOTE] " #x))
+
+/* Usage example:
+ * view.frame = CGRectMake(0, 0, MAGIC_NUMBER(77), MAGIC_NUMBER(90));
+ * // will warn you that you should replace values 77 and 90 with constants later, because magic numbers are bad.
+ */
+#define MAGIC_NUMBER(x) (({ FIXME(Replace magic number x with constant) }), (x))
+
+/* Usage example: call this in some IBAction that you will implement later,
+ * to generate a warning at compile time AND display an alert at runtime if the user trigger the IBAction
+ */
+#define NOT_IMPLEMENTED(warningMessage...) [[[[UIAlertView alloc] initWithTitle:@"Not implemented" \
+ message:[NSString stringWithFormat:@"%s",__PRETTY_FUNCTION__] \
+ delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease] show]; \
+ TODO(Implement this - warningMessage)
+
View
0  ...ive-C Singleton.pbfiletemplate/TemplateInfo.plist → ...ive-C Singleton.pbfiletemplate/TemplateInfo.plist
File renamed without changes
View
0  ...lass/Objective-C Singleton.pbfiletemplate/class.h → ...lass/Objective-C Singleton.pbfiletemplate/class.h
File renamed without changes
View
0  ...lass/Objective-C Singleton.pbfiletemplate/class.m → ...lass/Objective-C Singleton.pbfiletemplate/class.m
File renamed without changes
View
0  File Templates/README → Xcode3/File Templates/README
File renamed without changes
View
0  Project Templates/README → Xcode3/Project Templates/README
File renamed without changes
View
0  Text Macros/LiyanageMacros.xctxtmacro → Xcode3/Text Macros/LiyanageMacros.xctxtmacro
File renamed without changes
View
0  Text Macros/MacOSX 10.6 Protocols.xctxtmacro → Xcode3/Text Macros/MacOSX 10.6 Protocols.xctxtmacro
File renamed without changes
View
0  Text Macros/README → Xcode3/Text Macros/README
File renamed without changes
View
0  Text Macros/iPhone.xctxtmacro → Xcode3/Text Macros/iPhone.xctxtmacro
File renamed without changes
View
0  Text Macros/iPhoneOS 3.1 Protocols.xctxtmacro → Xcode3/Text Macros/iPhoneOS 3.1 Protocols.xctxtmacro
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.