NDEVR
API Documentation
FileFormat.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: FileFormat
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/File.h>
34#include <NDEVR/UUID.h>
35#include <NDEVR/TranslatedString.h>
36namespace NDEVR
37{
45 {
46 public:
51 {}
52
56 FileFormat(const UUID& id)
57 : file_format_id(id)
58 {}
59
66 bool read_supported = false;
67 bool write_supported = false;
68 bool is_ascii = false;
74 bool operator==(const FileFormat& format) const
75 {
76 return file_format_id == format.file_format_id;
77 }
78
83 bool operator!=(const FileFormat& format) const
84 {
85 return file_format_id != format.file_format_id;
86 }
87
92 {
93 return FileFormat(Constant<UUID>::Invalid);
94 }
95 };
96
101 {
106 : format(FileFormat::InvalidFormat())
107 {}
108
113 : file(file)
114 , format(FileFormat::InvalidFormat())
115 {}
116
122 : file(file)
123 , format(format)
124 {}
125
130 bool operator==(const FileRequest& request) const
131 {
132 return file == request.file && format == request.format;
133 }
134
139 bool operator!=(const FileRequest& request) const
140 {
141 return file != request.file || format != request.format;
142 }
145 };
146
147}
148
Data that describes a particular file format and how to use the format with the program.
Definition FileFormat.h:45
bool operator==(const FileFormat &format) const
Checks equality with another FileFormat by comparing file_format_id.
Definition FileFormat.h:74
sint04 priority
Sort priority for display lists. Higher values appear first. Default is 0.
Definition FileFormat.h:65
TranslatedString description
A user-facing description of the file format.
Definition FileFormat.h:61
String extension
The file extension associated with this format (e.g., "csv", "obj").
Definition FileFormat.h:63
static FileFormat InvalidFormat()
Creates an invalid FileFormat sentinel value.
Definition FileFormat.h:91
FileFormat(const UUID &id)
Constructs a FileFormat with the given unique identifier.
Definition FileFormat.h:56
TranslatedString name
The user-facing display name of the file format.
Definition FileFormat.h:60
bool operator!=(const FileFormat &format) const
Checks inequality with another FileFormat by comparing file_format_id.
Definition FileFormat.h:83
UUID file_format_id
The unique identifier for this file format.
Definition FileFormat.h:62
bool is_ascii
Whether the format stores data as ASCII text rather than binary.
Definition FileFormat.h:68
String icon
The icon resource name used to represent this format in the UI.
Definition FileFormat.h:64
bool write_supported
Whether writing (exporting) this format is supported.
Definition FileFormat.h:67
FileFormat()
Default constructor.
Definition FileFormat.h:50
bool read_supported
Whether reading (importing) this format is supported.
Definition FileFormat.h:66
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.
int32_t sint04
-Defines an alias representing a 4 byte, signed integer.
bool operator==(const FileRequest &request) const
Checks equality with another FileRequest by comparing both file and format.
Definition FileFormat.h:130
FileRequest()
Default constructor.
Definition FileFormat.h:105
File file
The file path associated with this request.
Definition FileFormat.h:143
FileFormat format
The file format describing how to handle the file.
Definition FileFormat.h:144
FileRequest(const File &file, const FileFormat &format)
Constructs a FileRequest for the given file and format.
Definition FileFormat.h:121
FileRequest(const File &file)
Constructs a FileRequest for the given file with an invalid format.
Definition FileFormat.h:112
bool operator!=(const FileRequest &request) const
Checks inequality with another FileRequest by comparing file and format.
Definition FileFormat.h:139