Some cppcheck fixes

This commit is contained in:
Jan Möbius
2023-02-28 12:20:22 +01:00
parent b4f94b7416
commit af7e7183be
13 changed files with 107 additions and 98 deletions

View File

@@ -105,23 +105,23 @@ public:
/** Write to a file /** Write to a file
* @param _filename write to file with the given filename * @param _filename write to file with the given filename
* @param _be BaseExporter, which specifies the data source * @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. * @param _precision can be used to specify the precision of the floating point notation.
*/ */
virtual bool write(const std::string& _filename, virtual bool write(const std::string& _filename,
BaseExporter& _be, BaseExporter& _be,
Options _opt, const Options& _writeOptions,
std::streamsize _precision = 6) const = 0; std::streamsize _precision = 6) const = 0;
/** Write to a std::ostream /** Write to a std::ostream
* @param _os write to std::ostream * @param _os write to std::ostream
* @param _be BaseExporter, which specifies the data source * @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. * @param _precision can be used to specify the precision of the floating point notation.
*/ */
virtual bool write(std::ostream& _os, virtual bool write(std::ostream& _os,
BaseExporter& _be, BaseExporter& _be,
Options _opt, const Options& _writeOptions,
std::streamsize _precision = 6) const = 0; std::streamsize _precision = 6) const = 0;
/// Returns expected size of file if binary format is supported else 0. /// Returns expected size of file if binary format is supported else 0.

View File

@@ -81,7 +81,7 @@ _OBJWriter_::_OBJWriter_() { IOManager().register_module(this); }
bool bool
_OBJWriter_:: _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 ); 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); objName_ = objName_.substr(0,dotposition);
} }
bool result = write(out, _be, _opt, _precision); bool result = write(out, _be, _writeOptions, _precision);
out.close(); out.close();
return result; return result;
@@ -213,7 +213,7 @@ writeMaterial(std::ostream& _out, BaseExporter& _be, Options _opt) const
bool bool
_OBJWriter_:: _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; unsigned int idx;
Vec3f v, n; Vec3f v, n;
@@ -229,32 +229,32 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
_out.precision(_precision); _out.precision(_precision);
// check exporter features // check exporter features
if (!check( _be, _opt)) { if (!check( _be, _writeOptions)) {
return false; return false;
} }
// No binary mode for OBJ // 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; 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 // 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; omerr() << "[OBJWriter] : FaceNormal not supported by OBJ Writer" << std::endl;
return false; return false;
} }
// check for unsupported writer features // 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; omerr() << "[OBJWriter] : VertexColor not supported by OBJ Writer" << std::endl;
return false; return false;
} }
//create material file if needed //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 ); 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; omerr() << "[OBJWriter] : cannot write material file " << matFile << std::endl;
}else{ }else{
useMatrial = writeMaterial(matStream, _be, _opt); useMatrial = writeMaterial(matStream, _be, _writeOptions);
matStream.close(); matStream.close();
} }
@@ -274,12 +274,12 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
_out << _be.n_faces() << " faces" << '\n'; _out << _be.n_faces() << " faces" << '\n';
// material file // material file
if ( (useMatrial && _opt.check(Options::FaceColor)) || _opt.texture_file != "") if ( (useMatrial && _writeOptions.check(Options::FaceColor)) || _writeOptions.texture_file != "")
_out << "mtllib " << objName_ << _opt.material_file_extension << '\n'; _out << "mtllib " << objName_ << _writeOptions.material_file_extension << '\n';
std::map<Vec2f,int> texMap; std::map<Vec2f,int> texMap;
//collect Texturevertices from halfedges //collect Texturevertices from halfedges
if(_opt.check(Options::FaceTexCoord)) if(_writeOptions.check(Options::FaceTexCoord))
{ {
std::vector<Vec2f> texCoords; std::vector<Vec2f> texCoords;
//add all texCoords to map //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 //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<nV; ++i) for (size_t i=0, nV=_be.n_vertices(); i<nV; ++i)
{ {
@@ -303,7 +303,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
// assign each texcoord in the map its id // assign each texcoord in the map its id
// and write the vt entries // and write the vt entries
if(_opt.check(Options::VertexTexCoord) || _opt.check(Options::FaceTexCoord)) if(_writeOptions.check(Options::VertexTexCoord) || _writeOptions.check(Options::FaceTexCoord))
{ {
int texCount = 0; int texCount = 0;
for(std::map<Vec2f,int>::iterator it = texMap.begin(); it != texMap.end() ; ++it) for(std::map<Vec2f,int>::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'; _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'; _out << "vn " << n[0] <<" "<< n[1] <<" "<< n[2] << '\n';
} }
size_t lastMat = std::numeric_limits<std::size_t>::max(); size_t lastMat = std::numeric_limits<std::size_t>::max();
// we do not want to write seperators if we only write vertex indices // we do not want to write seperators if we only write vertex indices
bool onlyVertices = !_opt.check(Options::VertexTexCoord) bool onlyVertices = !_writeOptions.check(Options::VertexTexCoord)
&& !_opt.check(Options::VertexNormal) && !_writeOptions.check(Options::VertexNormal)
&& !_opt.check(Options::FaceTexCoord); && !_writeOptions.check(Options::FaceTexCoord);
// faces (indices starting at 1 not 0) // faces (indices starting at 1 not 0)
for (size_t i=0, nF=_be.n_faces(); i<nF; ++i) for (size_t i=0, nF=_be.n_faces(); i<nF; ++i)
{ {
if (useMatrial && _opt.check(Options::FaceColor) ){ if (useMatrial && _writeOptions.check(Options::FaceColor) ){
size_t material; size_t material;
//color with alpha //color with alpha
if ( _opt.color_has_alpha() ){ if ( _writeOptions.color_has_alpha() ){
cA = color_cast<OpenMesh::Vec4f> (_be.colorA( FaceHandle(int(i)) )); cA = color_cast<OpenMesh::Vec4f> (_be.colorA( FaceHandle(int(i)) ));
material = getMaterial(cA); material = getMaterial(cA);
} else{ } else{
@@ -374,7 +374,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
_out << "/" ; _out << "/" ;
//write texCoords index from halfedge //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]))]; _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 else
{ {
// write vertex texture coordinate index // write vertex texture coordinate index
if (_opt.check(Options::VertexTexCoord)) if (_writeOptions.check(Options::VertexTexCoord))
_out << texMap[_be.texcoord(vhandles[j])]; _out << texMap[_be.texcoord(vhandles[j])];
} }
// write vertex normal index // write vertex normal index
if ( _opt.check(Options::VertexNormal) ) { if ( _writeOptions.check(Options::VertexNormal) ) {
// write separator // write separator
_out << "/" ; _out << "/" ;
_out << idx; _out << idx;

View File

@@ -91,9 +91,9 @@ public:
std::string get_description() const override { return "Alias/Wavefront"; } std::string get_description() const override { return "Alias/Wavefront"; }
std::string get_extensions() const override { return "obj"; } 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; } size_t binary_size(BaseExporter&, Options) const override { return 0; }

View File

@@ -78,12 +78,12 @@ _OFFWriter_::_OFFWriter_() { IOManager().register_module(this); }
bool bool
_OFFWriter_:: _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::ofstream out(_filename.c_str(), (_writeOptions.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out
: 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 bool
_OFFWriter_:: _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 // check exporter features
if ( !check( _be, _opt ) ) if ( !check( _be, _writeOptions ) )
return false; return false;
// check writer features // check writer features
if ( _opt.check(Options::FaceNormal) ) // not supported by format if ( _writeOptions.check(Options::FaceNormal) ) // not supported by format
return false; return false;
@@ -111,20 +111,20 @@ write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _preci
} }
// write header line // write header line
if (_opt.check(Options::VertexTexCoord)) _os << "ST"; if (_writeOptions.check(Options::VertexTexCoord)) _os << "ST";
if (_opt.check(Options::VertexColor) || _opt.check(Options::FaceColor)) _os << "C"; if (_writeOptions.check(Options::VertexColor) || _writeOptions.check(Options::FaceColor)) _os << "C";
if (_opt.check(Options::VertexNormal)) _os << "N"; if (_writeOptions.check(Options::VertexNormal)) _os << "N";
_os << "OFF"; _os << "OFF";
if (_opt.check(Options::Binary)) _os << " BINARY"; if (_writeOptions.check(Options::Binary)) _os << " BINARY";
_os << "\n"; _os << "\n";
if (!_opt.check(Options::Binary)) if (!_writeOptions.check(Options::Binary))
_os.precision(_precision); _os.precision(_precision);
// write to file // write to file
bool result = (_opt.check(Options::Binary) ? bool result = (_writeOptions.check(Options::Binary) ?
write_binary(_os, _be, _opt) : write_binary(_os, _be, _writeOptions) :
write_ascii(_os, _be, _opt)); write_ascii(_os, _be, _writeOptions));
// return result // return result

View File

@@ -100,9 +100,9 @@ public:
std::string get_description() const override { return "no description"; } std::string get_description() const override { return "no description"; }
std::string get_extensions() const override { return "off"; } 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; size_t binary_size(BaseExporter& _be, Options _opt) const override;

View File

@@ -93,7 +93,7 @@ _OMWriter_()
bool bool
_OMWriter_::write(const std::string& _filename, BaseExporter& _be, _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 // check whether exporter can give us an OpenMesh BaseKernel
if (!_be.kernel()) return false; if (!_be.kernel()) return false;
@@ -103,7 +103,9 @@ _OMWriter_::write(const std::string& _filename, BaseExporter& _be,
if (_filename.rfind(".om") == std::string::npos) if (_filename.rfind(".om") == std::string::npos)
return false; 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); 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 // call stream save method
bool rc = write(ofs, _be, _opt); bool rc = write(ofs, _be, tmpOptions);
// close filestream // close filestream
ofs.close(); ofs.close();
@@ -128,27 +130,31 @@ _OMWriter_::write(const std::string& _filename, BaseExporter& _be,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool 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"; // std::clog << "[OMWriter]::write( stream )\n";
Options tmpOptions = _writeOptions;
// check exporter features // check exporter features
if ( !check( _be, _opt ) ) if ( !check( _be, tmpOptions ) )
{ {
omerr() << "[OMWriter]: exporter does not support wanted feature!\n"; omerr() << "[OMWriter]: exporter does not support wanted feature!\n";
return false; return false;
} }
// Maybe an ascii version will be implemented in the future. // Maybe an ascii version will be implemented in the future.
// For now, support only a binary format // For now, support only a binary format
if ( !_opt.check( Options::Binary ) ) if ( !tmpOptions.check( Options::Binary ) )
_opt += Options::Binary; tmpOptions += Options::Binary;
// Ignore LSB/MSB bit. Always store in LSB (little endian) // Ignore LSB/MSB bit. Always store in LSB (little endian)
_opt += Options::LSB; tmpOptions += Options::LSB;
_opt -= Options::MSB; tmpOptions -= Options::MSB;
return write_binary(_os, _be, _opt); return write_binary(_os, _be, tmpOptions);
} }

View File

@@ -104,7 +104,7 @@ public:
std::string get_extensions() const override std::string get_extensions() const override
{ return "om"; } { 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; size_t binary_size(BaseExporter& _be, Options _opt) const override;
@@ -116,7 +116,7 @@ protected:
static const OMFormat::uchar magic_[3]; static const OMFormat::uchar magic_[3];
static const OMFormat::uint8 version_; 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; bool write_binary(std::ostream&, BaseExporter&, Options) const;

View File

@@ -92,7 +92,7 @@ _PLYWriter_::_PLYWriter_()
bool bool
_PLYWriter_:: _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 // open file
@@ -106,23 +106,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream
bool bool
_PLYWriter_:: _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 // check exporter features
if ( !check( _be, _opt ) ) if ( !check( _be, options_ ) )
return false; return false;
// check writer features // check writer features
if ( _opt.check(Options::FaceNormal) ) { if ( options_.check(Options::FaceNormal) ) {
// Face normals are not supported // Face normals are not supported
// Uncheck these options and output message that // Uncheck these options and output message that
// they are not written out even though they were requested // 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; omerr() << "[PLYWriter] : Warning: Face normals are not supported and thus not exported! " << std::endl;
} }
options_ = _opt;
if (!_os.good()) if (!_os.good())
@@ -132,13 +133,13 @@ write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _preci
return false; return false;
} }
if (!_opt.check(Options::Binary)) if (!options_.check(Options::Binary))
_os.precision(_precision); _os.precision(_precision);
// write to file // write to file
bool result = (_opt.check(Options::Binary) ? bool result = (options_.check(Options::Binary) ?
write_binary(_os, _be, _opt) : write_binary(_os, _be, options_) :
write_ascii(_os, _be, _opt)); write_ascii(_os, _be, options_));
return result; return result;
} }

View File

@@ -98,9 +98,9 @@ public:
std::string get_description() const override { return "PLY polygon file format"; } std::string get_description() const override { return "PLY polygon file format"; }
std::string get_extensions() const override { return "ply"; } 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; size_t binary_size(BaseExporter& _be, Options _opt) const override;

View File

@@ -80,23 +80,25 @@ _STLWriter_::_STLWriter_() { IOManager().register_module(this); }
bool bool
_STLWriter_:: _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 ? // binary or ascii ?
if (_filename.rfind(".stla") != std::string::npos) if (_filename.rfind(".stla") != std::string::npos)
{ {
_opt -= Options::Binary; tmpOptions -= Options::Binary;
} }
else if (_filename.rfind(".stlb") != std::string::npos) else if (_filename.rfind(".stlb") != std::string::npos)
{ {
_opt += Options::Binary; tmpOptions += Options::Binary;
} }
// open file // open file
std::fstream out(_filename.c_str(), (_opt.check(Options::Binary) ? std::ios_base::binary | 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) ); : std::ios_base::out) );
bool result = write(out, _be, _opt, _precision); bool result = write(out, _be, tmpOptions, _precision);
out.close(); out.close();
@@ -108,24 +110,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream
bool bool
_STLWriter_:: _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 // check exporter features
if (!check(_be, _opt)) return false; if (!check(_be, _writeOptions)) return false;
// check writer features // check writer features
if (_opt.check(Options::VertexNormal) || if (_writeOptions.check(Options::VertexNormal) ||
_opt.check(Options::VertexTexCoord) || _writeOptions.check(Options::VertexTexCoord) ||
_opt.check(Options::FaceColor)) _writeOptions.check(Options::FaceColor))
return false; return false;
if (!_opt.check(Options::Binary)) if (!_writeOptions.check(Options::Binary))
_os.precision(_precision); _os.precision(_precision);
if (_opt & Options::Binary) if (_writeOptions & Options::Binary)
return write_stlb(_os, _be, _opt); return write_stlb(_os, _be, _writeOptions);
else else
return write_stla(_os, _be, _opt); return write_stla(_os, _be, _writeOptions);
return false; return false;
} }

View File

@@ -91,9 +91,9 @@ public:
std::string get_description() const override { return "Stereolithography Format"; } std::string get_description() const override { return "Stereolithography Format"; }
std::string get_extensions() const override { return "stl stla stlb"; } 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; size_t binary_size(BaseExporter&, Options) const override;

View File

@@ -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()); std::ofstream out(_filename.c_str());
@@ -33,22 +33,22 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options
return false; 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; VertexHandle vh;
// check exporter features // check exporter features
if (!check(_be, _opt)) { if (!check(_be, _writeOptions)) {
return false; return false;
} }
// check writer features // check writer features
if (!_opt.is_empty()) { if (!_writeOptions.is_empty()) {
omlog() << "[VTKWriter] : writer does not support any options\n"; omlog() << "[VTKWriter] : writer does not support any options\n";
return false; return false;
} }

View File

@@ -32,8 +32,8 @@ public:
std::string get_description() const override { return "VTK"; } std::string get_description() const override { return "VTK"; }
std::string get_extensions() 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(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; } size_t binary_size(BaseExporter&, Options) const override { return 0; }
}; };