![]() |
NDEVR
API Documentation
|
The core logic for importing and exporting files from the model hierarchy. More...
Public Member Functions | |
| void | addFactory (IOFactory *factory) |
| Registers an IOFactory to be used for import/export operations. | |
| void | addFactory (StringView extension, IOFactory *factory) |
| Registers an IOFactory for a specific file extension. | |
| void | addToFormatPriority (const StringView &extension, sint04 priority) |
| Adjusts the priority of a file format identified by its file extension. | |
| void | addToFormatPriority (UUID format, sint04 priority) |
| Adjusts the priority of a file format identified by its UUID. | |
| virtual bool | canRead (const FactoryParameters &file) override |
| Checks whether any registered factory can read the given file described by FactoryParameters. | |
| virtual bool | canRead (const File &file) override |
| Checks whether any registered factory can read the given file. | |
| virtual bool | canWrite (const FactoryParameters &file) override |
| Checks whether any registered factory can write the given file described by FactoryParameters. | |
| virtual bool | canWrite (const File &file) override |
| Checks whether any registered factory can write the given file. | |
| void | clearFactories () |
| Removes all registered IOFactory instances from this ModelFactory. | |
| virtual FactoryOptions | defaultReadOptions (const FactoryParameters &file) const override |
| Retrieves the default read options for the given file from the appropriate registered factory. | |
| virtual FactoryOptions | defaultWriteOptions (const FactoryParameters &file) const override |
| Retrieves the default write options for the given file from the appropriate registered factory. | |
| virtual bool | determineExtension (const File &file, String &extension) override |
| Attempts to determine the file extension for the given file by querying registered factories. | |
| void | enableExtension (StringView extension, const StringView &read_password, const StringView &write_password) |
| Enables read/write access for a specific file extension using password-based authorization. | |
| void | enableFactory (const StringView &factory, const StringView &read_password, const StringView &write_password) |
| Enables read/write access for a named factory using password-based authorization. | |
| void | enableFactory (IOFactory *factory, const StringView &read_password, const StringView &write_password) |
| Enables read/write access for a specific IOFactory instance using password-based authorization. | |
| FactoryFeatures | factoryFeatures (const FactoryParameters &file, bool is_import) const override |
| Retrieves the feature flags describing the capabilities of the factory for the given file. | |
| virtual Buffer< UUID > | filterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const override |
| Filters a set of model UUIDs to only those that can be exported in the given format. | |
| virtual String | getIcon (const File &file) override |
| Retrieves the icon name associated with the given file type. | |
| virtual void | getSupportedFormats (Buffer< FileFormat > &formats, bool is_read) override |
| Populates a buffer with all supported file formats for reading or writing, aggregated from all registered child IOFactory instances. | |
| virtual void | getSupportedFormats (Buffer< FileFormat > &formats, const File &file) override |
| Populates a buffer with all supported file formats that can handle the given file, aggregated from all registered child IOFactory instances. | |
| virtual void | getSupportedFormats (Buffer< FileFormat > &formats, DesignObjectLookup *lookup, const Buffer< UUID > &models) override |
| Populates a buffer with all supported file formats that can export the specified models. | |
| virtual void | getSupportedFormatsByModelType (Buffer< FileFormat > &formats, bool is_read, const StringView &model_type) override |
| Populates a buffer with all supported file formats filtered by model type. | |
| virtual bool | readFile (FactoryParameters &file) override |
| Reads the given file by delegating to the appropriate registered IOFactory. | |
| void | sortFormats (Buffer< FileFormat > &formats) |
| Sorts the given buffer of file formats according to the current priority settings. | |
| virtual bool | updateFromFile (const FactoryParameters &file, const FactoryOptions &old_options) override |
| Updates existing data from the file, using the previous options for context. | |
| virtual bool | writeFile (FactoryParameters &file) override |
| Writes the given file by delegating to the appropriate registered IOFactory. | |
| 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 FileFormat &file) |
| Checks whether this factory can read the given file format. | |
| 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 | getSupportedFormatsForExtension (Buffer< FileFormat > &formats, bool is_read, const StringView &extension) |
| Populates the given buffer with formats matching a specific file extension. | |
| virtual bool | isAutoEnabled () const |
| Checks whether this factory is automatically enabled without requiring a password. | |
| virtual bool | isFactoryEnabled (bool is_read) const |
| Checks whether this factory is enabled for reading or writing. | |
| const String & | name () const |
| Returns the name of this factory. | |
| Buffer< UUID > | readFileWithDefaultSettings (const File &file, DesignObjectLookup *lookup) |
| Reads a file using default settings and returns the UUIDs of the created models. | |
| Buffer< Scene > | readScenesFromFile (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. | |
| bool | writeScenesToFile (const File &file, const Buffer< Scene > &scene) |
| Writes a buffer of scenes to a file. | |
Static Public Member Functions | |
| static ModelFactory & | DefaultFactory () |
| Retrieves the singleton ModelFactory 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 | |
| ModelFactory () | |
| Constructs the ModelFactory. | |
| ~ModelFactory () | |
| Destructs the ModelFactory and releases all registered factory references. | |
Protected Attributes | |
| Dictionary< String, Buffer< IOFactory * > > | m_extension_factories |
| Factories indexed by file extension string. | |
| Dictionary< String, String > | m_extension_read_passwords |
| Read passwords keyed by file extension. | |
| Dictionary< String, String > | m_extension_write_passwords |
| Write passwords keyed by file extension. | |
| Buffer< IOFactory * > * | m_factory_objects |
| Collection of all registered IOFactory instances. | |
| Dictionary< UUID, sint04 > | m_id_priority_modification |
| Per-format priority adjustments keyed by format UUID. | |
| Dictionary< String, IOFactory * > | m_named_factories |
| Factories indexed by factory name. | |
The core logic for importing and exporting files from the model hierarchy.
Stores a series of IOFactory children that can define when and how they are able to export or import data.
Based on options will select the proper IOFactory to perform the import or export task. Acts as a central registry and dispatcher for all registered IOFactory instances, delegating read/write operations to the appropriate factory based on file format, extension, and priority settings.
Definition at line 48 of file ModelFactory.h.
|
protected |
Constructs the ModelFactory.
Protected to enforce singleton access via DefaultFactory().
Referenced by DefaultFactory().
|
protected |
Destructs the ModelFactory and releases all registered factory references.
| void ModelFactory::addFactory | ( | IOFactory * | factory | ) |
Registers an IOFactory to be used for import/export operations.
| [in] | factory | The IOFactory instance to register. Ownership is not transferred. |
References IOFactory::IOFactory().
| void ModelFactory::addFactory | ( | StringView | extension, |
| IOFactory * | factory ) |
Registers an IOFactory for a specific file extension.
| [in] | extension | The file extension to associate with the factory. |
| [in] | factory | The IOFactory instance to register. Ownership is not transferred. |
References IOFactory::IOFactory().
| void ModelFactory::addToFormatPriority | ( | const StringView & | extension, |
| sint04 | priority ) |
Adjusts the priority of a file format identified by its file extension.
| [in] | extension | The file extension (e.g., "obj", "stl") whose priority should be modified. |
| [in] | priority | The priority adjustment value. Higher values indicate higher priority. |
|
overridevirtual |
Checks whether any registered factory can read the given file described by FactoryParameters.
| [in] | file | The factory parameters describing the file to check. |
Reimplemented from IOFactory.
|
overridevirtual |
Checks whether any registered factory can read the given file.
| [in] | file | The file to check readability for. |
Reimplemented from IOFactory.
|
overridevirtual |
Checks whether any registered factory can write the given file described by FactoryParameters.
| [in] | file | The factory parameters describing the file to check. |
Reimplemented from IOFactory.
|
overridevirtual |
Checks whether any registered factory can write the given file.
| [in] | file | The file to check writability for. |
Reimplemented from IOFactory.
| void ModelFactory::clearFactories | ( | ) |
Removes all registered IOFactory instances from this ModelFactory.
|
static |
Retrieves the singleton ModelFactory instance.
References ModelFactory().
|
overridevirtual |
Retrieves the default read options for the given file from the appropriate registered factory.
| [in] | file | The factory parameters describing the file to query options for. |
Reimplemented from IOFactory.
|
overridevirtual |
Retrieves the default write options for the given file from the appropriate registered factory.
| [in] | file | The factory parameters describing the file to query options for. |
Reimplemented from IOFactory.
|
overridevirtual |
Attempts to determine the file extension for the given file by querying registered factories.
| [in] | file | The file whose extension should be determined. |
| [in] | extension | Output string that receives the determined extension. |
Reimplemented from IOFactory.
| void ModelFactory::enableExtension | ( | StringView | extension, |
| const StringView & | read_password, | ||
| const StringView & | write_password ) |
Enables read/write access for a specific file extension using password-based authorization.
| [in] | extension | The file extension to enable. |
| [in] | read_password | The password required to enable read access for this extension. |
| [in] | write_password | The password required to enable write access for this extension. |
| void ModelFactory::enableFactory | ( | const StringView & | factory, |
| const StringView & | read_password, | ||
| const StringView & | write_password ) |
Enables read/write access for a named factory using password-based authorization.
| [in] | factory | The name of the factory to enable. |
| [in] | read_password | The password required to enable read access. |
| [in] | write_password | The password required to enable write access. |
| void ModelFactory::enableFactory | ( | IOFactory * | factory, |
| const StringView & | read_password, | ||
| const StringView & | write_password ) |
Enables read/write access for a specific IOFactory instance using password-based authorization.
| [in] | factory | The IOFactory instance to enable. |
| [in] | read_password | The password required to enable read access. |
| [in] | write_password | The password required to enable write access. |
References IOFactory::IOFactory().
|
overridevirtual |
Retrieves the feature flags describing the capabilities of the factory for the given file.
| [in] | file | The factory parameters describing the file to query features for. |
| [in] | is_import | Whether to query import features (true) or export features (false). |
Implements IOFactory.
|
overridevirtual |
Filters a set of model UUIDs to only those that can be exported in the given format.
| [in] | models_to_check | The buffer of model UUIDs to filter. |
| [in] | lookup | The design object lookup used to resolve model data. |
| [in] | export_format | The target export format to filter against. |
Reimplemented from IOFactory.
|
overridevirtual |
Populates a buffer with all supported file formats for reading or writing, aggregated from all registered child IOFactory instances.
| [in] | formats | The buffer to populate with supported FileFormat entries. |
| [in] | is_read | Whether to query for read formats (true) or write formats (false). |
Implements IOFactory.
|
overridevirtual |
Populates a buffer with all supported file formats that can handle the given file, aggregated from all registered child IOFactory instances.
| [in] | formats | The buffer to populate with supported FileFormat entries. |
| [in] | file | The file to check format support for. |
Reimplemented from IOFactory.
|
overridevirtual |
Populates a buffer with all supported file formats that can export the specified models.
| [in] | formats | The buffer to populate with supported FileFormat entries. |
| [in] | lookup | The design object lookup used to resolve model data. |
| [in] | models | The UUIDs of the models to check export support for. |
Reimplemented from IOFactory.
|
overridevirtual |
Populates a buffer with all supported file formats filtered by model type.
| [in] | formats | The buffer to populate with supported FileFormat entries. |
| [in] | is_read | Whether to query for read formats (true) or write formats (false). |
| [in] | model_type | The model type string to filter formats by. |
Reimplemented from IOFactory.
|
overridevirtual |
| void ModelFactory::sortFormats | ( | Buffer< FileFormat > & | formats | ) |
Sorts the given buffer of file formats according to the current priority settings.
| [in] | formats | The buffer of FileFormat entries to sort in place. |
|
overridevirtual |
Updates existing data from the file, using the previous options for context.
| [in] | file | The factory parameters describing the file to re-read. |
| [in] | old_options | The previous options used when the file was originally read. |
Reimplemented from IOFactory.
|
overridevirtual |