NDEVR
API Documentation

An IOFactory for reading and writing build action definitions in JSON format, enabling import/export of build workflows. More...

Inheritance diagram for CommandJSON:
[legend]
Collaboration diagram for CommandJSON:
[legend]

Static Public Member Functions

static CommandJSONDefaultFactory ()
 Returns the singleton CommandJSON factory instance.
Static Public Member Functions inherited from IOFactory
static void EnableExtension (const StringView &extension, const StringView &read_password, const StringView &write_password)
 Enables a specific file extension with the given read and write passwords.
static void EnableFactory (const StringView &factory, const StringView &read_password, const StringView &write_password)
 Enables a factory by name with the given read and write passwords.
static void EnableFactory (IOFactory *factory, const StringView &read_password, const StringView &write_password)
 Registers an IOFactory instance with the system, enabling it for read and/or write.

Protected Member Functions

 CommandJSON ()
 Constructs the factory and registers it with the IOFactory system.
bool canRead (const File &file) final override
 Checks whether the given file can be read by this factory.
bool canWrite (const File &file) final override
 Checks whether the given file can be written by this factory.
FactoryOptions defaultReadOptions (const FactoryParameters &file) const final override
 Returns the default read options for the given file.
FactoryOptions defaultWriteOptions (const FactoryParameters &file) const final override
 Returns the default write options for the given file.
bool determineExtension (const File &file, String &extension) final override
 Determines the file extension for the given file.
FactoryFeatures factoryFeatures (const FactoryParameters &file, bool is_import) const override
 Returns the feature capabilities of this factory.
Buffer< UUIDfilterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const final override
 Filters the list of models to those eligible for export.
String getIcon (const File &file) final override
 Returns the icon name for the given file.
void getSupportedFormats (Buffer< FileFormat > &formats, bool is_read) final override
 Populates the list of supported file formats.
bool isAutoEnabled () const final override
 Returns whether this factory is automatically enabled.
bool readFile (FactoryParameters &file) final override
 Reads build action definitions from a JSON file.
bool writeFile (FactoryParameters &) final override
 Writes build action definitions to a JSON file.

Additional Inherited Members

Public Member Functions inherited from IOFactory
 IOFactory (const StringView &factory_name)
 Constructs an IOFactory with the given factory name.
virtual ~IOFactory ()
 Virtual destructor.
virtual bool canRead (const FactoryParameters &file)
 Checks whether this factory can read using the given FactoryParameters.
virtual bool canRead (const FileFormat &file)
 Checks whether this factory can read the given file format.
virtual bool canWrite (const FactoryParameters &file)
 Checks whether this factory can write using the given FactoryParameters.
virtual bool canWrite (const FileFormat &file)
 Checks whether this factory can write the given file format.
String factoryReadAppFeature () const
 Returns the application feature string required for read operations.
String factoryWriteAppFeature () const
 Returns the application feature string required for write operations.
void getSupportedFormats (Buffer< FileFormat > &formats)
 Populates the given buffer with all supported file formats (both read and write).
virtual void getSupportedFormats (Buffer< FileFormat > &formats, const File &file)
 Populates the given buffer with formats supported for the specified file.
virtual void getSupportedFormats (Buffer< FileFormat > &formats, DesignObjectLookup *lookup, const Buffer< UUID > &models)
 Populates the given buffer with formats supported for writing the specified models.
virtual void getSupportedFormatsByModelType (Buffer< FileFormat > &formats, bool is_read, const StringView &model_type)
 Populates the given buffer with formats matching a specific model type.
virtual void getSupportedFormatsForExtension (Buffer< FileFormat > &formats, bool is_read, const StringView &extension)
 Populates the given buffer with formats matching a specific file extension.
virtual bool isFactoryEnabled (bool is_read) const
 Checks whether this factory is enabled for reading or writing.
const Stringname () const
 Returns the name of this factory.
Buffer< UUIDreadFileWithDefaultSettings (const File &file, DesignObjectLookup *lookup)
 Reads a file using default settings and returns the UUIDs of the created models.
Buffer< ScenereadScenesFromFile (const File &file)
 Reads scenes from a file and returns them as a buffer of Scene objects.
void throwIfNotEnabled (bool is_read)
 Throws an exception if the factory is not enabled for the given operation direction.
virtual bool updateFromFile (const FactoryParameters &file, const FactoryOptions &old_options)
 Updates the factory parameters from a file, comparing against old options.
bool writeScenesToFile (const File &file, const Buffer< Scene > &scene)
 Writes a buffer of scenes to a file.

Detailed Description

An IOFactory for reading and writing build action definitions in JSON format, enabling import/export of build workflows.

Definition at line 44 of file CommandJSON.h.

Member Function Documentation

◆ canRead()

bool CommandJSON::canRead ( const File & file)
finaloverrideprotectedvirtual

Checks whether the given file can be read by this factory.

Parameters
[in]fileThe file to check.
Returns
True if the file is readable.

Reimplemented from IOFactory.

◆ canWrite()

bool CommandJSON::canWrite ( const File & file)
finaloverrideprotectedvirtual

Checks whether the given file can be written by this factory.

Parameters
[in]fileThe file to check.
Returns
True if the file is writable.

Reimplemented from IOFactory.

◆ DefaultFactory()

CommandJSON * CommandJSON::DefaultFactory ( )
static

Returns the singleton CommandJSON factory instance.

Returns
Pointer to the default factory.

References CommandJSON().

◆ defaultReadOptions()

FactoryOptions CommandJSON::defaultReadOptions ( const FactoryParameters & file) const
finaloverrideprotectedvirtual

Returns the default read options for the given file.

Parameters
[in]fileThe factory parameters.
Returns
The default read options.

Reimplemented from IOFactory.

References defaultReadOptions().

Referenced by defaultReadOptions().

◆ defaultWriteOptions()

FactoryOptions CommandJSON::defaultWriteOptions ( const FactoryParameters & file) const
finaloverrideprotectedvirtual

Returns the default write options for the given file.

Parameters
[in]fileThe factory parameters.
Returns
The default write options.

Reimplemented from IOFactory.

References defaultWriteOptions().

Referenced by defaultWriteOptions().

◆ determineExtension()

bool CommandJSON::determineExtension ( const File & file,
String & extension )
finaloverrideprotectedvirtual

Determines the file extension for the given file.

Parameters
[in]fileThe file to inspect.
[in]extensionOutput string for the determined extension.
Returns
True if the extension was determined.

Reimplemented from IOFactory.

References determineExtension().

Referenced by determineExtension().

◆ factoryFeatures()

FactoryFeatures CommandJSON::factoryFeatures ( const FactoryParameters & file,
bool is_import ) const
overrideprotectedvirtual

Returns the feature capabilities of this factory.

Parameters
[in]fileThe factory parameters.
[in]is_importWhether the operation is an import.
Returns
The factory features.

Implements IOFactory.

References factoryFeatures().

Referenced by factoryFeatures().

◆ filterModelsToExport()

Buffer< UUID > CommandJSON::filterModelsToExport ( Buffer< UUID > models_to_check,
const DesignObjectLookup * lookup,
const FileFormat & export_format ) const
finaloverrideprotectedvirtual

Filters the list of models to those eligible for export.

Parameters
[in]models_to_checkThe candidate model UUIDs.
[in]lookupThe design object lookup.
[in]export_formatThe target export format.
Returns
The filtered list of model UUIDs.

Reimplemented from IOFactory.

References filterModelsToExport().

Referenced by filterModelsToExport().

◆ getIcon()

String CommandJSON::getIcon ( const File & file)
finaloverrideprotectedvirtual

Returns the icon name for the given file.

Parameters
[in]fileThe file to get an icon for.
Returns
The icon resource name.

Reimplemented from IOFactory.

◆ getSupportedFormats()

void CommandJSON::getSupportedFormats ( Buffer< FileFormat > & formats,
bool is_read )
finaloverrideprotectedvirtual

Populates the list of supported file formats.

Parameters
[in]formatsThe buffer to populate.
[in]is_readWhether to list read or write formats.

Implements IOFactory.

◆ isAutoEnabled()

bool CommandJSON::isAutoEnabled ( ) const
finaloverrideprotectedvirtual

Returns whether this factory is automatically enabled.

Returns
True if auto-enabled.

Reimplemented from IOFactory.

◆ readFile()

bool CommandJSON::readFile ( FactoryParameters & file)
finaloverrideprotectedvirtual

Reads build action definitions from a JSON file.

Parameters
[in]fileThe factory parameters including the file to read.
Returns
True on success.

Implements IOFactory.

◆ writeFile()

bool CommandJSON::writeFile ( FactoryParameters & )
finaloverrideprotectedvirtual

Writes build action definitions to a JSON file.

Parameters
[in]fileThe factory parameters for the output.
Returns
True on success.

Implements IOFactory.


The documentation for this class was generated from the following file: