Skip to content

Commit 788ac1d

Browse files
committed
Classes for ColorSet files.
1 parent 2ae13d6 commit 788ac1d

File tree

7 files changed

+751
-6
lines changed

7 files changed

+751
-6
lines changed

ColorSet.xcodeproj/project.pbxproj

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0509117B20E50608009EF90C /* ColorSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 0509117A20E50608009EF90C /* ColorSet.m */; };
11+
0509117E20E5065C009EF90C /* ColorPair.m in Sources */ = {isa = PBXBuildFile; fileRef = 0509117C20E5065C009EF90C /* ColorPair.m */; };
12+
050911A420E52272009EF90C /* ColorSetStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 050911A320E52272009EF90C /* ColorSetStream.m */; };
1013
0530C41F20E10FEA00F5B259 /* ArrayIsEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0530C41E20E10FEA00F5B259 /* ArrayIsEmpty.swift */; };
1114
0530C42120E1112C00F5B259 /* ArrayIsNotEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0530C42020E1112C00F5B259 /* ArrayIsNotEmpty.swift */; };
1215
0530C42320E1213500F5B259 /* NSView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0530C42220E1213500F5B259 /* NSView.swift */; };
@@ -26,6 +29,12 @@
2629
/* End PBXBuildFile section */
2730

2831
/* Begin PBXFileReference section */
32+
0509117920E50608009EF90C /* ColorSet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorSet.h; sourceTree = "<group>"; };
33+
0509117A20E50608009EF90C /* ColorSet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ColorSet.m; sourceTree = "<group>"; };
34+
0509117C20E5065C009EF90C /* ColorPair.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorPair.m; sourceTree = "<group>"; };
35+
0509117D20E5065C009EF90C /* ColorPair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorPair.h; sourceTree = "<group>"; };
36+
050911A220E52272009EF90C /* ColorSetStream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorSetStream.h; sourceTree = "<group>"; };
37+
050911A320E52272009EF90C /* ColorSetStream.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ColorSetStream.m; sourceTree = "<group>"; };
2938
0530C41E20E10FEA00F5B259 /* ArrayIsEmpty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayIsEmpty.swift; sourceTree = "<group>"; };
3039
0530C42020E1112C00F5B259 /* ArrayIsNotEmpty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayIsNotEmpty.swift; sourceTree = "<group>"; };
3140
0530C42220E1213500F5B259 /* NSView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSView.swift; sourceTree = "<group>"; };
@@ -92,17 +101,23 @@
92101
children = (
93102
05D11ECB20E13E0800A621B5 /* AboutWindowController.swift */,
94103
0543AE7420DC33DF00284E99 /* ApplicationDelegate.swift */,
95-
0543AE7C20DC345200284E99 /* MainWindowController.swift */,
96-
0543AE8120DC382A00284E99 /* ColorItem.swift */,
97-
0543AE9D20E0FFD000284E99 /* ColorView.swift */,
98104
0530C41E20E10FEA00F5B259 /* ArrayIsEmpty.swift */,
99105
0530C42020E1112C00F5B259 /* ArrayIsNotEmpty.swift */,
100-
0530C42220E1213500F5B259 /* NSView.swift */,
106+
05D11EC020E1359C00A621B5 /* ColorComponent.swift */,
107+
0543AE8120DC382A00284E99 /* ColorItem.swift */,
108+
0509117D20E5065C009EF90C /* ColorPair.h */,
109+
0509117C20E5065C009EF90C /* ColorPair.m */,
110+
0530C42420E1305B00F5B259 /* ColorSet-Bridging-Header.h */,
111+
0509117920E50608009EF90C /* ColorSet.h */,
112+
0509117A20E50608009EF90C /* ColorSet.m */,
113+
050911A220E52272009EF90C /* ColorSetStream.h */,
114+
050911A320E52272009EF90C /* ColorSetStream.m */,
115+
0543AE9D20E0FFD000284E99 /* ColorView.swift */,
101116
0530C42520E1305B00F5B259 /* Exception.h */,
102117
0530C42620E1305B00F5B259 /* Exception.m */,
103-
05D11EC020E1359C00A621B5 /* ColorComponent.swift */,
104118
0564590120E4DDFD001EA86F /* HexColor.swift */,
105-
0530C42420E1305B00F5B259 /* ColorSet-Bridging-Header.h */,
119+
0543AE7C20DC345200284E99 /* MainWindowController.swift */,
120+
0530C42220E1213500F5B259 /* NSView.swift */,
106121
);
107122
path = Classes;
108123
sourceTree = "<group>";
@@ -202,6 +217,9 @@
202217
05D11ECC20E13E0900A621B5 /* AboutWindowController.swift in Sources */,
203218
0564590220E4DDFD001EA86F /* HexColor.swift in Sources */,
204219
0543AE9E20E0FFD000284E99 /* ColorView.swift in Sources */,
220+
050911A420E52272009EF90C /* ColorSetStream.m in Sources */,
221+
0509117E20E5065C009EF90C /* ColorPair.m in Sources */,
222+
0509117B20E50608009EF90C /* ColorSet.m in Sources */,
205223
0543AE8220DC382A00284E99 /* ColorItem.swift in Sources */,
206224
0530C41F20E10FEA00F5B259 /* ArrayIsEmpty.swift in Sources */,
207225
0530C42120E1112C00F5B259 /* ArrayIsNotEmpty.swift in Sources */,

ColorSet/Classes/ColorPair.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*******************************************************************************
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2018 Jean-David Gadina - www.imazing.com
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
******************************************************************************/
24+
25+
#import <Cocoa/Cocoa.h>
26+
27+
NS_ASSUME_NONNULL_BEGIN
28+
29+
@interface ColorPair: NSObject
30+
31+
@property( atomic, readwrite, strong, nullable ) NSColor * color;
32+
@property( atomic, readwrite, strong, nullable ) NSColor * variant;
33+
34+
- ( instancetype )initWithColor: ( nullable NSColor * )color;
35+
- ( instancetype )initWithColor: ( nullable NSColor * )color variant: ( nullable NSColor * )variant NS_DESIGNATED_INITIALIZER;
36+
37+
@end
38+
39+
NS_ASSUME_NONNULL_END

ColorSet/Classes/ColorPair.m

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*******************************************************************************
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2018 Jean-David Gadina - www.imazing.com
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
******************************************************************************/
24+
25+
#import "ColorPair.h"
26+
27+
NS_ASSUME_NONNULL_BEGIN
28+
29+
@interface ColorPair()
30+
31+
@end
32+
33+
NS_ASSUME_NONNULL_END
34+
35+
@implementation ColorPair
36+
37+
- ( instancetype )init
38+
{
39+
return [ self initWithColor: nil ];
40+
}
41+
42+
- ( instancetype )initWithColor: ( nullable NSColor * )color;
43+
{
44+
return [ self initWithColor: nil variant: nil ];
45+
}
46+
47+
- ( instancetype )initWithColor: ( nullable NSColor * )color variant: ( nullable NSColor * )variant
48+
{
49+
if( ( self = [ super init ] ) )
50+
{
51+
self.color = color;
52+
self.variant = variant;
53+
}
54+
55+
return self;
56+
}
57+
58+
@end

ColorSet/Classes/ColorSet.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*******************************************************************************
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2018 Jean-David Gadina - www.imazing.com
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
******************************************************************************/
24+
25+
#import <Cocoa/Cocoa.h>
26+
27+
NS_ASSUME_NONNULL_BEGIN
28+
29+
@class ColorPair;
30+
31+
@interface ColorSet: NSObject
32+
33+
@property( atomic, readonly ) NSDictionary< NSString *, ColorPair * > * colors;
34+
35+
- ( nullable instancetype )initWithPath: ( NSString * )path;
36+
- ( nullable instancetype )initWithURL: ( NSURL * )url;
37+
- ( nullable instancetype )initWithData: ( NSData * )data;
38+
39+
- ( void )addColor: ( NSColor * )color forName: ( NSString * )name;
40+
- ( void )setColor: ( NSColor * )color forName: ( NSString * )name;
41+
- ( void )addColor: ( NSColor * )color variant: ( nullable NSColor * )variant forName: ( NSString * )name;
42+
- ( void )setColor: ( NSColor * )color variant: ( nullable NSColor * )variant forName: ( NSString * )name;
43+
44+
- ( NSData * )data;
45+
46+
- ( BOOL )writeToPath: ( NSString * )path error: ( NSError * _Nullable __autoreleasing * _Nullable )error;
47+
- ( BOOL )writeToURL: ( NSURL * )url error: ( NSError * _Nullable __autoreleasing * _Nullable )error;
48+
49+
@end
50+
51+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)