Commit f1b31421 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'cpp_check' into 'master'

Cpp check

See merge request !221
parents 6e14f292 e7a34cf8
Pipeline #10645 passed with stages
in 51 minutes and 57 seconds
......@@ -20,7 +20,7 @@ echo -e "${NC}"
echo "Please Wait ..."
# Run cppcheck and output into file
cppcheck --enable=all . -I src -i Doc/ --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log
cppcheck --enable=all . -I src -i Doc/ -i src/Unittests --force --suppress=unusedFunction -UCTIME --suppress=missingIncludeSystem --inline-suppr --quiet -Umin -Umax -DOPENMESHDLLEXPORT="" -UPRIVATE_NODE_TYPESYSTEM_SOURCE -USO_NODE_ABSTRACT_SOURCE -USO_NODE_SOURCE -UCLOCK_REALTIME_HR -i src/OpenMesh/Apps/Unsupported/ 2>&1 | tee cppcheck.log
COUNT=$(wc -l < cppcheck.log )
......@@ -30,7 +30,7 @@ echo "CPPCHECK Summary"
echo "=============================================================================="
echo -e "${NC}"
MAX_COUNT=0
MAX_COUNT=27
if [ $COUNT -gt $MAX_COUNT ]; then
echo -e ${WARNING}
......
......@@ -19,7 +19,7 @@ if ( WIN32 )
list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" )
list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
endif()
endif()
endif()
......@@ -45,10 +45,12 @@ endif( WIN32 )
if (UNIX)
set ( ADDITIONAL_CXX_FLAGS )
set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
set ( ADDITIONAL_C_FLAGS )
set ( ADDITIONAL_C_DEBUG_FLAGS )
set ( ADDITIONAL_C_RELEASE_FLAGS )
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
......@@ -58,19 +60,13 @@ if (UNIX)
################################################################################
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
################################################################################
# OS Defines
################################################################################
if (APPLE)
add_definitions( -DARCH_DARWIN )
endif()
......@@ -91,7 +87,7 @@ if (UNIX)
################################################################################
# Warnings
################################################################################
# Add the standard compiler warnings
if ( NOT COMPILER_WARNINGS )
......@@ -104,18 +100,27 @@ if (UNIX)
set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ELSE ()
set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ENDIF()
ENDIF()
endif ( NOT COMPILER_WARNINGS )
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_FLAGS ${COMPILER_WARNINGS} )
if ("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-old-style-cast")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-documentation-unknown-command")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-unreachable-code-return")
# enable later:
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-sign-conversion")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
endif()
################################################################################
# STL Vector checks
################################################################################
......@@ -147,43 +152,49 @@ if (UNIX)
################################################################################
# Add the debug flags
foreach( flag ${ADDITIONAL_CXX_DEBUG_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" )
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} )
list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
endif()
endforeach()
# Add the release flags
foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" )
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} )
list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
endif()
endforeach()
# Add the release with debug info flags
foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" )
foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
endif()
endforeach()
# Add the debug flags
foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} )
if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" )
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} )
list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
endif()
endforeach()
# Add the release flags
foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" )
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} )
list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
endif()
endforeach()
# Add the release with debug info flags
foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" )
foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
endif()
endforeach()
......
......@@ -144,7 +144,7 @@ public:
public: // inherited
bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt)
bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override
{
bool rc;
......@@ -170,7 +170,7 @@ protected slots:
protected:
virtual void keyPressEvent(QKeyEvent* _event);
virtual void keyPressEvent(QKeyEvent* _event) override;
private:
......
......@@ -216,7 +216,7 @@ decimate(const std::string &_ifname,
using namespace std;
Mesh mesh;
OpenMesh::IO::Options opt;
OpenMesh::IO::Options readopt;
OpenMesh::Utils::Timer timer;
// ---------------------------------------- read source mesh
......@@ -227,7 +227,7 @@ decimate(const std::string &_ifname,
if (gverbose)
clog << _ifname << endl;
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, opt)) )
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, readopt)) )
{
cerr << " ERROR: read failed!" << endl;
return rc;
......@@ -238,7 +238,7 @@ decimate(const std::string &_ifname,
{
// ---- 0 - For module NormalFlipping one needs face normals
if ( !opt.check( OpenMesh::IO::Options::FaceNormal ) )
if ( !readopt.check( OpenMesh::IO::Options::FaceNormal ) )
{
if ( !mesh.has_face_normals() )
mesh.request_face_normals();
......@@ -420,11 +420,11 @@ decimate(const std::string &_ifname,
ofname.insert(++pos, n );
}
OpenMesh::IO::Options opt;
OpenMesh::IO::Options writeopt;
//opt += OpenMesh::IO::Options::Binary;
if ( !OpenMesh::IO::write_mesh(mesh, ofname, opt ) )
if ( !OpenMesh::IO::write_mesh(mesh, ofname, writeopt ) )
{
std::cerr << " Cannot write decimated mesh to file '"
<< ofname << "'\n";
......
......@@ -94,8 +94,12 @@ public:
public:
/// default constructor
ProgViewerWidget(QWidget* _parent=0)
: MeshViewerWidget(_parent)
explicit ProgViewerWidget(QWidget* _parent=0)
: MeshViewerWidget(_parent),
n_base_vertices_(0),
n_base_faces_(0),
n_detail_vertices_(0),
n_max_vertices_(0)
{
timer_ = new QTimer(this);
......@@ -133,7 +137,7 @@ private:
/// coarsen mesh down to _n vertices
void coarsen(unsigned int _n);
virtual void keyPressEvent(QKeyEvent* _event);
virtual void keyPressEvent(QKeyEvent* _event) override;
// mesh data
bool animateRefinement_;
......
......@@ -77,7 +77,7 @@ public:
public:
/// default constructor
MeshViewerWidgetT(QWidget* _parent=0)
explicit MeshViewerWidgetT(QWidget* _parent=0)
: QGLViewerWidget(_parent),
f_strips_(false),
tex_id_(0),
......@@ -85,7 +85,8 @@ public:
strips_(mesh_),
use_color_(true),
show_vnormals_(false),
show_fnormals_(false)
show_fnormals_(false),
normal_scale_(1.0)
{
add_draw_mode("Points");
add_draw_mode("Hidden-Line");
......@@ -116,7 +117,7 @@ public:
protected:
/// inherited drawing method
virtual void draw_scene(const std::string& _draw_mode);
virtual void draw_scene(const std::string& _draw_mode) override;
protected:
......@@ -170,7 +171,7 @@ protected: // Strip support
protected: // inherited
virtual void keyPressEvent( QKeyEvent* _event);
virtual void keyPressEvent( QKeyEvent* _event) override;
protected:
......
......@@ -74,7 +74,7 @@ public:
typedef QGLWidget Super;
// Default constructor.
QGLViewerWidget( QWidget* _parent=0 );
explicit QGLViewerWidget( QWidget* _parent=0 );
//
QGLViewerWidget( QGLFormat& _fmt, QWidget* _parent=0 );
......
......@@ -72,7 +72,7 @@ public:
typedef MeshViewerWidgetT<Mesh> Base;
/// default constructor
MeshViewerWidget(QWidget* _parent=0)
explicit MeshViewerWidget(QWidget* _parent=0)
: Base(_parent)
{}
......@@ -80,7 +80,7 @@ public:
~MeshViewerWidget() {}
/// open mesh
inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt)
inline bool open_mesh(const char* _filename, OpenMesh::IO::Options _opt) override
{
if ( Base::open_mesh( _filename, _opt ) )
{
......
......@@ -78,7 +78,14 @@ namespace OpenMesh {
//== IMPLEMENTATION ==========================================================
VDPMSynthesizerViewerWidget::VDPMSynthesizerViewerWidget(QWidget* _parent, const char* _name)
: MeshViewerWidget(_parent)
: MeshViewerWidget(_parent),
kappa_square_(0.0),
adaptive_mode_(false),
n_base_vertices_(0),
n_base_edges_(0),
n_base_faces_(0),
n_details_(0)
{
adaptive_mode_ = true;
}
......
......@@ -107,7 +107,7 @@ public:
public: // inherited
void initialize(void)
void initialize(void) override
{
BaseModQ::initialize();
n_vertices_ = BaseModQ::mesh().n_vertices();
......
......@@ -89,17 +89,17 @@ protected:
inline static Scalar compute_limit_weight(uint _valence)
{
double proj_weight = compute_proj_weight(_valence);
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight
double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0));
double proj_weight_value = compute_proj_weight(_valence);
proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0));
return (Scalar)weight;
}
inline static Scalar compute_step_weight(uint _valence)
{
double proj_weight = compute_proj_weight(_valence);
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight
double weight = proj_weight - (3.0/8.0);
double proj_weight_value = compute_proj_weight(_valence);
proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
double weight = proj_weight_value - (3.0/8.0);
return (Scalar)weight;
}
......
......@@ -112,7 +112,7 @@ public:
{}
template <class _Point>
QuadricT(const _Point& _pt)
explicit QuadricT(const _Point& _pt)
{
set_distance_to_point(_pt);
}
......
......@@ -147,7 +147,7 @@ public:
bool write(const std::string& _filename,
BaseExporter& _be,
Options _opt=Options::Default,
std::streamsize _precision = 6);
std::streamsize _precision = 6);
/** Write a mesh to open std::ostream _os. The source data structure is specified
by the given BaseExporter. The \c save method consecutively queries all
......@@ -159,7 +159,7 @@ public:
const std::string& _ext,
BaseExporter& _be,
Options _opt=Options::Default,
std::streamsize _precision = 6);
std::streamsize _precision = 6);
/// Returns true if the format is supported by one of the reader modules.
......
......@@ -252,7 +252,7 @@ namespace OMFormat {
PropertyName( ) { }
PropertyName( const std::string& _name ) { *this = _name; }
explicit PropertyName( const std::string& _name ) { *this = _name; }
bool is_valid() const { return is_valid( size() ); }
......
......@@ -84,7 +84,7 @@ class ExporterT : public BaseExporter
public:
// Constructor
ExporterT(const Mesh& _mesh) : mesh_(_mesh) {}
explicit ExporterT(const Mesh& _mesh) : mesh_(_mesh) {}
// get vertex data
......
......@@ -89,7 +89,7 @@ public:
typedef std::vector<VertexHandle> VHandles;
ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {}
explicit ImporterT(Mesh& _mesh) : mesh_(_mesh), halfedgeNormals_() {}
virtual VertexHandle add_vertex(const Vec3f& _point) override
......
......@@ -135,13 +135,13 @@ read(const std::string& _filename, BaseImporter& _bi, Options& _opt)
{
#if defined(WIN32)
std::string::size_type dot = _filename.find_last_of("\\/");
std::string::size_type dot_pos = _filename.find_last_of("\\/");
#else
std::string::size_type dot = _filename.rfind("/");
std::string::size_type dot_pos = _filename.rfind("/");
#endif
path_ = (dot == std::string::npos)
path_ = (dot_pos == std::string::npos)
? "./"
: std::string(_filename.substr(0,dot+1));
: std::string(_filename.substr(0,dot_pos+1));
}
bool result = read(in, _bi, _opt);
......
......@@ -87,16 +87,16 @@ public:
virtual ~_OBJReader_() { }
std::string get_description() const { return "Alias/Wavefront"; }
std::string get_extensions() const { return "obj"; }
std::string get_description() const override { return "Alias/Wavefront"; }
std::string get_extensions() const override { return "obj"; }
bool read(const std::string& _filename,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
bool read(std::istream& _in,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
private:
......@@ -105,7 +105,7 @@ private:
{
public:
Material() { cleanup(); }
Material():Tr_(0),index_Kd_(0) { cleanup(); }
void cleanup()
{
......@@ -137,7 +137,7 @@ private:
void set_Tr( float t )
{ Tr_=t; Tr_is_set_=true; }
void set_map_Kd( std::string _name, int _index_Kd )
void set_map_Kd( const std::string& _name, int _index_Kd )
{ map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; };
const Vec3f& Kd( void ) const { return Kd_; }
......
......@@ -118,17 +118,17 @@ public:
/// Destructor
virtual ~_OFFReader_() {};
std::string get_description() const { return "Object File Format"; }
std::string get_extensions() const { return "off"; }
std::string get_magic() const { return "OFF"; }
std::string get_description() const override { return "Object File Format"; }
std::string get_extensions() const override { return "off"; }
std::string get_magic() const override { return "OFF"; }
bool read(const std::string& _filename,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
bool can_u_read(const std::string& _filename) const;
bool can_u_read(const std::string& _filename) const override;
bool read(std::istream& _in, BaseImporter& _bi, Options& _opt );
bool read(std::istream& _in, BaseImporter& _bi, Options& _opt ) override;
private:
......
......@@ -387,10 +387,12 @@ bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi,
default: // skip unknown chunks
{
omerr() << "Unknown chunk type ignored!\n";
size_t size_of = header_.n_vertices_ * OMFormat::vector_size(chunk_header_);
_is.ignore(size_of);
bytes_ += size_of;
size_t chunk_size = header_.n_vertices_ * OMFormat::vector_size(chunk_header_);
_is.ignore(chunk_size);
bytes_ += chunk_size;
break;
}
}
// all chunk data has been read..?!
......@@ -505,9 +507,9 @@ bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, Op
default: // skip unknown chunks
{
omerr() << "Unknown chunk type ignore!\n";
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(size_of);
bytes_ += size_of;
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(chunk_size);
bytes_ += chunk_size;
}
}
return fidx == header_.n_faces_;
......@@ -549,9 +551,9 @@ bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, Op
default:
// skip unknown type
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(size_of);
bytes_ += size_of;
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(chunk_size);
bytes_ += chunk_size;
}
return b < bytes_;
......@@ -627,9 +629,9 @@ bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi
default:
// skip unknown chunk
omerr() << "Unknown chunk type ignored!\n";
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(size_of);
bytes_ += size_of;
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(chunk_size);
bytes_ += chunk_size;
}
return b < bytes_;
......@@ -655,9 +657,9 @@ bool _OMReader_::read_binary_mesh_chunk(std::istream &_is, BaseImporter &_bi, Op
default:
// skip unknown chunk
size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(size_of);
bytes_ += size_of;
size_t chunk_size = OMFormat::chunk_data_size(header_, chunk_header_);
_is.ignore(chunk_size);
bytes_ += chunk_size;
}
return b < bytes_;
......
......@@ -89,20 +89,20 @@ public:
_OMReader_();
virtual ~_OMReader_() { }
std::string get_description() const { return "OpenMesh File Format"; }
std::string get_extensions() const { return "om"; }
std::string get_magic() const { return "OM"; }
std::string get_description() const override { return "OpenMesh File Format"; }
std::string get_extensions() const override { return "om"; }
std::string get_magic() const override { return "OM"; }
bool read(const std::string& _filename,
BaseImporter& _bi,
Options& _opt );
Options& _opt ) override;
//! Stream Reader for std::istream input in binary format
bool read(std::istream& _is,
BaseImporter& _bi,
Options& _opt );
Options& _opt ) override;
virtual bool can_u_read(const std::string& _filename) const;
virtual bool can_u_read(const std::string& _filename) const override;
virtual bool can_u_read(std::istream& _is) const;
......
......@@ -97,19 +97,19 @@ public:
_PLYReader_();
std::string get_description() const { return "PLY polygon file format"; }
std::string get_extensions() const { return "ply"; }
std::string get_magic() const { return "PLY"; }
std::string get_description() const override { return "PLY polygon file format"; }
std::string get_extensions() const override { return "ply"; }
std::string get_magic() const override { return "PLY"; }
bool read(const std::string& _filename,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
bool read(std::istream& _is,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
bool can_u_read(const std::string& _filename) const;
bool can_u_read(const std::string& _filename) const override;
enum ValueType {
Unsupported,
......
......@@ -92,17 +92,17 @@ public:
virtual ~_STLReader_() {};
std::string get_description() const
std::string get_description() const override
{ return "Stereolithography Interface Format"; }
std::string get_extensions() const { return "stl stla stlb"; }
std::string get_extensions() const override { return "stl stla stlb"; }
bool read(const std::string& _filename,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
bool read(std::istream& _in,
BaseImporter& _bi,
Options& _opt);
Options& _opt) override;
/** Set the threshold to be used for considering two point to be equal.
Can be used to merge small gaps */
......
......@@ -133,11 +133,13 @@ protected:
bool check(BaseExporter& _be, Options _opt) const
{
return (_opt.check(Options::VertexNormal ) <= _be.has_vertex_normals())
&& (_opt.check(Options::VertexTexCoord)<= _be.has_vertex_texcoords())
&& (_opt.check(Options::VertexColor) <= _be.has_vertex_colors())
&& (_opt.check(Options::FaceNormal) <= _be.has_face_normals())
&& (_opt.check(Options::FaceColor) <= _be.has_face_colors());
// Check for all Options. When we want to write them (_opt.check() ) , they have to be available ( has_ )
// Converts to not A (write them) or B (available)
return ( !_opt.check(Options::VertexNormal ) || _be.has_vertex_normals())
&& ( !_opt.check(Options::VertexTexCoord)|| _be.has_vertex_texcoords())
&& ( !_opt.check(Options::VertexColor) || _be.has_vertex_colors())
&& ( !_opt.check(Options::FaceNormal) || _be.has_face_normals())
&& ( !_opt.check(Options::FaceColor) || _be.has_face_colors());
}
};
......
......@@ -100,24 +100,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream
{
#if defined(WIN32)
std::string::size_type dot = _filename.find_last_of("\\/");
std::string::size_type dotposition = _filename.find_last_of("\\/");
#else
std::string::size_type dot = _filename.rfind("/");
std::string::size_type dotposition = _filename.rfind("/");
#endif
if (dot == std::string::npos){
if (dotposition == std::string::npos){
path_ = "./";
objName_ = _filename;