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
This commit is contained in:
@@ -90,12 +90,12 @@ can_u_read(const std::string& _filename) const
|
|||||||
std::string::size_type pos(_filename.rfind("."));
|
std::string::size_type pos(_filename.rfind("."));
|
||||||
|
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
|
||||||
extension = _filename.substr(pos+1, _filename.length()-pos-1);
|
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(),
|
std::transform( extension.begin(), extension.end(),
|
||||||
extension.begin(), tolower );
|
extension.begin(), tolower );
|
||||||
}
|
|
||||||
|
|
||||||
// locate extension in extension string
|
// locate extension in extension string
|
||||||
return (get_extensions().find(extension) != std::string::npos);
|
return (get_extensions().find(extension) != std::string::npos);
|
||||||
|
|||||||
@@ -131,7 +131,11 @@ public:
|
|||||||
Options& _opt) = 0;
|
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;
|
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("."));
|
std::string::size_type pos(_filename.rfind("."));
|
||||||
|
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
|
||||||
extension = _filename.substr(pos+1, _filename.length()-pos-1);
|
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(),
|
std::transform( extension.begin(), extension.end(),
|
||||||
extension.begin(), tolower );
|
extension.begin(), tolower );
|
||||||
}
|
|
||||||
|
|
||||||
// locate extension in extension string
|
// locate extension in extension string
|
||||||
return (get_extensions().find(extension) != std::string::npos);
|
return (get_extensions().find(extension) != std::string::npos);
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ public:
|
|||||||
/// Return file format's extension.
|
/// Return file format's extension.
|
||||||
virtual std::string get_extensions() const = 0;
|
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;
|
virtual bool can_u_write(const std::string& _filename) const;
|
||||||
|
|
||||||
/** Write to a file
|
/** Write to a file
|
||||||
|
|||||||
Reference in New Issue
Block a user