NDEVR
API Documentation
NDVFactory.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: IOFactory
28File: NDVFactory
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/SoftwareService.h>
34#include <NDEVR/IOFactory.h>
35#include <NDEVR/Material.h>
36#include <NDEVR/Model.h>
37#include <NDEVR/File.h>
38namespace NDEVR
39{
40 class FactoryOptions;
41 class Model;
42 class Log;
43 class ImageFactory;
44 class FactoryFeatures;
52 {
53 public:
58 NDVSetupCallback(std::function<void(Model&)> callback)
60 {}
61 std::function<void(Model&)> callback;
62 };
63
74 {
75 protected:
80 public:
92 static String ReadIcon(const File& file, ImageFactory& factory);
98 String getIcon(const File& file) override;
104 static String ReadData(const File& file);
111 FactoryFeatures factoryFeatures(const FactoryParameters& file, bool is_import) const override;
128 static void AddSetupCallback(NDVSetupCallback* callback);
133 static void RemoveSetupCallback(NDVSetupCallback* callback);
144 virtual void getSupportedFormats(Buffer<FileFormat>& formats, bool is_read) override;
150 virtual bool readFile(FactoryParameters& params) override;
156 virtual bool writeFile(FactoryParameters& params) override;
162 uint08 version(const File& file);
174 virtual bool determineExtension(const File& file, String& extension) override;
180 virtual bool canRead(const FactoryParameters& file) override;
186 virtual bool canWrite(const FactoryParameters& file) override;
192 virtual bool canWrite(const FileFormat& file) override;
193 };
194
195}
#define NDEVR_FACTORY_API
GCC/Clang symbol visibility — marks symbols as visible in the shared library.
Definition DLLInfo.h:92
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Allows IOFactories to report what features they support to make the import/export dialogs easier to s...
User-defined options that define preferences for importing and exporting using IOFactory objects.
Data that describes a particular file format and how to use the format with the program.
Definition FileFormat.h:45
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
IOFactory(const StringView &factory_name)
Constructs an IOFactory with the given factory name.
The core class for reading/writing and storing images in an optimized way.
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:50
A core class that represents a node on model hierarchy.
Definition Model.h:292
virtual bool canWrite(const FactoryParameters &file) override
Checks whether this factory can write the file described by the given parameters.
FactoryOptions defaultReadOptions(const FactoryParameters &file) const override
Returns the default read options for the given file parameters.
FactoryFeatures factoryFeatures(const FactoryParameters &file, bool is_import) const override
Returns the feature set supported by this factory for the given parameters.
virtual bool canRead(const FactoryParameters &file) override
Checks whether this factory can read the file described by the given parameters.
NDVFactory()
Protected constructor.
String getIcon(const File &file) override
Returns the icon associated with the given file.
virtual void getSupportedFormats(Buffer< FileFormat > &formats, bool is_read) override
Populates the given buffer with the file formats supported by this factory.
static void RemoveSetupCallback(NDVSetupCallback *callback)
Unregisters a previously added NDVSetupCallback.
virtual bool readFile(FactoryParameters &params) override
Reads an NDV file and populates the factory parameters with the resulting model data.
static String ReadIcon(const File &file, ImageFactory &factory)
Reads the icon resource embedded in an NDV file.
virtual bool writeFile(FactoryParameters &params) override
Writes model data to an NDV file as described by the factory parameters.
virtual bool determineExtension(const File &file, String &extension) override
Attempts to determine the file extension for the given file.
static FileFormat NDVFormat()
Returns the FileFormat descriptor for the NDV file format.
virtual bool canWrite(const FileFormat &file) override
Checks whether this factory can write files in the given format.
static void AddSetupCallback(NDVSetupCallback *callback)
Registers an NDVSetupCallback to be invoked during NDV file import.
static NDVFactory & DefaultFactory()
Returns the singleton NDVFactory instance.
uint08 version(const File &file)
Returns the NDV format version stored in the given file.
static uint08 CurrentVersion()
Returns the current NDV format version used by this factory for writing.
static String ReadData(const File &file)
Reads raw data content from an NDV file as a String.
FactoryOptions defaultWriteOptions(const FactoryParameters &file) const override
Returns the default write options for the given file parameters.
A callback service used to modify Model objects when they are imported using the NDVFactory.
Definition NDVFactory.h:52
std::function< void(Model &)> callback
The function invoked on each Model during NDV import.
Definition NDVFactory.h:61
NDVSetupCallback(std::function< void(Model &)> callback)
Constructs an NDVSetupCallback with the given callback function.
Definition NDVFactory.h:58
Software Service Managers take a Software service to modify the behavior of the software.
Base interface for services that extend or modify software behavior through modules.
The core String class for the NDEVR API.
Definition String.h:95
The primary namespace for the NDEVR SDK.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
A container of input information that is to be filled with output information by an IOFactory.
Definition IOFactory.h:105