Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::FileExtension Class Reference

Public Member Functions

 FileExtension (const FileExtension &)=default
 
 FileExtension (FileExtension &&)=default
 
FileExtensionoperator= (FileExtension &&)=default
 
FileExtensionoperator= (const FileExtension &)=default
 
 FileExtension (std::string_view extension, std::string_view description)
 
std::string toString () const
 
bool empty () const
 
bool matchesAll () const
 returns true, if the current extension matches all files, i.e. it is equal to '*'. Note: the description can be different from all().
 
bool matches (const std::filesystem::path &path) const
 checks whether the given string is matched by this FileExtension Extensions are matched case insensitive while an empty FileExtension, i.e. '*', will match all strings.
 
void serialize (Serializer &s) const
 
void deserialize (Deserializer &d)
 

Static Public Member Functions

static FileExtension createFileExtensionFromString (std::string_view str)
 extracts a FileExtension object from a string. This function assumes that the extension is given within the right most parentheses.
 
static FileExtension all ()
 

Public Attributes

std::string extension_
 File extension in lower case letters.
 
std::string description_
 

Friends

IVW_CORE_API friend std::ostream & operator<< (std::ostream &ss, const FileExtension &ext)
 
IVW_CORE_API friend bool operator== (const FileExtension &, const FileExtension &)
 
IVW_CORE_API friend bool operator!= (const FileExtension &, const FileExtension &)
 
IVW_CORE_API friend bool operator< (const FileExtension &, const FileExtension &)
 
IVW_CORE_API friend bool operator<= (const FileExtension &, const FileExtension &)
 
IVW_CORE_API friend bool operator> (const FileExtension &, const FileExtension &)
 
IVW_CORE_API friend bool operator>= (const FileExtension &, const FileExtension &)
 

Member Function Documentation

◆ createFileExtensionFromString()

static FileExtension inviwo::FileExtension::createFileExtensionFromString ( std::string_view str)
static

extracts a FileExtension object from a string. This function assumes that the extension is given within the right most parentheses.

Parameters
strInput string formed like "Text files (*.txt)".
Returns
FileExtension object created from the information given in the input string.

◆ matches()

bool inviwo::FileExtension::matches ( const std::filesystem::path & path) const

checks whether the given string is matched by this FileExtension Extensions are matched case insensitive while an empty FileExtension, i.e. '*', will match all strings.

Parameters
pathpath to be tested
Returns
true if the string is matched by the FileExtension

◆ matchesAll()

bool inviwo::FileExtension::matchesAll ( ) const

returns true, if the current extension matches all files, i.e. it is equal to '*'. Note: the description can be different from all().

Returns
true if extension_ == '*'

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