diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-07-11 16:54:49 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-07-11 16:54:49 +0000 |
commit | ca84516fa80cfca35da7df71ea04423780028212 (patch) | |
tree | b3441beb05e36698d0ed626fe055d0ea048589b3 /libdimensionxx | |
parent | a64f9e671936451d7a3a60191dcca6e37e97e585 (diff) | |
download | dimension-ca84516fa80cfca35da7df71ea04423780028212.tar.xz |
Make copy() a non-const method.
Diffstat (limited to 'libdimensionxx')
-rw-r--r-- | libdimensionxx/camera.cpp | 2 | ||||
-rw-r--r-- | libdimensionxx/cameras.cpp | 4 | ||||
-rw-r--r-- | libdimensionxx/dimensionxx/camera.hpp | 4 | ||||
-rw-r--r-- | libdimensionxx/dimensionxx/cameras.hpp | 4 | ||||
-rw-r--r-- | libdimensionxx/dimensionxx/object.hpp | 4 | ||||
-rw-r--r-- | libdimensionxx/dimensionxx/objects.hpp | 8 | ||||
-rw-r--r-- | libdimensionxx/object.cpp | 2 | ||||
-rw-r--r-- | libdimensionxx/objects.cpp | 8 |
8 files changed, 18 insertions, 18 deletions
diff --git a/libdimensionxx/camera.cpp b/libdimensionxx/camera.cpp index e2ffbec..b44173c 100644 --- a/libdimensionxx/camera.cpp +++ b/libdimensionxx/camera.cpp @@ -61,7 +61,7 @@ namespace Dimension { } // Protected copy constructor - Camera::Camera(const Camera& camera) + Camera::Camera(Camera& camera) : m_camera(camera.m_camera) { } diff --git a/libdimensionxx/cameras.cpp b/libdimensionxx/cameras.cpp index 2c1b69a..ca571be 100644 --- a/libdimensionxx/cameras.cpp +++ b/libdimensionxx/cameras.cpp @@ -55,13 +55,13 @@ namespace Dimension // Shallow-copy this camera Camera* - Perspective_Camera::copy() const + Perspective_Camera::copy() { return new Perspective_Camera(*this); } // Private copy-constructor, for copy() implementation - Perspective_Camera::Perspective_Camera(const Perspective_Camera& camera) + Perspective_Camera::Perspective_Camera(Perspective_Camera& camera) : Camera(camera) { } } diff --git a/libdimensionxx/dimensionxx/camera.hpp b/libdimensionxx/dimensionxx/camera.hpp index 049f237..9b717ff 100644 --- a/libdimensionxx/dimensionxx/camera.hpp +++ b/libdimensionxx/dimensionxx/camera.hpp @@ -36,7 +36,7 @@ namespace Dimension virtual Line ray(const Canvas& canvas, unsigned int x, unsigned int y); // Shallow-copy a derived camera - virtual Camera* copy() const = 0; + virtual Camera* copy() = 0; // Access the wrapped C camera. dmnsn_camera* dmnsn(); @@ -46,7 +46,7 @@ namespace Dimension // No-op Camera(); // Shallow-copy - Camera(const Camera& camera); + Camera(Camera& camera); // Wrap an existing camera explicit Camera(dmnsn_camera* camera); diff --git a/libdimensionxx/dimensionxx/cameras.hpp b/libdimensionxx/dimensionxx/cameras.hpp index 7f70af7..1764ac5 100644 --- a/libdimensionxx/dimensionxx/cameras.hpp +++ b/libdimensionxx/dimensionxx/cameras.hpp @@ -37,11 +37,11 @@ namespace Dimension void trans(const Matrix& trans); // Shallow-copy the camera - Camera* copy() const; + Camera* copy(); private: // Copying prohibited, but used internally - Perspective_Camera(const Perspective_Camera& camera); + Perspective_Camera(Perspective_Camera& camera); Perspective_Camera& operator=(const Perspective_Camera&); }; } diff --git a/libdimensionxx/dimensionxx/object.hpp b/libdimensionxx/dimensionxx/object.hpp index 8b5d3c9..8283c9c 100644 --- a/libdimensionxx/dimensionxx/object.hpp +++ b/libdimensionxx/dimensionxx/object.hpp @@ -41,7 +41,7 @@ namespace Dimension virtual bool inside(const Vector& point); // Shallow-copy a derived object - virtual Object* copy() const = 0; + virtual Object* copy() = 0; // Access the wrapped C object dmnsn_object* dmnsn(); @@ -51,7 +51,7 @@ namespace Dimension // No-op Object(); // Shallow copy - Object(const Object& object); + Object(Object& object); // Wrap an existing object. explicit Object(dmnsn_object* object); diff --git a/libdimensionxx/dimensionxx/objects.hpp b/libdimensionxx/dimensionxx/objects.hpp index f9c20af..f86b2b3 100644 --- a/libdimensionxx/dimensionxx/objects.hpp +++ b/libdimensionxx/dimensionxx/objects.hpp @@ -33,11 +33,11 @@ namespace Dimension ~Sphere(); // Shallow-copy the sphere - Object* copy() const; + Object* copy(); private: // Copying prohibited, but used internally - Sphere(const Sphere& sphere); + Sphere(Sphere& sphere); Sphere& operator=(const Sphere&); }; @@ -49,11 +49,11 @@ namespace Dimension ~Cube(); // Shallow-copy the cube - Object* copy() const; + Object* copy(); private: // Copying prohibited, but used internally - Cube(const Cube& cube); + Cube(Cube& cube); Cube& operator=(const Cube&); }; } diff --git a/libdimensionxx/object.cpp b/libdimensionxx/object.cpp index 5023a6e..e5384db 100644 --- a/libdimensionxx/object.cpp +++ b/libdimensionxx/object.cpp @@ -82,7 +82,7 @@ namespace Dimension { } // Protected copy constructor - Object::Object(const Object& object) + Object::Object(Object& object) : m_object(object.m_object) { } diff --git a/libdimensionxx/objects.cpp b/libdimensionxx/objects.cpp index 6a13b35..2272586 100644 --- a/libdimensionxx/objects.cpp +++ b/libdimensionxx/objects.cpp @@ -41,13 +41,13 @@ namespace Dimension // Shallow copy a sphere Object* - Sphere::copy() const + Sphere::copy() { return new Sphere(*this); } // Protected copy constructor - Sphere::Sphere(const Sphere& sphere) + Sphere::Sphere(Sphere& sphere) : Object(sphere) { } @@ -70,13 +70,13 @@ namespace Dimension // Shallow copy a cube Object* - Cube::copy() const + Cube::copy() { return new Cube(*this); } // Protected copy constructor - Cube::Cube(const Cube& sphere) + Cube::Cube(Cube& sphere) : Object(sphere) { } } |