forked from alejandrojapkin/CocoaLUT
/
LUTFormatter.h
157 lines (118 loc) · 4.03 KB
/
LUTFormatter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//
// LUTFormatter.h
// DropLUT
//
// Created by Wil Gieseler on 12/15/13.
// Copyright (c) 2013 Wil Gieseler. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "LUT.h"
#import "LUT1D.h"
#import "LUT3D.h"
#import "LUTMetadataFormatter.h"
#import "LUTAction.h"
@class LUT;
@class LUT1D;
@class LUT3D;
typedef NS_ENUM(NSInteger, LUTFormatterOutputType) {
LUTFormatterOutputType3D,
LUTFormatterOutputType1D,
LUTFormatterOutputTypeEither,
LUTFormatterOutputTypeNone
};
typedef NS_ENUM(NSInteger, LUTFormatterRole) {
LUTFormatterRoleReadOnly,
LUTFormatterRoleWriteOnly,
LUTFormatterRoleReadAndWrite,
LUTFormatterRoleNone
};
/**
* An abstract superclass for an object that is responsible for converting between a `LUT` object in-memory and a file-based format.
*/
@interface LUTFormatter : NSObject
+ (NSArray *)LUTFormattersForFileExtension:(NSString *)fileExtension;
+ (LUTFormatter *)LUTFormatterWithID:(NSString *)identifier;
+ (LUTFormatter *)LUTFormatterValidForReadingURL:(NSURL *)fileURL;
+ (NSArray *)LUTFormattersValidForWritingLUTType:(LUT *)lut;
+ (NSArray *)allFormattersFileExtensions;
+ (NSArray *)lut1DFormatterFileExtensions;
+ (NSArray *)lut3DFormatterFileExtensions;
/**
* Returns a new LUT from a file in the formatter's file type..
*
* The default implementation reads the contents of the file as a string and returns the result of LUTFromString:.
*
* @param fileURL A file URL.
*
* @return A new `LUT`.
*/
+ (LUT *)LUTFromURL:(NSURL *)fileURL;
/**
* Returns a new LUT from a data blob in the formatter's file type..
*
* The default implementation interprets the data as an ASCII string and returns the result of LUTFromString:.
*
* @param data A data blob containing the contents of a LUT file.
*
* @return A new `LUT`.
*/
+ (LUT *)LUTFromData:(NSData *)data;
/**
* Returns a new LUT from a string in the formatter's file type..
*
* The default implementation divides the string by newlines and passes the array of strings to LUTFromLines:.
*
* @param string A string containing the contents of a LUT file.
*
* @return A new `LUT`.
*/
+ (LUT *)LUTFromString:(NSString *)string;
/**
* Returns a new LUT from an array of string lines in the formatter's file type..
*
* The default implementation raises an exception and is intended to be implemented by a subclass.
*
* @param lines An array of `NSString` objects that represents the lines in a LUT file.
*
* @return A new `LUT`.
*/
+ (LUT *)LUTFromLines:(NSArray *)lines;
/**
* Converts the provided `LUT` to a data blob in the formatter's file type.
*
* The default implementation encodes the returned value from stringFromLUT: as UTF-8 text.
*
* @param lut The LUT that is to be formatted.
* @param lut The options for the formatter (ex: outputIntegerDepth or fileTypeVariant)
* @return A data blob containing the contents of the LUT.
*/
+ (NSData *)dataFromLUT:(LUT *)lut withOptions:(NSDictionary *)options;
/**
* Converts the provided `LUT` to a string in the formatter's file type.
*
* The default implementation raises an exception and is intended to be implemented by a subclass.
*
* @param lut The LUT that is to be formatted.
* @param lut The options for the formatter (ex: outputIntegerDepth or fileTypeVariant)
*
* @return A string containing the contents of the LUT.
*/
+ (NSString *)stringFromLUT:(LUT *)lut withOptions:(NSDictionary *)options;
+ (BOOL)isValidReaderForURL:(NSURL *)fileURL;
+ (BOOL)isValidWriterForLUTType:(LUT *)lut;
+ (BOOL)isDestructiveWithOptions:(NSDictionary *)options;
+ (LUTFormatterOutputType)outputType;
+ (NSArray *)allOptions;
+ (NSDictionary *)defaultOptions;
+ (BOOL)optionsAreValid:(NSDictionary *)options;
+ (NSString *)utiString;
+ (NSArray *)fileExtensions;
+ (NSString *)formatterName;
+ (NSString *)formatterID;
+ (NSString *)nameWithExtensions;
+ (LUTFormatterRole)formatterRole;
+ (BOOL)canRead;
+ (BOOL)canWrite;
+ (NSDictionary *)constantConstraints;
+ (NSArray *)conformanceLUTActionsForLUT:(LUT *)lut options:(NSDictionary *)options;
@end