From af7e7183bebbd842cdb65bd60526b0ef7254fdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Tue, 28 Feb 2023 12:20:22 +0100 Subject: [PATCH] Some cppcheck fixes --- src/OpenMesh/Core/IO/writer/BaseWriter.hh | 12 +++--- src/OpenMesh/Core/IO/writer/OBJWriter.cc | 48 +++++++++++------------ src/OpenMesh/Core/IO/writer/OBJWriter.hh | 4 +- src/OpenMesh/Core/IO/writer/OFFWriter.cc | 30 +++++++------- src/OpenMesh/Core/IO/writer/OFFWriter.hh | 4 +- src/OpenMesh/Core/IO/writer/OMWriter.cc | 26 +++++++----- src/OpenMesh/Core/IO/writer/OMWriter.hh | 4 +- src/OpenMesh/Core/IO/writer/PLYWriter.cc | 23 +++++------ src/OpenMesh/Core/IO/writer/PLYWriter.hh | 4 +- src/OpenMesh/Core/IO/writer/STLWriter.cc | 32 ++++++++------- src/OpenMesh/Core/IO/writer/STLWriter.hh | 4 +- src/OpenMesh/Core/IO/writer/VTKWriter.cc | 10 ++--- src/OpenMesh/Core/IO/writer/VTKWriter.hh | 4 +- 13 files changed, 107 insertions(+), 98 deletions(-) diff --git a/src/OpenMesh/Core/IO/writer/BaseWriter.hh b/src/OpenMesh/Core/IO/writer/BaseWriter.hh index b1cf122a..f23d2783 100644 --- a/src/OpenMesh/Core/IO/writer/BaseWriter.hh +++ b/src/OpenMesh/Core/IO/writer/BaseWriter.hh @@ -105,23 +105,23 @@ public: /** Write to a file * @param _filename write to file with the given filename * @param _be BaseExporter, which specifies the data source - * @param _opt writing options + * @param _writeOptions writing options * @param _precision can be used to specify the precision of the floating point notation. */ virtual bool write(const std::string& _filename, - BaseExporter& _be, - Options _opt, + BaseExporter& _be, + const Options& _writeOptions, std::streamsize _precision = 6) const = 0; /** Write to a std::ostream * @param _os write to std::ostream * @param _be BaseExporter, which specifies the data source - * @param _opt writing options + * @param _writeOptions writing options * @param _precision can be used to specify the precision of the floating point notation. */ virtual bool write(std::ostream& _os, - BaseExporter& _be, - Options _opt, + BaseExporter& _be, + const Options& _writeOptions, std::streamsize _precision = 6) const = 0; /// Returns expected size of file if binary format is supported else 0. diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index 97c0a00f..eb758bf5 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -81,7 +81,7 @@ _OBJWriter_::_OBJWriter_() { IOManager().register_module(this); } bool _OBJWriter_:: -write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(const std::string& _filename, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { std::fstream out(_filename.c_str(), std::ios_base::out ); @@ -120,7 +120,7 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream objName_ = objName_.substr(0,dotposition); } - bool result = write(out, _be, _opt, _precision); + bool result = write(out, _be, _writeOptions, _precision); out.close(); return result; @@ -213,7 +213,7 @@ writeMaterial(std::ostream& _out, BaseExporter& _be, Options _opt) const bool _OBJWriter_:: -write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(std::ostream& _out, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { unsigned int idx; Vec3f v, n; @@ -229,32 +229,32 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec _out.precision(_precision); // check exporter features - if (!check( _be, _opt)) { + if (!check( _be, _writeOptions)) { return false; } // No binary mode for OBJ - if ( _opt.check(Options::Binary) ) { + if ( _writeOptions.check(Options::Binary) ) { omout() << "[OBJWriter] : Warning, Binary mode requested for OBJ Writer (No support for Binary mode), falling back to standard." << std::endl; } // check for unsupported writer features - if (_opt.check(Options::FaceNormal) ) { + if (_writeOptions.check(Options::FaceNormal) ) { omerr() << "[OBJWriter] : FaceNormal not supported by OBJ Writer" << std::endl; return false; } // check for unsupported writer features - if (_opt.check(Options::VertexColor) ) { + if (_writeOptions.check(Options::VertexColor) ) { omerr() << "[OBJWriter] : VertexColor not supported by OBJ Writer" << std::endl; return false; } //create material file if needed - if ( _opt.check(Options::FaceColor) || _opt.texture_file != ""){ + if ( _writeOptions.check(Options::FaceColor) || _writeOptions.texture_file != ""){ - std::string matFile = path_ + objName_ + _opt.material_file_extension; + std::string matFile = path_ + objName_ + _writeOptions.material_file_extension; std::fstream matStream(matFile.c_str(), std::ios_base::out ); @@ -263,7 +263,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec omerr() << "[OBJWriter] : cannot write material file " << matFile << std::endl; }else{ - useMatrial = writeMaterial(matStream, _be, _opt); + useMatrial = writeMaterial(matStream, _be, _writeOptions); matStream.close(); } @@ -274,12 +274,12 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec _out << _be.n_faces() << " faces" << '\n'; // material file - if ( (useMatrial && _opt.check(Options::FaceColor)) || _opt.texture_file != "") - _out << "mtllib " << objName_ << _opt.material_file_extension << '\n'; + if ( (useMatrial && _writeOptions.check(Options::FaceColor)) || _writeOptions.texture_file != "") + _out << "mtllib " << objName_ << _writeOptions.material_file_extension << '\n'; std::map texMap; //collect Texturevertices from halfedges - if(_opt.check(Options::FaceTexCoord)) + if(_writeOptions.check(Options::FaceTexCoord)) { std::vector texCoords; //add all texCoords to map @@ -291,7 +291,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec } //collect Texture coordinates from vertices - if(_opt.check(Options::VertexTexCoord)) + if(_writeOptions.check(Options::VertexTexCoord)) { for (size_t i=0, nV=_be.n_vertices(); i::iterator it = texMap.begin(); it != texMap.end() ; ++it) @@ -323,26 +323,26 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec _out << "v " << v[0] <<" "<< v[1] <<" "<< v[2] << '\n'; - if (_opt.check(Options::VertexNormal)) + if (_writeOptions.check(Options::VertexNormal)) _out << "vn " << n[0] <<" "<< n[1] <<" "<< n[2] << '\n'; } size_t lastMat = std::numeric_limits::max(); // we do not want to write seperators if we only write vertex indices - bool onlyVertices = !_opt.check(Options::VertexTexCoord) - && !_opt.check(Options::VertexNormal) - && !_opt.check(Options::FaceTexCoord); + bool onlyVertices = !_writeOptions.check(Options::VertexTexCoord) + && !_writeOptions.check(Options::VertexNormal) + && !_writeOptions.check(Options::FaceTexCoord); // faces (indices starting at 1 not 0) for (size_t i=0, nF=_be.n_faces(); i (_be.colorA( FaceHandle(int(i)) )); material = getMaterial(cA); } else{ @@ -374,7 +374,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec _out << "/" ; //write texCoords index from halfedge - if(_opt.check(Options::FaceTexCoord)) + if(_writeOptions.check(Options::FaceTexCoord)) { _out << texMap[_be.texcoord(_be.getHeh(FaceHandle(int(i)),vhandles[j]))]; } @@ -382,12 +382,12 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec else { // write vertex texture coordinate index - if (_opt.check(Options::VertexTexCoord)) + if (_writeOptions.check(Options::VertexTexCoord)) _out << texMap[_be.texcoord(vhandles[j])]; } // write vertex normal index - if ( _opt.check(Options::VertexNormal) ) { + if ( _writeOptions.check(Options::VertexNormal) ) { // write separator _out << "/" ; _out << idx; diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.hh b/src/OpenMesh/Core/IO/writer/OBJWriter.hh index d9168aae..f667b1a9 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.hh +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.hh @@ -91,9 +91,9 @@ public: std::string get_description() const override { return "Alias/Wavefront"; } std::string get_extensions() const override { return "obj"; } - bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(const std::string&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; - bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(std::ostream&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; size_t binary_size(BaseExporter&, Options) const override { return 0; } diff --git a/src/OpenMesh/Core/IO/writer/OFFWriter.cc b/src/OpenMesh/Core/IO/writer/OFFWriter.cc index 83741b1b..aeb933dc 100644 --- a/src/OpenMesh/Core/IO/writer/OFFWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OFFWriter.cc @@ -78,12 +78,12 @@ _OFFWriter_::_OFFWriter_() { IOManager().register_module(this); } bool _OFFWriter_:: -write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(const std::string& _filename, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { - std::ofstream out(_filename.c_str(), (_opt.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out - : std::ios_base::out) ); + std::ofstream out(_filename.c_str(), (_writeOptions.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out + : std::ios_base::out) ); - return write(out, _be, _opt, _precision); + return write(out, _be, _writeOptions, _precision); } //----------------------------------------------------------------------------- @@ -91,15 +91,15 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream bool _OFFWriter_:: -write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(std::ostream& _os, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { // check exporter features - if ( !check( _be, _opt ) ) + if ( !check( _be, _writeOptions ) ) return false; // check writer features - if ( _opt.check(Options::FaceNormal) ) // not supported by format + if ( _writeOptions.check(Options::FaceNormal) ) // not supported by format return false; @@ -111,20 +111,20 @@ write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _preci } // write header line - if (_opt.check(Options::VertexTexCoord)) _os << "ST"; - if (_opt.check(Options::VertexColor) || _opt.check(Options::FaceColor)) _os << "C"; - if (_opt.check(Options::VertexNormal)) _os << "N"; + if (_writeOptions.check(Options::VertexTexCoord)) _os << "ST"; + if (_writeOptions.check(Options::VertexColor) || _writeOptions.check(Options::FaceColor)) _os << "C"; + if (_writeOptions.check(Options::VertexNormal)) _os << "N"; _os << "OFF"; - if (_opt.check(Options::Binary)) _os << " BINARY"; + if (_writeOptions.check(Options::Binary)) _os << " BINARY"; _os << "\n"; - if (!_opt.check(Options::Binary)) + if (!_writeOptions.check(Options::Binary)) _os.precision(_precision); // write to file - bool result = (_opt.check(Options::Binary) ? - write_binary(_os, _be, _opt) : - write_ascii(_os, _be, _opt)); + bool result = (_writeOptions.check(Options::Binary) ? + write_binary(_os, _be, _writeOptions) : + write_ascii(_os, _be, _writeOptions)); // return result diff --git a/src/OpenMesh/Core/IO/writer/OFFWriter.hh b/src/OpenMesh/Core/IO/writer/OFFWriter.hh index 777d3af8..7458c1ae 100644 --- a/src/OpenMesh/Core/IO/writer/OFFWriter.hh +++ b/src/OpenMesh/Core/IO/writer/OFFWriter.hh @@ -100,9 +100,9 @@ public: std::string get_description() const override { return "no description"; } std::string get_extensions() const override { return "off"; } - bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(const std::string&, BaseExporter&, const Options&, std::streamsize _precision = 6) const override; - bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(std::ostream&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; size_t binary_size(BaseExporter& _be, Options _opt) const override; diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.cc b/src/OpenMesh/Core/IO/writer/OMWriter.cc index cfe60603..11939ea5 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OMWriter.cc @@ -93,7 +93,7 @@ _OMWriter_() bool _OMWriter_::write(const std::string& _filename, BaseExporter& _be, - Options _opt, std::streamsize /*_precision*/) const + const Options& _writeOptions, std::streamsize /*_precision*/) const { // check whether exporter can give us an OpenMesh BaseKernel if (!_be.kernel()) return false; @@ -103,7 +103,9 @@ _OMWriter_::write(const std::string& _filename, BaseExporter& _be, if (_filename.rfind(".om") == std::string::npos) return false; - _opt += Options::Binary; // only binary format supported + Options tmpOptions = _writeOptions; + + tmpOptions += Options::Binary; // only binary format supported std::ofstream ofs(_filename.c_str(), std::ios::binary); @@ -115,7 +117,7 @@ _OMWriter_::write(const std::string& _filename, BaseExporter& _be, } // call stream save method - bool rc = write(ofs, _be, _opt); + bool rc = write(ofs, _be, tmpOptions); // close filestream ofs.close(); @@ -128,27 +130,31 @@ _OMWriter_::write(const std::string& _filename, BaseExporter& _be, //----------------------------------------------------------------------------- bool -_OMWriter_::write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize /*_precision*/) const +_OMWriter_::write(std::ostream& _os, BaseExporter& _be, const Options& _writeOptions, std::streamsize /*_precision*/) const { // std::clog << "[OMWriter]::write( stream )\n"; + Options tmpOptions = _writeOptions; + // check exporter features - if ( !check( _be, _opt ) ) + if ( !check( _be, tmpOptions ) ) { omerr() << "[OMWriter]: exporter does not support wanted feature!\n"; return false; } + + // Maybe an ascii version will be implemented in the future. // For now, support only a binary format - if ( !_opt.check( Options::Binary ) ) - _opt += Options::Binary; + if ( !tmpOptions.check( Options::Binary ) ) + tmpOptions += Options::Binary; // Ignore LSB/MSB bit. Always store in LSB (little endian) - _opt += Options::LSB; - _opt -= Options::MSB; + tmpOptions += Options::LSB; + tmpOptions -= Options::MSB; - return write_binary(_os, _be, _opt); + return write_binary(_os, _be, tmpOptions); } diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.hh b/src/OpenMesh/Core/IO/writer/OMWriter.hh index 4f26a9f9..60fd79db 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.hh +++ b/src/OpenMesh/Core/IO/writer/OMWriter.hh @@ -104,7 +104,7 @@ public: std::string get_extensions() const override { return "om"; } - bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(std::ostream&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; size_t binary_size(BaseExporter& _be, Options _opt) const override; @@ -116,7 +116,7 @@ protected: static const OMFormat::uchar magic_[3]; static const OMFormat::uint8 version_; - bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(const std::string&, BaseExporter&, const Options&, std::streamsize _precision = 6) const override; bool write_binary(std::ostream&, BaseExporter&, Options) const; diff --git a/src/OpenMesh/Core/IO/writer/PLYWriter.cc b/src/OpenMesh/Core/IO/writer/PLYWriter.cc index 61d8d95e..b5cc6f35 100644 --- a/src/OpenMesh/Core/IO/writer/PLYWriter.cc +++ b/src/OpenMesh/Core/IO/writer/PLYWriter.cc @@ -92,7 +92,7 @@ _PLYWriter_::_PLYWriter_() bool _PLYWriter_:: -write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(const std::string& _filename, BaseExporter& _be, const Options& _opt, std::streamsize _precision) const { // open file @@ -106,23 +106,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream bool _PLYWriter_:: -write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(std::ostream& _os, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { + + options_ = _writeOptions; + // check exporter features - if ( !check( _be, _opt ) ) + if ( !check( _be, options_ ) ) return false; - // check writer features - if ( _opt.check(Options::FaceNormal) ) { + if ( options_.check(Options::FaceNormal) ) { // Face normals are not supported // Uncheck these options and output message that // they are not written out even though they were requested - _opt.unset(Options::FaceNormal); + options_.unset(Options::FaceNormal); omerr() << "[PLYWriter] : Warning: Face normals are not supported and thus not exported! " << std::endl; } - options_ = _opt; if (!_os.good()) @@ -132,13 +133,13 @@ write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _preci return false; } - if (!_opt.check(Options::Binary)) + if (!options_.check(Options::Binary)) _os.precision(_precision); // write to file - bool result = (_opt.check(Options::Binary) ? - write_binary(_os, _be, _opt) : - write_ascii(_os, _be, _opt)); + bool result = (options_.check(Options::Binary) ? + write_binary(_os, _be, options_) : + write_ascii(_os, _be, options_)); return result; } diff --git a/src/OpenMesh/Core/IO/writer/PLYWriter.hh b/src/OpenMesh/Core/IO/writer/PLYWriter.hh index af190c13..d05978c7 100644 --- a/src/OpenMesh/Core/IO/writer/PLYWriter.hh +++ b/src/OpenMesh/Core/IO/writer/PLYWriter.hh @@ -98,9 +98,9 @@ public: std::string get_description() const override { return "PLY polygon file format"; } std::string get_extensions() const override { return "ply"; } - bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(const std::string&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; - bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(std::ostream&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; size_t binary_size(BaseExporter& _be, Options _opt) const override; diff --git a/src/OpenMesh/Core/IO/writer/STLWriter.cc b/src/OpenMesh/Core/IO/writer/STLWriter.cc index 11160438..428a085f 100644 --- a/src/OpenMesh/Core/IO/writer/STLWriter.cc +++ b/src/OpenMesh/Core/IO/writer/STLWriter.cc @@ -80,23 +80,25 @@ _STLWriter_::_STLWriter_() { IOManager().register_module(this); } bool _STLWriter_:: -write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(const std::string& _filename, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { + Options tmpOptions = _writeOptions; + // binary or ascii ? if (_filename.rfind(".stla") != std::string::npos) { - _opt -= Options::Binary; + tmpOptions -= Options::Binary; } else if (_filename.rfind(".stlb") != std::string::npos) { - _opt += Options::Binary; + tmpOptions += Options::Binary; } // open file - std::fstream out(_filename.c_str(), (_opt.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out - : std::ios_base::out) ); + std::fstream out(_filename.c_str(), (tmpOptions.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out + : std::ios_base::out) ); - bool result = write(out, _be, _opt, _precision); + bool result = write(out, _be, tmpOptions, _precision); out.close(); @@ -108,24 +110,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream bool _STLWriter_:: -write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _precision) const +write(std::ostream& _os, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { // check exporter features - if (!check(_be, _opt)) return false; + if (!check(_be, _writeOptions)) return false; // check writer features - if (_opt.check(Options::VertexNormal) || - _opt.check(Options::VertexTexCoord) || - _opt.check(Options::FaceColor)) + if (_writeOptions.check(Options::VertexNormal) || + _writeOptions.check(Options::VertexTexCoord) || + _writeOptions.check(Options::FaceColor)) return false; - if (!_opt.check(Options::Binary)) + if (!_writeOptions.check(Options::Binary)) _os.precision(_precision); - if (_opt & Options::Binary) - return write_stlb(_os, _be, _opt); + if (_writeOptions & Options::Binary) + return write_stlb(_os, _be, _writeOptions); else - return write_stla(_os, _be, _opt); + return write_stla(_os, _be, _writeOptions); return false; } diff --git a/src/OpenMesh/Core/IO/writer/STLWriter.hh b/src/OpenMesh/Core/IO/writer/STLWriter.hh index 64b9035e..13e12925 100644 --- a/src/OpenMesh/Core/IO/writer/STLWriter.hh +++ b/src/OpenMesh/Core/IO/writer/STLWriter.hh @@ -91,9 +91,9 @@ public: std::string get_description() const override { return "Stereolithography Format"; } std::string get_extensions() const override { return "stl stla stlb"; } - bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(const std::string&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; - bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(std::ostream&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; size_t binary_size(BaseExporter&, Options) const override; diff --git a/src/OpenMesh/Core/IO/writer/VTKWriter.cc b/src/OpenMesh/Core/IO/writer/VTKWriter.cc index 3b3b2332..9015222b 100644 --- a/src/OpenMesh/Core/IO/writer/VTKWriter.cc +++ b/src/OpenMesh/Core/IO/writer/VTKWriter.cc @@ -24,7 +24,7 @@ _VTKWriter_::_VTKWriter_() { IOManager().register_module(this); } //----------------------------------------------------------------------------- -bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const +bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { std::ofstream out(_filename.c_str()); @@ -33,22 +33,22 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options return false; } - return write(out, _be, _opt, _precision); + return write(out, _be, _writeOptions, _precision); } //----------------------------------------------------------------------------- -bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const +bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const { VertexHandle vh; // check exporter features - if (!check(_be, _opt)) { + if (!check(_be, _writeOptions)) { return false; } // check writer features - if (!_opt.is_empty()) { + if (!_writeOptions.is_empty()) { omlog() << "[VTKWriter] : writer does not support any options\n"; return false; } diff --git a/src/OpenMesh/Core/IO/writer/VTKWriter.hh b/src/OpenMesh/Core/IO/writer/VTKWriter.hh index f03e467e..50a5d1c4 100644 --- a/src/OpenMesh/Core/IO/writer/VTKWriter.hh +++ b/src/OpenMesh/Core/IO/writer/VTKWriter.hh @@ -32,8 +32,8 @@ public: std::string get_description() const override { return "VTK"; } std::string get_extensions() const override { return "vtk"; } - bool write(const std::string&, BaseExporter&, Options, std::streamsize _precision = 6) const override; - bool write(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const override; + bool write(const std::string&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; + bool write(std::ostream&, BaseExporter&, const Options& _writeOptions, std::streamsize _precision = 6) const override; size_t binary_size(BaseExporter&, Options) const override { return 0; } };