Loading...
Searching...
No Matches
SBIFileImporter Class Referenceabstract

This class is the base class for importers.

Parsing functions

SBGFileImporter * propertyDialog
 
virtual bool canImportFromFile (const std::string &fileName)
 Returns true when the file fileName can be imported using this importer.
 
virtual bool importFromFile (const std::string &fileName, const std::unordered_map< std::string, SBValue > *parameters=nullptr, SBDDocumentFolder *preferredFolder=nullptr)=0
 Imports data from a file fileName into the folder preferredFolder with the given parameters.
 
 SBIFileImporter ()
 

Constructors and destructors

virtual ~SBIFileImporter ()
 

User interface

virtual std::string getFilter () const
 Returns the filter, e.g. "Protein Data Bank (*.pdb)" (Qt format)
 
virtual std::string getExtension () const
 Returns the extension, e.g. "pdb".
 
SBGFileImporter * getPropertyDialog () const
 Returns the property dialog of the importer.
 
void setPropertyDialog (SBGFileImporter *g)
 Sets the property dialog of the importer.
 

Member Function Documentation

◆ canImportFromFile()

bool SBIFileImporter::canImportFromFile ( const std::string &  fileName)
virtual

This function should return whether this importer can import data from the file fileName.

This function is called before trying to import a file and is particularly useful if there are multiple importers each supporting different subsets of the format. If your importer supports only a subset of the format then you can check in this function whether the file corresponds to this format and return the result.

By default it returns true and doesn't check for the file's extension.