Loading...
Searching...
No Matches
OpenMesh::IO::BaseReader Class Referenceabstract

Base class for reader modules. More...

`#include <OpenMesh/Core/IO/reader/BaseReader.hh>`

Inheritance diagram for OpenMesh::IO::BaseReader:
[legend]

## Public Member Functions

virtual | ~BaseReader ()
| Destructor.
virtual std::string | get_description () const =0
| Returns a brief description of the file type that can be parsed.
virtual std::string | get_extensions () const =0
| Returns a string with the accepted file extensions separated by a whitespace and in small caps.
virtual std::string | get_magic () const
| Return magic bits used to determine file format.
virtual bool | read (const std::string &_filename, BaseImporter &_bi, Options &_opt)=0
| Reads a mesh given by a filename.
virtual bool | read (std::istream &_is, BaseImporter &_bi, Options &_opt)=0
| Reads a mesh given by a std::stream.
virtual bool | can_u_read (const std::string &_filename) const
| Returns true if writer can parse _filename (checks extension).

## Protected Member Functions

bool | check_extension (const std::string &_fname, const std::string &_ext) const

## Detailed Description

Base class for reader modules.

Reader modules access persistent data and pass them to the desired data structure by the means of a BaseImporter derivative. All reader modules must be derived from this class.

## Member Function Documentation

## can_u_read()

bool OpenMesh::IO::BaseReader::can_u_read | ( | const std::string & | _filename | ) | const

virtual

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

Parameters

  _filename | complete name of a file or just the extension

Returns
  true, if reader can read data with the given extension

Reimplemented in OpenMesh::IO::_OFFReader_, OpenMesh::IO::_OMReader_, and OpenMesh::IO::_PLYReader_.

## get_description()

virtual std::string OpenMesh::IO::BaseReader::get_description | ( |  | ) | const

pure virtual

Returns a brief description of the file type that can be parsed.

Implemented in OpenMesh::IO::_OBJReader_, OpenMesh::IO::_OFFReader_, OpenMesh::IO::_OMReader_, OpenMesh::IO::_PLYReader_, and OpenMesh::IO::_STLReader_.

## get_extensions()

virtual std::string OpenMesh::IO::BaseReader::get_extensions | ( |  | ) | const

pure virtual

Returns a string with the accepted file extensions separated by a whitespace and in small caps.

Implemented in OpenMesh::IO::_OBJReader_, OpenMesh::IO::_OFFReader_, OpenMesh::IO::_OMReader_, OpenMesh::IO::_PLYReader_, and OpenMesh::IO::_STLReader_.

## get_magic()

virtual std::string OpenMesh::IO::BaseReader::get_magic | ( |  | ) | const

inline virtual

Return magic bits used to determine file format.

Reimplemented in OpenMesh::IO::_OFFReader_, OpenMesh::IO::_OMReader_, and OpenMesh::IO::_PLYReader_.

## read() [1/2]

virtual bool OpenMesh::IO::BaseReader::read | ( | const std::string & | _filename,
|  | BaseImporter & | _bi,
|  | Options & | _opt
| ) |  |

pure virtual

Reads a mesh given by a filename.

Usually this method opens a stream and passes it to stream read method. Acceptance checks by filename extension can be placed here.

Options can be passed via _opt. After execution _opt contains the Options that were available

Implemented in OpenMesh::IO::_OBJReader_, OpenMesh::IO::_OFFReader_, OpenMesh::IO::_OMReader_, OpenMesh::IO::_PLYReader_, and OpenMesh::IO::_STLReader_.

## read() [2/2]

virtual bool OpenMesh::IO::BaseReader::read | ( | std::istream & | _is,
|  | BaseImporter & | _bi,
|  | Options & | _opt
| ) |  |

pure virtual

Reads a mesh given by a std::stream.

This method usually uses the same stream reading method that read uses. Options can be passed via _opt. After execution _opt contains the Options that were available.

Please make sure that if _is is std::ifstream, the correct std::ios_base::openmode flags are set.

Implemented in OpenMesh::IO::_OBJReader_, OpenMesh::IO::_OFFReader_, OpenMesh::IO::_STLReader_, OpenMesh::IO::_OMReader_, and OpenMesh::IO::_PLYReader_.

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

- OpenMesh/Core/IO/reader/BaseReader.hh
- OpenMesh/Core/IO/reader/BaseReader.cc