]> granicus.if.org Git - imagemagick/commitdiff
Whitespace cleanup.
authordirk <dirk@git.imagemagick.org>
Sat, 26 Dec 2015 14:26:20 +0000 (15:26 +0100)
committerdirk <dirk@git.imagemagick.org>
Sat, 26 Dec 2015 14:26:20 +0000 (15:26 +0100)
Magick++/lib/Drawable.cpp
Magick++/lib/Magick++/Drawable.h

index b5aa53c06db6adeda63a699b5ac67242de433354..7d089fab7b5c623f46358d006641cc1ac3d979f9 100644 (file)
@@ -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)
 //
 
 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_*/,
index d2b33b580c16931b734f845cd50988b1dad95d87..71e78c1ba1ee43dcfb0ca72e2f821957010cbbfb 100644 (file)
@@ -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)
 //
 
 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<Magick::Coordinate>;
 
-//   MagickDrawableExtern template class MagickPPExport
-//   std::vector<Magick::Coordinate, std::allocator<Magick::Coordinate> >;
-
 #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<MagickCore::DrawingWand,void>;
   class MagickPPExport DrawableBase:
     public std::unary_function<MagickCore::DrawingWand,void>
   {
   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 <X11/Xproto.h>
+  #undef Drawable // Conflict with <X11/Xproto.h>
   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;