Commit beae0ffc authored by Matthias Möller's avatar Matthias Möller

extend "can_read" function. returns true, if no explicit filename is given, but just the extension.

closes #2431

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1260 fdac6126-5c0c-442c-9429-916003d36597
parent 77f93601
......@@ -90,12 +90,12 @@ can_u_read(const std::string& _filename) const
std::string::size_type pos(_filename.rfind("."));
if (pos != std::string::npos)
{
extension = _filename.substr(pos+1, _filename.length()-pos-1);
else
extension = _filename; //check, if the whole filename defines the extension
std::transform( extension.begin(), extension.end(),
extension.begin(), tolower );
}
std::transform( extension.begin(), extension.end(),
extension.begin(), tolower );
// locate extension in extension string
return (get_extensions().find(extension) != std::string::npos);
......
......@@ -131,7 +131,11 @@ public:
Options& _opt) = 0;
/// Returns true if reader can parse _filename (checks extension)
/** \brief Returns true if writer can parse _filename (checks extension).
* _filename can also provide an extension without a name for a file e.g. _filename == "om" checks, if the reader can read the "om" extension
* @param _filename complete name of a file or just the extension
* @result true, if reader can read data with the given extension
*/
virtual bool can_u_read(const std::string& _filename) const;
......
......@@ -93,12 +93,12 @@ can_u_write(const std::string& _filename) const
std::string::size_type pos(_filename.rfind("."));
if (pos != std::string::npos)
{
extension = _filename.substr(pos+1, _filename.length()-pos-1);
else
extension = _filename; //check, if the whole filename defines the extension
std::transform( extension.begin(), extension.end(),
extension.begin(), tolower );
}
std::transform( extension.begin(), extension.end(),
extension.begin(), tolower );
// locate extension in extension string
return (get_extensions().find(extension) != std::string::npos);
......
......@@ -100,7 +100,11 @@ public:
/// Return file format's extension.
virtual std::string get_extensions() const = 0;
/// Returns true if writer can parse _filename (checks extension)
/** \brief Returns true if writer can write _filename (checks extension).
* _filename can also provide an extension without a name for a file e.g. _filename == "om" checks, if the writer can write the "om" extension
* @param _filename complete name of a file or just the extension
* @result true, if writer can write data with the given extension
*/
virtual bool can_u_write(const std::string& _filename) const;
/** Write to a file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment