NDEVR
API Documentation
DNBJSONFactory

Factory for reading and writing NDEVR Design Bundle (DNB) files in JSON format. More...

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

Static Public Member Functions

static DNBJSONFactoryDefaultFactory ()
 Retrieves the singleton default instance of DNBJSONFactory.
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

 DNBJSONFactory ()
 Constructs a DNBJSONFactory instance.
bool canRead (const File &file) final override
 Checks whether this factory can read the given file.
bool canWrite (const File &file) final override
 Checks whether this factory can write to the given file.
FactoryOptions defaultReadOptions (const FactoryParameters &file) const final override
 Retrieves the default read options for the given file.
FactoryOptions defaultWriteOptions (const FactoryParameters &file) const final override
 Retrieves the default write options for the given file.
bool determineExtension (const File &file, String &extension) final override
 Determines the appropriate file extension for the given file.
FactoryFeatures factoryFeatures (const FactoryParameters &file, bool is_import) const override
 Retrieves the feature set supported by this factory for the given file context.
Buffer< UUIDfilterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const final override
 Filters a set of model UUIDs to determine which should be included in an export.
String getIcon (const File &file) final override
 Retrieves the icon resource name associated with the given file.
void getSupportedFormats (Buffer< FileFormat > &formats, bool is_read) final override
 Populates the given buffer with file formats supported by this factory.
virtual void getSupportedFormatsByModelType (Buffer< FileFormat > &formats, bool is_read, const StringView &model_type) override
 Populates the given buffer with file formats supported for a specific model type.
bool isAutoEnabled () const final override
 Indicates whether this factory is automatically enabled for file operations.
bool readFile (FactoryParameters &file) final override
 Reads a DNB JSON file and populates the design model from its contents.
bool writeFile (FactoryParameters &) final override
 Writes design data to a DNB 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 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

Factory for reading and writing NDEVR Design Bundle (DNB) files in JSON format.


DNBJSONFactory handles serialization and deserialization of NDEVR design data to and from JSON-based .dnb files. It extends IOFactory to integrate with the NDEVR file I/O framework.

Definition at line 49 of file DNBJSONFactory.h.

Constructor & Destructor Documentation

◆ DNBJSONFactory()

DNBJSONFactory::DNBJSONFactory ( )
protected

Constructs a DNBJSONFactory instance.

Protected to enforce singleton access through DefaultFactory().

Referenced by DefaultFactory().

Member Function Documentation

◆ canRead()

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

Checks whether this factory can read the given file.

Parameters
[in]fileThe file to check.
Returns
True if this factory supports reading the file, false otherwise.

Reimplemented from IOFactory.

◆ canWrite()

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

Checks whether this factory can write to the given file.

Parameters
[in]fileThe file to check.
Returns
True if this factory supports writing the file, false otherwise.

Reimplemented from IOFactory.

◆ DefaultFactory()

DNBJSONFactory * DNBJSONFactory::DefaultFactory ( )
static

Retrieves the singleton default instance of DNBJSONFactory.

Returns
A pointer to the default DNBJSONFactory instance.

References DNBJSONFactory().

◆ defaultReadOptions()

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

Retrieves the default read options for the given file.

Parameters
[in]fileThe factory parameters describing the file context.
Returns
A FactoryOptions containing the default read configuration.

Reimplemented from IOFactory.

References defaultReadOptions().

Referenced by defaultReadOptions().

◆ defaultWriteOptions()

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

Retrieves the default write options for the given file.

Parameters
[in]fileThe factory parameters describing the file context.
Returns
A FactoryOptions containing the default write configuration.

Reimplemented from IOFactory.

References defaultWriteOptions().

Referenced by defaultWriteOptions().

◆ determineExtension()

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

Determines the appropriate file extension for the given file.

Parameters
[in]fileThe file to determine the extension for.
[in]extensionOutput string that will be set to the determined extension.
Returns
True if an extension was successfully determined, false otherwise.

Reimplemented from IOFactory.

References determineExtension().

Referenced by determineExtension().

◆ factoryFeatures()

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

Retrieves the feature set supported by this factory for the given file context.

Parameters
[in]fileThe factory parameters describing the file context.
[in]is_importWhether the operation is an import (true) or export (false).
Returns
A FactoryFeatures describing the capabilities of this factory.

Implements IOFactory.

References factoryFeatures().

Referenced by factoryFeatures().

◆ filterModelsToExport()

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

Filters a set of model UUIDs to determine which should be included in an export.

Parameters
[in]models_to_checkThe buffer of model UUIDs to evaluate.
[in]lookupThe design object lookup providing access to the model hierarchy.
[in]export_formatThe target file format for the export.
Returns
A Buffer of UUIDs representing the models that should be exported.

Reimplemented from IOFactory.

References filterModelsToExport().

Referenced by filterModelsToExport().

◆ getIcon()

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

Retrieves the icon resource name associated with the given file.

Parameters
[in]fileThe file to retrieve the icon for.
Returns
A String containing the icon resource name.

Reimplemented from IOFactory.

◆ getSupportedFormats()

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

Populates the given buffer with file formats supported by this factory.

Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]is_readWhether to return formats supported for reading (true) or writing (false).

Implements IOFactory.

◆ getSupportedFormatsByModelType()

virtual void DNBJSONFactory::getSupportedFormatsByModelType ( Buffer< FileFormat > & formats,
bool is_read,
const StringView & model_type )
overrideprotectedvirtual

Populates the given buffer with file formats supported for a specific model type.

Parameters
[in]formatsThe buffer to populate with supported FileFormat entries.
[in]is_readWhether to return formats supported for reading (true) or writing (false).
[in]model_typeThe model type to filter supported formats by.

Reimplemented from IOFactory.

◆ isAutoEnabled()

bool DNBJSONFactory::isAutoEnabled ( ) const
finaloverrideprotectedvirtual

Indicates whether this factory is automatically enabled for file operations.

Returns
True if the factory is auto-enabled, false otherwise.

Reimplemented from IOFactory.

◆ readFile()

bool DNBJSONFactory::readFile ( FactoryParameters & file)
finaloverrideprotectedvirtual

Reads a DNB JSON file and populates the design model from its contents.

Parameters
[in]fileThe factory parameters containing the file and target design context.
Returns
True if the file was read successfully, false otherwise.

Implements IOFactory.

◆ writeFile()

bool DNBJSONFactory::writeFile ( FactoryParameters & )
finaloverrideprotectedvirtual

Writes design data to a DNB JSON file.

Parameters
[in]fileThe factory parameters containing the data and target file path.
Returns
True if the file was written successfully, false otherwise.

Implements IOFactory.


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