Permalink
Browse files

first commit. renamed from SCTools.

  • Loading branch information...
0 parents commit b177209b9ef2e4cf32d516e95e99df1d67eeb2fc @petejkim committed Nov 27, 2010
Showing with 110 additions and 0 deletions.
  1. +38 −0 CKMacros.h
  2. +5 −0 ConciseKit.h
  3. +19 −0 LICENSE
  4. +48 −0 README.markdown
@@ -0,0 +1,38 @@
+/* ConciseKit
+ * Copyright 2010 Peter Jihoon Kim
+ * Licensed under the MIT License.
+ */
+#define $new(Klass) [[[Klass alloc] init] autorelease]
+#define $eql(a,b) [(a) isEqual:(b)]
+
+#define $arr(...) [NSArray arrayWithObjects:__VA_ARGS__, nil]
+#define $marr(...) [NSMutableArray arrayWithObjects:__VA_ARGS__, nil]
+#define $set(...) [NSSet setWithObjects:__VA_ARGS__, nil]
+#define $mset(...) [NSMutableSet setWithObjects:__VA_ARGS__, nil]
+#define $dict(...) [NSDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil]
+#define $mdict(...) [NSMutableDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil]
+#define $str(...) [NSString stringWithFormat:__VA_ARGS__]
+#define $mstr(...) [NSMutableString stringWithFormat:__VA_ARGS__]
+
+#define $bool(val) [NSNumber numberWithBool:(val)]
+#define $char(val) [NSNumber numberWithChar:(val)]
+#define $double(val) [NSNumber numberWithDouble:(val)]
+#define $float(val) [NSNumber numberWithFloat:(val)]
+#define $int(val) [NSNumber numberWithInt:(val)]
+#define $integer(val) [NSNumber numberWithInteger:(val)]
+#define $long(val) [NSNumber numberWithLong:(val)]
+#define $longLong(val) [NSNumber numberWithLongLong:(val)]
+#define $short(val) [NSNumber numberWithShort:(val)]
+#define $uChar(val) [NSNumber numberWithUnsignedChar:(val)]
+#define $uInt(val) [NSNumber numberWithUnsignedInt:(val)]
+#define $uInteger(val) [NSNumber numberWithUnsignedInteger:(val)]
+#define $uLong(val) [NSNumber numberWithUnsignedLong:(val)]
+#define $uLongLong(val) [NSNumber numberWithUnsignedLongLong:(val)]
+#define $uShort(val) [NSNumber numberWithUnsignedShort:(val)]
+
+#define $nonRetained(val) [NSValue valueWithNonretainedObject:(val)]
+#define $pointer(val) [NSValue valueWithPointer:(val)]
+#define $point(val) [NSValue valueWithPoint:(val)]
+#define $range(val) [NSValue valueWithRange:(val)]
+#define $rect(val) [NSValue valueWithRect:(val)]
+#define $size(val) [NSValue valueWithSize:(val)]
@@ -0,0 +1,5 @@
+/* ConciseKit
+ * Copyright 2010 Peter Jihoon Kim
+ * Licensed under the MIT License.
+ */
+#import "CKMacros.h"
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Peter Jihoon Kim
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,48 @@
+# ConciseKit 0.0.1
+
+A set of Objective-C additions and macros that lets you to write code more quickly.
+
+## Macros
+
+### General shorthands
+
+ $new(Foo) => [[[Foo alloc] init] autorelease]
+ $eql(foo, bar) => [foo isEqual:bar]
+
+### NSArray shorthands
+
+ $arr(foo, bar) => [NSArray arrayWithObjects:foo, bar, nil]
+ $marr(foo, bar) => [NSMutableArray ...]
+
+### NSSet shorthands
+
+ $set(foo, bar) => [NSSet setWithObjects:foo, bar, nil]
+ $mset(foo, bar) => [NSMutableSet ...]
+
+### NSDictionary shorthands
+
+ $dict(v1, k1, v2, k2) => [NSDictionary dictionaryWithObjectsAndKeys:v1, k1, v2, k2, nil]
+ $mdict(v1, k1, v2, k2) => [NSMutableDictionary ...]
+
+### NSString shorthands
+
+ $str(@"foo: %@", bar) => [NSString stringWithFormat:@"foo: %@", bar]
+ $mstr(@"foo: %@", bar) => [NSMutableString ...]
+
+### NSNumber shorthands
+
+ $bool(YES) => [NSNumber numberWithBool:YES]
+ $int(123) => [NSNumber numberWithInt:123]
+ $float(123.4) => [NSNumber numberWithFloat:123.4]
+
+ $char(), $double(), $integer(), $long(), $longLong(), $short(),
+ $uChar(), $uInt(), $uInteger(), $uLong(), $uLongLong(), $uShort()
+
+### NSValue shorthands
+ $nonRetained(), $pointer(), $point(), $range(), $rect(), $size()
+
+## Additions
+
+## License
+
+Copyright (c) 2010 Peter Jihoon Kim. This code is licensed under the MIT License.

0 comments on commit b177209

Please sign in to comment.