From 0741377b89b10270a217d7f17ae49c74b247a431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Fri, 21 Aug 2015 12:31:54 +0000 Subject: [PATCH] remove redundant code refs #2525 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1328 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/IO/writer/OFFWriter.cc | 45 +++--------------------- src/OpenMesh/Core/IO/writer/OFFWriter.hh | 2 +- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/OpenMesh/Core/IO/writer/OFFWriter.cc b/src/OpenMesh/Core/IO/writer/OFFWriter.cc index 6e67a5eb..851f3581 100644 --- a/src/OpenMesh/Core/IO/writer/OFFWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OFFWriter.cc @@ -49,7 +49,7 @@ //== INCLUDES ================================================================= - +#include #include #include #include @@ -87,47 +87,10 @@ bool _OFFWriter_:: write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const { - // check exporter features - if ( !check( _be, _opt ) ) - return false; + std::ofstream out(_filename.c_str(), (_opt.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out + : std::ios_base::out) ); - - // check writer features - if ( _opt.check(Options::FaceNormal) ) // not supported by format - return false; - - // open file - std::fstream out(_filename.c_str(), (_opt.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out - : std::ios_base::out) ); - if (!out) - { - omerr() << "[OFFWriter] : cannot open file " - << _filename - << std::endl; - return false; - } - - // write header line - if (_opt.check(Options::VertexTexCoord)) out << "ST"; - if (_opt.check(Options::VertexColor) || _opt.check(Options::FaceColor)) out << "C"; - if (_opt.check(Options::VertexNormal)) out << "N"; - out << "OFF"; - if (_opt.check(Options::Binary)) out << " BINARY"; - out << "\n"; - - - if (!_opt.check(Options::Binary)) - out.precision(_precision); - - // write to file - bool result = (_opt.check(Options::Binary) ? - write_binary(out, _be, _opt) : - write_ascii(out, _be, _opt)); - - - // return result - out.close(); - return result; + return write(out, _be, _opt, _precision); } //----------------------------------------------------------------------------- diff --git a/src/OpenMesh/Core/IO/writer/OFFWriter.hh b/src/OpenMesh/Core/IO/writer/OFFWriter.hh index d2152d3d..22300e39 100644 --- a/src/OpenMesh/Core/IO/writer/OFFWriter.hh +++ b/src/OpenMesh/Core/IO/writer/OFFWriter.hh @@ -63,7 +63,7 @@ #include #include -#include +#include #include #include