From e2c40b8d6cabc68eda634e103d0824fb58d5908b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 6 Jul 2009 16:36:47 +0000 Subject: Change C++ canvas import/export semantics. --- libdimensionxx/dimensionxx/canvas.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libdimensionxx/dimensionxx/canvas.hpp') diff --git a/libdimensionxx/dimensionxx/canvas.hpp b/libdimensionxx/dimensionxx/canvas.hpp index f519fbd..b8f2887 100644 --- a/libdimensionxx/dimensionxx/canvas.hpp +++ b/libdimensionxx/dimensionxx/canvas.hpp @@ -23,6 +23,8 @@ #ifndef DIMENSIONXX_CANVAS_HPP #define DIMENSIONXX_CANVAS_HPP +#include + namespace Dimension { // Base canvas class. Wraps a dmnsn_canvas*. @@ -31,10 +33,14 @@ namespace Dimension public: // Allocate a dmnsn_canvas of specified width and height Canvas(unsigned int width, unsigned int height); + // Wrap an existing canvas explicit Canvas(dmnsn_canvas* canvas); + + // Canvas(const Canvas& canvas); + // Delete the canvas - virtual ~Canvas(); + ~Canvas(); // Get the width and height unsigned int width() const; @@ -48,17 +54,11 @@ namespace Dimension dmnsn_canvas* dmnsn(); const dmnsn_canvas* dmnsn() const; - protected: - // Derived classes may want to set m_canvas later. Set it to NULL now, so - // that the destructor can still dmnsn_delete_canvas it. - Canvas(); - - dmnsn_canvas* m_canvas; - private: - // Copying prohibited - Canvas(const Canvas&); + // Copy-assignment prohibited Canvas& operator=(const Canvas&); + + std::tr1::shared_ptr m_canvas; }; } -- cgit v1.2.3