summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:23 +0000
committerTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:23 +0000
commitc3619e541564d5133a3ccdaeb79588d37d46a3db (patch)
treeeede3c86f47098080fe206b84dbb6b59aa0e6a21
parent00997fa54c64b53618255b1e292d3db4d18b86af (diff)
downloaddimension-c3619e541564d5133a3ccdaeb79588d37d46a3db.tar.xz
Make copy() a const method.
-rw-r--r--libdimensionxx/camera.cpp2
-rw-r--r--libdimensionxx/cameras.cpp4
-rw-r--r--libdimensionxx/dimensionxx/camera.hpp4
-rw-r--r--libdimensionxx/dimensionxx/cameras.hpp4
-rw-r--r--libdimensionxx/dimensionxx/object.hpp4
-rw-r--r--libdimensionxx/dimensionxx/objects.hpp8
-rw-r--r--libdimensionxx/object.cpp2
-rw-r--r--libdimensionxx/objects.cpp10
8 files changed, 19 insertions, 19 deletions
diff --git a/libdimensionxx/camera.cpp b/libdimensionxx/camera.cpp
index 5786055..3536e54 100644
--- a/libdimensionxx/camera.cpp
+++ b/libdimensionxx/camera.cpp
@@ -65,7 +65,7 @@ namespace Dimension
{ }
// Protected copy constructor
- Camera::Camera(Camera& camera)
+ Camera::Camera(const Camera& camera)
: m_camera(camera.m_camera)
{ }
diff --git a/libdimensionxx/cameras.cpp b/libdimensionxx/cameras.cpp
index 5d84c4f..f9f8302 100644
--- a/libdimensionxx/cameras.cpp
+++ b/libdimensionxx/cameras.cpp
@@ -47,13 +47,13 @@ namespace Dimension
// Shallow-copy this camera
Camera*
- Perspective_Camera::copy()
+ Perspective_Camera::copy() const
{
return new Perspective_Camera(*this);
}
// Private copy-constructor, for copy() implementation
- Perspective_Camera::Perspective_Camera(Perspective_Camera& camera)
+ Perspective_Camera::Perspective_Camera(const Perspective_Camera& camera)
: Camera(camera)
{ }
}
diff --git a/libdimensionxx/dimensionxx/camera.hpp b/libdimensionxx/dimensionxx/camera.hpp
index fa13a7e..0f61435 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() = 0;
+ virtual Camera* copy() const = 0;
// Access the wrapped C camera.
dmnsn_camera* dmnsn();
@@ -46,7 +46,7 @@ namespace Dimension
// No-op
Camera();
// Shallow-copy
- Camera(Camera& camera);
+ Camera(const Camera& camera);
// Wrap an existing camera
explicit Camera(dmnsn_camera* camera);
diff --git a/libdimensionxx/dimensionxx/cameras.hpp b/libdimensionxx/dimensionxx/cameras.hpp
index 364ea4c..ea08535 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();
+ Camera* copy() const;
private:
// Copying prohibited, but used internally
- Perspective_Camera(Perspective_Camera& camera);
+ Perspective_Camera(const Perspective_Camera& camera);
Perspective_Camera& operator=(const Perspective_Camera&);
};
}
diff --git a/libdimensionxx/dimensionxx/object.hpp b/libdimensionxx/dimensionxx/object.hpp
index 6505162..c661fa8 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() = 0;
+ virtual Object* copy() const = 0;
// Access the wrapped C object
dmnsn_object* dmnsn();
@@ -51,7 +51,7 @@ namespace Dimension
// No-op
Object();
// Shallow copy
- Object(Object& object);
+ Object(const Object& object);
// Wrap an existing object.
explicit Object(dmnsn_object* object);
diff --git a/libdimensionxx/dimensionxx/objects.hpp b/libdimensionxx/dimensionxx/objects.hpp
index 15c072b..6f7cce0 100644
--- a/libdimensionxx/dimensionxx/objects.hpp
+++ b/libdimensionxx/dimensionxx/objects.hpp
@@ -33,11 +33,11 @@ namespace Dimension
// ~Sphere();
// Shallow-copy the sphere
- Object* copy();
+ Object* copy() const;
private:
// Copying prohibited, but used internally
- Sphere(Sphere& sphere);
+ Sphere(const Sphere& sphere);
Sphere& operator=(const Sphere&);
};
@@ -49,11 +49,11 @@ namespace Dimension
// ~Cube();
// Shallow-copy the cube
- Object* copy();
+ Object* copy() const;
private:
// Copying prohibited, but used internally
- Cube(Cube& cube);
+ Cube(const Cube& cube);
Cube& operator=(const Cube&);
};
}
diff --git a/libdimensionxx/object.cpp b/libdimensionxx/object.cpp
index 9c28e22..407935a 100644
--- a/libdimensionxx/object.cpp
+++ b/libdimensionxx/object.cpp
@@ -86,7 +86,7 @@ namespace Dimension
{ }
// Protected copy constructor
- Object::Object(Object& object)
+ Object::Object(const Object& object)
: m_object(object.m_object)
{ }
diff --git a/libdimensionxx/objects.cpp b/libdimensionxx/objects.cpp
index 7bedd92..fffa3c4 100644
--- a/libdimensionxx/objects.cpp
+++ b/libdimensionxx/objects.cpp
@@ -33,13 +33,13 @@ namespace Dimension
// Shallow copy a sphere
Object*
- Sphere::copy()
+ Sphere::copy() const
{
return new Sphere(*this);
}
// Protected copy constructor
- Sphere::Sphere(Sphere& sphere)
+ Sphere::Sphere(const Sphere& sphere)
: Object(sphere)
{ }
@@ -54,13 +54,13 @@ namespace Dimension
// Shallow copy a cube
Object*
- Cube::copy()
+ Cube::copy() const
{
return new Cube(*this);
}
// Protected copy constructor
- Cube::Cube(Cube& sphere)
- : Object(sphere)
+ Cube::Cube(const Cube& cube)
+ : Object(cube)
{ }
}