appjam 0.1.8.7 → 0.1.8.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -1
- data/lib/appjam/generators/help.rb +1 -1
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.pbxproj +356 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/AppDelegate.h.tt +3 -3
- data/lib/appjam/generators/templates/blank/EiffelApplication/AppDelegate.m.tt +5 -5
- data/lib/appjam/generators/templates/blank/EiffelApplication/EiffelApplication-Info.plist +1 -1
- data/lib/appjam/generators/templates/blank/EiffelApplication/EiffelApplication-Prefix.pch.tt +1 -1
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/Toast/Toast+UIView.h +51 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/Toast/Toast+UIView.m +315 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/RaptureXML/RXMLElement.h +97 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/RaptureXML/RXMLElement.m +450 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/Objective-C-HMTL-Parser/HTMLNode.h +111 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/Objective-C-HMTL-Parser/HTMLNode.m +412 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/Objective-C-HMTL-Parser/HTMLParser.h +37 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/Objective-C-HMTL-Parser/HTMLParser.m +130 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSArray+ObjectiveSugar.h +39 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSArray+ObjectiveSugar.m +145 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSDictionary+ObjectiveSugar.h +18 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSDictionary+ObjectiveSugar.m +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSMutableArray+ObjectiveSugar.h +18 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSMutableArray+ObjectiveSugar.m +37 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSNumber+ObjectiveSugar.h +45 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSNumber+ObjectiveSugar.m +117 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSSet+ObjectiveSugar.h +21 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSSet+ObjectiveSugar.m +50 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSString+ObjectiveSugar.h +17 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSString+ObjectiveSugar.m +43 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/ObjectiveSugar.h +10 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SSKeychain/SSKeychain.h +160 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SSKeychain/SSKeychain.m +79 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SSKeychain/SSKeychainQuery.h +80 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SSKeychain/SSKeychainQuery.m +228 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SecureUDID/SecureUDID.h +75 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SecureUDID/SecureUDID.m +679 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/NSString+Versioning.h +41 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/NSString+Versioning.m +71 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/SS+Functions.h +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/SS+Functions.m +122 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/SS+System.h +41 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/SS+System.m +132 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Helpers/SSArguments.h +156 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSArray+JavaScript.h +46 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSArray+JavaScript.m +135 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSDate+JavaScript.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSDate+JavaScript.m +90 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSDictionary+JavaScript.h +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSDictionary+JavaScript.m +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSMutableArray+JavaScript.h +46 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSMutableArray+JavaScript.m +131 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSMutableDictionary+JavaScript.h +36 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSMutableDictionary+JavaScript.m +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSMutableString+JavaScript.h +36 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSMutableString+JavaScript.m +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSNumber+JavaScript.h +36 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSNumber+JavaScript.m +44 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSObject+JavaScript.h +50 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSObject+JavaScript.m +114 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSString+JavaScript.h +43 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/NSString+JavaScript.m +94 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/SS+JavaScript.h +52 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/SS+JavaScript.m +168 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/SS+Types.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/JavaScript/SS+Types.m +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/NSDictionary+NamedProperties.h +41 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/NSDictionary+NamedProperties.m +271 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/SS.h +36 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/SS.m +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/SubjectiveScript.h +67 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/SubjectiveScript.m +30 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSArray+SS.h +58 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSArray+SS.m +152 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSDate+SS.h +37 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSDate+SS.m +47 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSDictionary+SS.h +45 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSDictionary+SS.m +61 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSMutableArray+SS.h +43 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSMutableArray+SS.m +83 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSMutableDictionary+SS.h +47 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSMutableDictionary+SS.m +100 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSMutableString+SS.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSMutableString+SS.m +70 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSNumber+SS.h +51 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSNumber+SS.m +86 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSObject+SS.h +54 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSObject+SS.m +153 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSString+SS.h +46 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/NSString+SS.m +91 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/SubjectiveScript/Types/SSTypes.h +67 -0
- data/lib/appjam/generators/templates/blank/EiffelApplicationTests/EiffelApplicationTests-Info.plist +1 -1
- data/lib/appjam/generators/templates/blank/EiffelApplicationTests/EiffelApplicationTests.h.tt +5 -5
- data/lib/appjam/generators/templates/blank/EiffelApplicationTests/EiffelApplicationTests.m.tt +7 -7
- data/lib/appjam/version.rb +1 -1
- metadata +84 -3
@@ -0,0 +1,43 @@
|
|
1
|
+
//
|
2
|
+
// NSMutableArray+SS.h
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "SSTypes.h"
|
31
|
+
|
32
|
+
@interface NSMutableArray (SS)
|
33
|
+
|
34
|
+
+ (A*)newArguments;
|
35
|
+
+ (A*(^)(UI capacity))newC;
|
36
|
+
+ (A*(^)(id obj))newNSO;
|
37
|
+
|
38
|
+
- (A*(^)())toMutable;
|
39
|
+
|
40
|
+
- (A*(^)(id indexNumber, id value))set;
|
41
|
+
- (A*(^)(I index, id value))setAt;
|
42
|
+
|
43
|
+
@end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
//
|
2
|
+
// NSMutableArray+SS.m
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "NSMutableArray+SS.h"
|
31
|
+
#import "NSArray+SS.h"
|
32
|
+
#import "NSNumber+SS.h"
|
33
|
+
#import "SSArguments.h"
|
34
|
+
#import "SS+Types.h"
|
35
|
+
|
36
|
+
@implementation NSMutableArray (SS)
|
37
|
+
|
38
|
+
+ (A*)newArguments
|
39
|
+
{
|
40
|
+
A* result = A.new;
|
41
|
+
result.markAsArguments();
|
42
|
+
return result;
|
43
|
+
}
|
44
|
+
|
45
|
+
+ (A*(^)(UI capacity))newC
|
46
|
+
{
|
47
|
+
return ^(UI capacity) {
|
48
|
+
return [A arrayWithCapacity:capacity];
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
+ (A*(^)(id obj))newNSO
|
53
|
+
{
|
54
|
+
return ^(id obj) {
|
55
|
+
return [A arrayWithObject:obj];
|
56
|
+
};
|
57
|
+
}
|
58
|
+
|
59
|
+
- (A*(^)())toMutable { return ^{ return self; }; }
|
60
|
+
|
61
|
+
- (A*(^)(id indexNumber, id value))set
|
62
|
+
{
|
63
|
+
return ^(N* indexNumber, id value) {
|
64
|
+
if (!value) value = NSNull.null;
|
65
|
+
return self.setAt(indexNumber.I, value);
|
66
|
+
};
|
67
|
+
}
|
68
|
+
- (A*(^)(I index, id value))setAt
|
69
|
+
{
|
70
|
+
return ^(I index, id value) {
|
71
|
+
// need to expand and fill the array
|
72
|
+
if (index >= self.count) {
|
73
|
+
for (I addIndex=self.count; addIndex<index; addIndex++)
|
74
|
+
[self addObject:NSNull.null];
|
75
|
+
[self addObject:value];
|
76
|
+
}
|
77
|
+
else
|
78
|
+
[self replaceObjectAtIndex:index withObject:value];
|
79
|
+
return self;
|
80
|
+
};
|
81
|
+
}
|
82
|
+
|
83
|
+
@end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
//
|
2
|
+
// NSMutableDictionary+SS.h
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "SSTypes.h"
|
31
|
+
|
32
|
+
@interface NSMutableDictionary (SS)
|
33
|
+
|
34
|
+
+ (O*(^)(const KV* values /* NIL_TERMINATED */))newWithKV;
|
35
|
+
+ (O*(^)(UI capacity))newC;
|
36
|
+
|
37
|
+
- (O*(^)())toMutable;
|
38
|
+
|
39
|
+
- (NSO*(^)(id key, SSGetOrAddBlock add))getOrAdd;
|
40
|
+
- (O*(^)(id key, id value))set;
|
41
|
+
- (O*(^)(const KV* values /* NIL_TERMINATION */))setKV;
|
42
|
+
- (O*(^)(NSD* other))setO;
|
43
|
+
|
44
|
+
@end
|
45
|
+
|
46
|
+
#define OKV(...) O.newWithKV((KV[]){__VA_ARGS__, /* NIL_TERMINATION */ nil})
|
47
|
+
#define OsetKV(_o, ...) _o.setKV((KV[]){__VA_ARGS__, /* NIL_TERMINATION */ nil})
|
@@ -0,0 +1,100 @@
|
|
1
|
+
//
|
2
|
+
// NSMutableDictionary+SS.m
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "NSMutableDictionary+SS.h"
|
31
|
+
#import "NSDictionary+SS.h"
|
32
|
+
|
33
|
+
@implementation NSMutableDictionary (Object)
|
34
|
+
|
35
|
+
+ (O*(^)(const KV* values /* NIL_TERMINATED */))newWithKV
|
36
|
+
{
|
37
|
+
return ^(const KV* values /* NIL_TERMINATED */) {
|
38
|
+
O* result = O.new;
|
39
|
+
for (const id* pair = (const id*) values; *pair != nil; pair+=2) {
|
40
|
+
id value = pair[1];
|
41
|
+
[result setValue:value ? value : NSNull.null forKey:pair[0]];
|
42
|
+
}
|
43
|
+
|
44
|
+
return result;
|
45
|
+
};
|
46
|
+
}
|
47
|
+
|
48
|
+
+ (O*(^)(UI capacity))newC
|
49
|
+
{
|
50
|
+
return ^(UI capacity) {
|
51
|
+
return [O dictionaryWithCapacity:capacity];
|
52
|
+
};
|
53
|
+
}
|
54
|
+
|
55
|
+
- (O*(^)())toMutable { return ^{ return self; }; }
|
56
|
+
|
57
|
+
- (NSO*(^)(id key, SSGetOrAddBlock add))getOrAdd
|
58
|
+
{
|
59
|
+
return ^(id key, SSGetOrAddBlock add) {
|
60
|
+
id value = [self objectForKey:key];
|
61
|
+
if (value) return value;
|
62
|
+
|
63
|
+
// create a new one
|
64
|
+
value = add();
|
65
|
+
[self setValue:value forKey:key];
|
66
|
+
return value;
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
- (O*(^)(id key, id value))set
|
71
|
+
{
|
72
|
+
return ^(id key, id value) {
|
73
|
+
if (!value) value = NSNull.null;
|
74
|
+
[self setValue:value forKey:key];
|
75
|
+
return self;
|
76
|
+
};
|
77
|
+
}
|
78
|
+
|
79
|
+
- (O*(^)(const KV* values /* NIL_TERMINATION */))setKV
|
80
|
+
{
|
81
|
+
return ^(const KV* values /* NIL_TERMINATION */) {
|
82
|
+
for (const id* pair = (const id*) values; *pair != nil; pair+=2) {
|
83
|
+
id value = pair[1];
|
84
|
+
[self setValue:value ? value : NSNull.null forKey:pair[0]];
|
85
|
+
}
|
86
|
+
return self;
|
87
|
+
};
|
88
|
+
}
|
89
|
+
|
90
|
+
- (O*(^)(NSD* other))setO
|
91
|
+
{
|
92
|
+
return ^(NSD* other) {
|
93
|
+
[other enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
94
|
+
[self setValue:obj forKey:key];
|
95
|
+
}];
|
96
|
+
return self;
|
97
|
+
};
|
98
|
+
}
|
99
|
+
|
100
|
+
@end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
//
|
2
|
+
// NSMutableString+SS.h
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "SSTypes.h"
|
31
|
+
|
32
|
+
@interface NSMutableString (SS)
|
33
|
+
|
34
|
+
+ (S*(^)(UI capacity))newC;
|
35
|
+
+ (S*(^)(NSS* value))newS;
|
36
|
+
+ (S*(^)(NSA* array))newA;
|
37
|
+
+ (S*(^)(NSS* format, ...))newFormatted;
|
38
|
+
|
39
|
+
- (NSS*)mutableClassName;
|
40
|
+
- (S*(^)())toMutable;
|
41
|
+
|
42
|
+
@end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
//
|
2
|
+
// NSMutableString+SS.m
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "NSMutableString+SS.h"
|
31
|
+
#import "NSString+SS.h"
|
32
|
+
|
33
|
+
@implementation NSMutableString (SS)
|
34
|
+
|
35
|
+
+ (S*(^)(UI capacity))newC
|
36
|
+
{
|
37
|
+
return ^(UI capacity) {
|
38
|
+
return [S stringWithCapacity:capacity];
|
39
|
+
};
|
40
|
+
}
|
41
|
+
|
42
|
+
+ (S*(^)(NSS* value))newS
|
43
|
+
{
|
44
|
+
return ^(NSS* value) {
|
45
|
+
return NSS.newS(value).mutableCopy;
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
+ (S*(^)(NSA* array))newA
|
50
|
+
{
|
51
|
+
return ^(NSA* array) {
|
52
|
+
return NSS.newA(array).mutableCopy;
|
53
|
+
};
|
54
|
+
}
|
55
|
+
|
56
|
+
+ (S*(^)(NSS* format, ...))newFormatted
|
57
|
+
{
|
58
|
+
return ^(NSS* format, ...) {
|
59
|
+
va_list args;
|
60
|
+
va_start(args, format);
|
61
|
+
NSString *result = [[NSString alloc] initWithFormat:format arguments:args];
|
62
|
+
va_end(args);
|
63
|
+
return result.mutableCopy;
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
67
|
+
- (NSS*)mutableClassName { return NSStringFromClass([S class]); }
|
68
|
+
- (S*(^)())toMutable { return ^{ return self; }; }
|
69
|
+
|
70
|
+
@end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
//
|
2
|
+
// NSNumber+SS.h
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "SSTypes.h"
|
31
|
+
|
32
|
+
@interface NSNumber (SS)
|
33
|
+
|
34
|
+
+ (N*(^)(B value))B;
|
35
|
+
- (B)B;
|
36
|
+
|
37
|
+
+ (N*(^)(I value))I;
|
38
|
+
- (I)I;
|
39
|
+
|
40
|
+
+ (N*(^)(UI value))UI;
|
41
|
+
- (UI)UI;
|
42
|
+
|
43
|
+
+ (N*(^)(F value))F;
|
44
|
+
- (F)F;
|
45
|
+
|
46
|
+
+ (N*(^)(D value))D;
|
47
|
+
- (D)D;
|
48
|
+
|
49
|
+
- (B(^)())isBoolean;
|
50
|
+
|
51
|
+
@end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
//
|
2
|
+
// NSNumber+SS.m
|
3
|
+
// SubjectiveScript.m
|
4
|
+
//
|
5
|
+
// Created by Kevin Malakoff on 7/17/12.
|
6
|
+
// Copyright (c) 2012 Kevin Malakoff. All rights reserved.
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the "Software"), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
|
30
|
+
#import "NSNumber+SS.h"
|
31
|
+
#import "NSString+SS.h"
|
32
|
+
#import <objc/runtime.h>
|
33
|
+
|
34
|
+
static const NSS* SSTypeBoolean = @"boolean";
|
35
|
+
static char* const SSIsBooleanKey = "IsBoolean";
|
36
|
+
|
37
|
+
@implementation N (SS)
|
38
|
+
|
39
|
+
+ (N*(^)(B value))B;
|
40
|
+
{
|
41
|
+
return ^(B value) {
|
42
|
+
N* boolNumber = [[NSNumber alloc] initWithBool:value];
|
43
|
+
|
44
|
+
// add a dynamic property to the class so it can be recognized as a boolean. Explaination on why it is not built in functionality: http://stackoverflow.com/questions/2518761/get-type-of-nsnumber
|
45
|
+
objc_setAssociatedObject(boolNumber, SSIsBooleanKey, SSTypeBoolean, OBJC_ASSOCIATION_ASSIGN);
|
46
|
+
|
47
|
+
return boolNumber;
|
48
|
+
};
|
49
|
+
}
|
50
|
+
- (B)B { return self.boolValue; }
|
51
|
+
|
52
|
+
+ (N*(^)(I value))I
|
53
|
+
{
|
54
|
+
return ^(I value) {
|
55
|
+
return [N numberWithInteger:value];
|
56
|
+
};
|
57
|
+
}
|
58
|
+
- (I)I { return self.integerValue; }
|
59
|
+
|
60
|
+
+ (N*(^)(UI value))UI
|
61
|
+
{
|
62
|
+
return ^(UI value) {
|
63
|
+
return [N numberWithUnsignedInteger:value];
|
64
|
+
};
|
65
|
+
}
|
66
|
+
- (UI)UI { return self.unsignedIntegerValue; }
|
67
|
+
|
68
|
+
+ (N*(^)(F value))F
|
69
|
+
{
|
70
|
+
return ^(F value) {
|
71
|
+
return [N numberWithFloat:value];
|
72
|
+
};
|
73
|
+
}
|
74
|
+
- (F)F { return self.floatValue; }
|
75
|
+
|
76
|
+
+ (N*(^)(D value))D
|
77
|
+
{
|
78
|
+
return ^(D value) {
|
79
|
+
return [N numberWithDouble:value];
|
80
|
+
};
|
81
|
+
}
|
82
|
+
- (D)D { return self.doubleValue; }
|
83
|
+
|
84
|
+
- (B(^)())isBoolean{ return ^B(){ return objc_getAssociatedObject(self, SSIsBooleanKey) != nil; }; }
|
85
|
+
|
86
|
+
@end
|