From 14e5c8c5489c203999422ac4f4f1d48598757d17 Mon Sep 17 00:00:00 2001 From: dirk Date: Sat, 26 Dec 2015 15:26:20 +0100 Subject: [PATCH] Whitespace cleanup. --- Magick++/lib/Drawable.cpp | 103 ++++++++++++++++++------------- Magick++/lib/Magick++/Drawable.h | 101 ++++++++++++------------------ 2 files changed, 102 insertions(+), 102 deletions(-) diff --git a/Magick++/lib/Drawable.cpp b/Magick++/lib/Drawable.cpp index b5aa53c06..7d089fab7 100644 --- a/Magick++/lib/Drawable.cpp +++ b/Magick++/lib/Drawable.cpp @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Implementation of Drawable (Graphic objects) // @@ -19,86 +19,105 @@ using namespace std; -MagickPPExport int Magick::operator == ( const Magick::Coordinate& left_, - const Magick::Coordinate& right_ ) +MagickPPExport int Magick::operator == (const Magick::Coordinate& left_, + const Magick::Coordinate& right_) { - return ( ( left_.x() == right_.x() ) && ( left_.y() == right_.y() ) ); + return((left_.x() == right_.x()) && (left_.y() == right_.y())); } -MagickPPExport int Magick::operator != ( const Magick::Coordinate& left_, - const Magick::Coordinate& right_ ) + +MagickPPExport int Magick::operator != (const Magick::Coordinate& left_, + const Magick::Coordinate& right_) { - return ( ! (left_ == right_) ); + return(!(left_ == right_)); } -MagickPPExport int Magick::operator > ( const Magick::Coordinate& left_, - const Magick::Coordinate& right_ ) + +MagickPPExport int Magick::operator > (const Magick::Coordinate& left_, + const Magick::Coordinate& right_) { - return ( !( left_ < right_ ) && ( left_ != right_ ) ); + return (!(left_ < right_) && (left_ != right_)); } -MagickPPExport int Magick::operator < ( const Magick::Coordinate& left_, - const Magick::Coordinate& right_ ) + +MagickPPExport int Magick::operator < (const Magick::Coordinate& left_, + const Magick::Coordinate& right_) { // Based on distance from origin - return ( (sqrt(left_.x()*left_.x() + left_.y()*left_.y())) < - (sqrt(right_.x()*right_.x() + right_.y()*right_.y())) ); + return((sqrt(left_.x()*left_.x() + left_.y()*left_.y())) < + (sqrt(right_.x()*right_.x() + right_.y()*right_.y()))); } -MagickPPExport int Magick::operator >= ( const Magick::Coordinate& left_, - const Magick::Coordinate& right_ ) + +MagickPPExport int Magick::operator >= (const Magick::Coordinate& left_, + const Magick::Coordinate& right_) { - return ( ( left_ > right_ ) || ( left_ == right_ ) ); + return((left_ > right_) || (left_ == right_)); } -MagickPPExport int Magick::operator <= ( const Magick::Coordinate& left_, - const Magick::Coordinate& right_ ) + +MagickPPExport int Magick::operator <= (const Magick::Coordinate& left_, + const Magick::Coordinate& right_) { - return ( ( left_ < right_ ) || ( left_ == right_ ) ); + return((left_ < right_) || (left_ == right_)); } -/*virtual*/ -Magick::DrawableBase::~DrawableBase ( void ) +/* DrawableBase */ +Magick::DrawableBase::DrawableBase() { } -// Constructor -Magick::Drawable::Drawable ( void ) - : dp(0) +Magick::DrawableBase::~DrawableBase(void) +{ +} + +void Magick::DrawableBase::operator()(MagickCore::DrawingWand * context_) const +{ +} + +Magick::DrawableBase* Magick::DrawableBase::copy() const +{ + return new DrawableBase(*this); +} + +/* Drawable */ +Magick::Drawable::Drawable(void) + : dp((Magick::DrawableBase *) NULL) { } -// Construct from DrawableBase -Magick::Drawable::Drawable ( const Magick::DrawableBase& original_ ) +Magick::Drawable::Drawable(const Magick::DrawableBase& original_) : dp(original_.copy()) { } -// Destructor -Magick::Drawable::~Drawable ( void ) +Magick::Drawable::~Drawable(void) { delete dp; - dp = 0; + dp=(Magick::DrawableBase *) NULL; } -// Copy constructor -Magick::Drawable::Drawable ( const Magick::Drawable& original_ ) - : dp(original_.dp? original_.dp->copy(): 0) +Magick::Drawable::Drawable(const Magick::Drawable& original_) + : dp((original_.dp != (Magick::DrawableBase *) NULL ? original_.dp->copy() : + (Magick::DrawableBase *) NULL)) { } -// Assignment operator -Magick::Drawable& Magick::Drawable::operator= (const Magick::Drawable& original_ ) +Magick::Drawable& Magick::Drawable::operator= ( + const Magick::Drawable& original_) { + DrawableBase + *temp_dp; + if (this != &original_) { - DrawableBase* temp_dp = (original_.dp ? original_.dp->copy() : 0); + temp_dp=(original_.dp != (Magick::DrawableBase *) NULL ? + original_.dp->copy() : (Magick::DrawableBase *) NULL); delete dp; - dp = temp_dp; + dp=temp_dp; } - return *this; + return(*this); } -// Operator to invoke contained object -void Magick::Drawable::operator()( MagickCore::DrawingWand * context_ ) const +void Magick::Drawable::operator()(MagickCore::DrawingWand * context_) const { - if(dp) - dp->operator()( context_ ); + if (dp != (Magick::DrawableBase *) NULL) + dp->operator()(context_); } MagickPPExport int Magick::operator == ( const Magick::Drawable& /*left_*/, diff --git a/Magick++/lib/Magick++/Drawable.h b/Magick++/lib/Magick++/Drawable.h index d2b33b580..71e78c1ba 100644 --- a/Magick++/lib/Magick++/Drawable.h +++ b/Magick++/lib/Magick++/Drawable.h @@ -1,7 +1,7 @@ // This may look like C code, but it is really -*- C++ -*- // // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002 -// Copyright Dirk Lemstra 2014 +// Copyright Dirk Lemstra 2014-2015 // // Definition of Drawable (Graphic objects) // @@ -40,41 +40,28 @@ namespace Magick { - // // Representation of an x,y coordinate // class MagickPPExport Coordinate { public: - Coordinate ( void ) + + Coordinate(void) : _x(0), - _y(0) - { } - Coordinate ( double x_, double y_ ) + _y(0) {} + + Coordinate(double x_,double y_) : _x(x_), - _y(y_) - { } - virtual ~Coordinate () - { } - - void x ( double x_ ) - { - _x = x_; - } - double x ( void ) const - { - return _x; - } - - void y ( double y_ ) - { - _y = y_; - } - double y ( void ) const - { - return _y; - } + _y(y_) {} + + virtual ~Coordinate() {} + + void x(double x_) { _x=x_; } + double x(void) const { return _x; } + + void y(double y_) { _y=y_; } + double y(void) const { return _y; } private: double _x; @@ -88,74 +75,68 @@ namespace Magick MagickDrawableExtern template class MagickPPExport std::allocator; -// MagickDrawableExtern template class MagickPPExport -// std::vector >; - #endif // MagickDLLExplicitTemplate // Compare two Coordinate objects regardless of LHS/RHS - extern MagickPPExport int operator == ( const Coordinate& left_, - const Coordinate& right_ ); - extern MagickPPExport int operator != ( const Coordinate& left_, - const Coordinate& right_ ); - extern MagickPPExport int operator > ( const Coordinate& left_, - const Coordinate& right_ ); - extern MagickPPExport int operator < ( const Coordinate& left_, - const Coordinate& right_ ); - extern MagickPPExport int operator >= ( const Coordinate& left_, - const Coordinate& right_ ); - extern MagickPPExport int operator <= ( const Coordinate& left_, - const Coordinate& right_ ); + extern MagickPPExport int operator == + (const Coordinate& left_,const Coordinate& right_); + extern MagickPPExport int operator != + (const Coordinate& left_, const Coordinate& right_); + extern MagickPPExport int operator > + (const Coordinate& left_, const Coordinate& right_); + extern MagickPPExport int operator < + (const Coordinate& left_, const Coordinate& right_); + extern MagickPPExport int operator >= + (const Coordinate& left_, const Coordinate& right_); + extern MagickPPExport int operator <= + (const Coordinate& left_, const Coordinate& right_); // // Base class for all drawable objects // - //struct MagickPPExport std::unary_function; class MagickPPExport DrawableBase: public std::unary_function { public: - // Constructor - DrawableBase ( void ) - { } + + // Default constructor + DrawableBase(void); // Destructor - virtual ~DrawableBase ( void ); + virtual ~DrawableBase(void); // Operator to invoke equivalent draw API call - virtual void operator()( MagickCore::DrawingWand *) const = 0; + virtual void operator()(MagickCore::DrawingWand *) const; // Return polymorphic copy of object - virtual DrawableBase* copy() const = 0; - - private: + virtual DrawableBase* copy() const; }; // // Representation of a drawable surrogate object to manage drawable objects // -#undef Drawable // Conflict with + #undef Drawable // Conflict with class MagickPPExport Drawable { public: - // Constructor - Drawable ( void ); + // Default constructor + Drawable(void); // Construct from DrawableBase - Drawable ( const DrawableBase& original_ ); + Drawable(const DrawableBase& original_); // Destructor - ~Drawable ( void ); + ~Drawable(void); // Copy constructor - Drawable ( const Drawable& original_ ); + Drawable(const Drawable& original_); // Assignment operator - Drawable& operator= (const Drawable& original_ ); + Drawable& operator=(const Drawable& original_); // Operator to invoke contained object - void operator()( MagickCore::DrawingWand *context_ ) const; + void operator()(MagickCore::DrawingWand *) const; private: DrawableBase* dp; -- 2.40.0