NDEVR
API Documentation

Reads and writes NDV files. More...

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

Public Member Functions

virtual bool canRead (const FactoryParameters &file) override
 Checks whether this factory can read the file described by the given parameters.
virtual bool canWrite (const FactoryParameters &file) override
 Checks whether this factory can write the file described by the given parameters.
virtual bool canWrite (const FileFormat &file) override
 Checks whether this factory can write files in the given format.
FactoryOptions defaultReadOptions (const FactoryParameters &file) const override
 Returns the default read options for the given file parameters.
FactoryOptions defaultWriteOptions (const FactoryParameters &file) const override
 Returns the default write options for the given file parameters.
virtual bool determineExtension (const File &file, String &extension) override
 Attempts to determine the file extension for the given file.
FactoryFeatures factoryFeatures (const FactoryParameters &file, bool is_import) const override
 Returns the feature set supported by this factory for the given parameters.
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.
virtual bool readFile (FactoryParameters &params) override
 Reads an NDV file and populates the factory parameters with the resulting model data.
uint08 version (const File &file)
 Returns the NDV format version stored in the given file.
virtual bool writeFile (FactoryParameters &params) override
 Writes model data to an NDV file as described by the factory parameters.
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 File &file)
 Checks whether this factory can read the given file.
virtual bool canRead (const FileFormat &file)
 Checks whether this factory can read the given file format.
virtual bool canWrite (const File &file)
 Checks whether this factory can write the given file.
String factoryReadAppFeature () const
 Returns the application feature string required for read operations.
String factoryWriteAppFeature () const
 Returns the application feature string required for write operations.
virtual Buffer< UUIDfilterModelsToExport (Buffer< UUID > models_to_check, const DesignObjectLookup *lookup, const FileFormat &export_format) const
 Filters a list of model UUIDs to only those that can be exported in the given format.
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 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 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.

Static Public Member Functions

static void AddSetupCallback (NDVSetupCallback *callback)
 Registers an NDVSetupCallback to be invoked during NDV file import.
static uint08 CurrentVersion ()
 Returns the current NDV format version used by this factory for writing.
static NDVFactoryDefaultFactory ()
 Returns the singleton NDVFactory instance.
static FileFormat NDVFormat ()
 Returns the FileFormat descriptor for the NDV file format.
static String ReadData (const File &file)
 Reads raw data content from an NDV file as a String.
static String ReadIcon (const File &file, ImageFactory &factory)
 Reads the icon resource embedded in an NDV file.
static void RemoveSetupCallback (NDVSetupCallback *callback)
 Unregisters a previously added NDVSetupCallback.
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

 NDVFactory ()
 Protected constructor.

Detailed Description

Reads and writes NDV files.


NDV files are optionally compressed data dumps of the internal structure of model hierarchies.

NDVSetupCallbacks can be used to modify objects when they are imported.

Note
The existing comment contains a typo: "heirarchies" should be "hierarchies".
See also
IOFactory, ModelFactory, BinaryFile

Definition at line 73 of file NDVFactory.h.

Constructor & Destructor Documentation

◆ NDVFactory()

NDVFactory::NDVFactory ( )
protected

Protected constructor.


Use DefaultFactory() to obtain the singleton instance.

Referenced by DefaultFactory().

Member Function Documentation

◆ AddSetupCallback()

void NDVFactory::AddSetupCallback ( NDVSetupCallback * callback)
static

Registers an NDVSetupCallback to be invoked during NDV file import.


Parameters
[in]callbackThe callback to add.

◆ canRead()

virtual bool NDVFactory::canRead ( const FactoryParameters & file)
overridevirtual

Checks whether this factory can read the file described by the given parameters.


Parameters
[in]fileThe factory parameters describing the file to check.
Returns
True if the file can be read by this factory, false otherwise.

Reimplemented from IOFactory.

◆ canWrite() [1/2]

virtual bool NDVFactory::canWrite ( const FactoryParameters & file)
overridevirtual

Checks whether this factory can write the file described by the given parameters.


Parameters
[in]fileThe factory parameters describing the file to check.
Returns
True if the file can be written by this factory, false otherwise.

Reimplemented from IOFactory.

◆ canWrite() [2/2]

virtual bool NDVFactory::canWrite ( const FileFormat & file)
overridevirtual

Checks whether this factory can write files in the given format.


Parameters
[in]fileThe FileFormat to check.
Returns
True if the format is supported for writing, false otherwise.

Reimplemented from IOFactory.

◆ CurrentVersion()

uint08 NDVFactory::CurrentVersion ( )
static

Returns the current NDV format version used by this factory for writing.


Returns
The current version number as a uint08.

◆ DefaultFactory()

NDVFactory & NDVFactory::DefaultFactory ( )
static

Returns the singleton NDVFactory instance.


Returns
A reference to the default NDVFactory.

References NDVFactory().

Referenced by TransitIncidentManager::readCache(), and TransitIncidentManager::saveCache().

◆ defaultReadOptions()

FactoryOptions NDVFactory::defaultReadOptions ( const FactoryParameters & file) const
overridevirtual

Returns the default read options for the given file parameters.


Parameters
[in]fileThe factory parameters describing the file context.
Returns
A FactoryOptions populated with default read settings.

Reimplemented from IOFactory.

◆ defaultWriteOptions()

FactoryOptions NDVFactory::defaultWriteOptions ( const FactoryParameters & file) const
overridevirtual

Returns the default write options for the given file parameters.


Parameters
[in]fileThe factory parameters describing the file context.
Returns
A FactoryOptions populated with default write settings.

Reimplemented from IOFactory.

◆ determineExtension()

virtual bool NDVFactory::determineExtension ( const File & file,
String & extension )
overridevirtual

Attempts to determine the file extension for the given file.


Parameters
[in]fileThe file to examine.
[in]extensionReceives the determined extension string on success.
Returns
True if the extension was successfully determined, false otherwise.

Reimplemented from IOFactory.

◆ factoryFeatures()

FactoryFeatures NDVFactory::factoryFeatures ( const FactoryParameters & file,
bool is_import ) const
overridevirtual

Returns the feature set supported by this factory for the given parameters.


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 supported capabilities.

Implements IOFactory.

◆ getIcon()

String NDVFactory::getIcon ( const File & file)
overridevirtual

Returns the icon associated with the given file.


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

Reimplemented from IOFactory.

◆ getSupportedFormats()

virtual void NDVFactory::getSupportedFormats ( Buffer< FileFormat > & formats,
bool is_read )
overridevirtual

Populates the given buffer with the 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.

◆ NDVFormat()

FileFormat NDVFactory::NDVFormat ( )
static

Returns the FileFormat descriptor for the NDV file format.


Returns
A FileFormat representing the NDV format.

Referenced by TransitIncidentManager::readCache(), and TransitIncidentManager::saveCache().

◆ ReadData()

String NDVFactory::ReadData ( const File & file)
static

Reads raw data content from an NDV file as a String.


Parameters
[in]fileThe NDV file to read data from.
Returns
A String containing the file data.

◆ readFile()

virtual bool NDVFactory::readFile ( FactoryParameters & params)
overridevirtual

Reads an NDV file and populates the factory parameters with the resulting model data.


Parameters
[in]paramsThe factory parameters containing the file to read and receiving the output.
Returns
True if the file was read successfully, false otherwise.

Implements IOFactory.

Referenced by TransitIncidentManager::readCache().

◆ ReadIcon()

String NDVFactory::ReadIcon ( const File & file,
ImageFactory & factory )
static

Reads the icon resource embedded in an NDV file.


Parameters
[in]fileThe NDV file to read the icon from.
[in]factoryThe ImageFactory used to decode the icon data.
Returns
A String containing the icon identifier or path.

◆ RemoveSetupCallback()

void NDVFactory::RemoveSetupCallback ( NDVSetupCallback * callback)
static

Unregisters a previously added NDVSetupCallback.


Parameters
[in]callbackThe callback to remove.

◆ version()

uint08 NDVFactory::version ( const File & file)

Returns the NDV format version stored in the given file.


Parameters
[in]fileThe NDV file to query.
Returns
The version number as a uint08.

◆ writeFile()

virtual bool NDVFactory::writeFile ( FactoryParameters & params)
overridevirtual

Writes model data to an NDV file as described by the factory parameters.


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

Implements IOFactory.

Referenced by TransitIncidentManager::saveCache().


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