From e9290b468d1bb6372c8dc8a4c53deda3f4de367a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Fri, 21 Aug 2015 12:44:24 +0000 Subject: [PATCH] remove redundant code refs #2525 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1330 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/IO/writer/PLYWriter.cc | 58 ++++++------------------ src/OpenMesh/Core/IO/writer/PLYWriter.hh | 2 +- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/src/OpenMesh/Core/IO/writer/PLYWriter.cc b/src/OpenMesh/Core/IO/writer/PLYWriter.cc index 49186c90..5fbea019 100644 --- a/src/OpenMesh/Core/IO/writer/PLYWriter.cc +++ b/src/OpenMesh/Core/IO/writer/PLYWriter.cc @@ -49,7 +49,7 @@ //== INCLUDES ================================================================= - +#include #include #include #include @@ -102,6 +102,20 @@ _PLYWriter_::_PLYWriter_() bool _PLYWriter_:: write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision) const +{ + + // open file + std::ofstream out(_filename.c_str(), (_opt.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out + : std::ios_base::out) ); + return write(out, _be, _opt, _precision); +} + +//----------------------------------------------------------------------------- + + +bool +_PLYWriter_:: +write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _precision) const { // check exporter features if ( !check( _be, _opt ) ) @@ -127,48 +141,6 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream options_ = _opt; - // 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() << "[PLYWriter] : cannot open file " - << _filename - << std::endl; - return false; - } - - 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; -} - -//----------------------------------------------------------------------------- - - -bool -_PLYWriter_:: -write(std::ostream& _os, BaseExporter& _be, Options _opt, std::streamsize _precision) const -{ - // check exporter features - if ( !check( _be, _opt ) ) - return false; - - - // check writer features - if ( _opt.check(Options::FaceNormal) || _opt.check(Options::FaceColor) ) // not supported yet - return false; - - options_ = _opt; - if (!_os.good()) { diff --git a/src/OpenMesh/Core/IO/writer/PLYWriter.hh b/src/OpenMesh/Core/IO/writer/PLYWriter.hh index 8dcc8c7a..324d1c7b 100644 --- a/src/OpenMesh/Core/IO/writer/PLYWriter.hh +++ b/src/OpenMesh/Core/IO/writer/PLYWriter.hh @@ -63,7 +63,7 @@ #include #include -#include +#include #include #include