Browse Source

Adds missing const qualifiers for some of the math operators.

Chris Culy 14 years ago
parent
commit
efccd147d9

+ 4 - 4
gameplay/src/Matrix.h

@@ -835,7 +835,7 @@ public:
      * @param m The matrix to add.
      * @return The matrix sum.
      */
-    inline Matrix operator+(const Matrix& m);
+    inline Matrix operator+(const Matrix& m) const;
     
     /**
      * Adds the given matrix to this matrix.
@@ -853,7 +853,7 @@ public:
      * @param m The matrix to add.
      * @return The matrix sum.
      */
-    inline Matrix operator-(const Matrix& m);
+    inline Matrix operator-(const Matrix& m) const;
 
     /**
      * Subtracts the given matrix from this matrix.
@@ -870,7 +870,7 @@ public:
      * 
      * @return The negation of this matrix.
      */
-    inline Matrix operator-();
+    inline Matrix operator-() const;
 
     /**
      * Calculates the matrix product of this matrix with the given matrix.
@@ -880,7 +880,7 @@ public:
      * @param m The matrix to multiply by.
      * @return The matrix product.
      */
-    inline Matrix operator*(const Matrix& m);
+    inline Matrix operator*(const Matrix& m) const;
 
     /**
      * Right-multiplies this matrix by the given matrix.

+ 4 - 4
gameplay/src/Matrix.inl

@@ -7,7 +7,7 @@
 namespace gameplay
 {
 
-inline Matrix Matrix::operator+(const Matrix& m)
+inline Matrix Matrix::operator+(const Matrix& m) const
 {
     Matrix result(*this);
     result.add(m);
@@ -20,7 +20,7 @@ inline Matrix& Matrix::operator+=(const Matrix& m)
     return *this;
 }
 
-inline Matrix Matrix::operator-(const Matrix& m)
+inline Matrix Matrix::operator-(const Matrix& m) const
 {
     Matrix result(*this);
     result.subtract(m);
@@ -33,14 +33,14 @@ inline Matrix& Matrix::operator-=(const Matrix& m)
     return *this;
 }
 
-inline Matrix Matrix::operator-()
+inline Matrix Matrix::operator-() const
 {
     Matrix m(*this);
     m.negate();
     return m;
 }
 
-inline Matrix Matrix::operator*(const Matrix& m)
+inline Matrix Matrix::operator*(const Matrix& m) const
 {
     Matrix result(*this);
     result.multiply(m);

+ 1 - 1
gameplay/src/Quaternion.h

@@ -342,7 +342,7 @@ public:
      * @param q The quaternion to multiply.
      * @return The quaternion product.
      */
-    inline Quaternion operator*(const Quaternion& q);
+    inline Quaternion operator*(const Quaternion& q) const;
 
     /**
      * Multiplies this quaternion with the given quaternion.

+ 1 - 1
gameplay/src/Quaternion.inl

@@ -7,7 +7,7 @@
 namespace gameplay
 {
 
-inline Quaternion Quaternion::operator*(const Quaternion& q)
+inline Quaternion Quaternion::operator*(const Quaternion& q) const
 {
     Quaternion result(*this);
     result.multiply(q);

+ 4 - 4
gameplay/src/Vector2.h

@@ -327,7 +327,7 @@ public:
      * @param v The vector to add.
      * @return The vector sum.
      */
-    inline Vector2 operator+(const Vector2& v);
+    inline Vector2 operator+(const Vector2& v) const;
 
     /**
      * Adds the given vector to this vector.
@@ -345,7 +345,7 @@ public:
      * @param v The vector to add.
      * @return The vector sum.
      */
-    inline Vector2 operator-(const Vector2& v);
+    inline Vector2 operator-(const Vector2& v) const;
 
     /**
      * Subtracts the given vector from this vector.
@@ -362,7 +362,7 @@ public:
      * 
      * @return The negation of this vector.
      */
-    inline Vector2 operator-();
+    inline Vector2 operator-() const;
 
     /**
      * Calculates the scalar product of this vector with the given value.
@@ -372,7 +372,7 @@ public:
      * @param x The value to scale by.
      * @return The scaled vector.
      */
-    inline Vector2 operator*(float x);
+    inline Vector2 operator*(float x) const;
 
     /**
      * Scales this vector by the given value.

+ 4 - 4
gameplay/src/Vector2.inl

@@ -7,7 +7,7 @@
 namespace gameplay
 {
 
-inline Vector2 Vector2::operator+(const Vector2& v)
+inline Vector2 Vector2::operator+(const Vector2& v) const
 {
     Vector2 result(*this);
     result.add(v);
@@ -20,7 +20,7 @@ inline Vector2& Vector2::operator+=(const Vector2& v)
     return *this;
 }
 
-inline Vector2 Vector2::operator-(const Vector2& v)
+inline Vector2 Vector2::operator-(const Vector2& v) const
 {
     Vector2 result(*this);
     result.subtract(v);
@@ -33,14 +33,14 @@ inline Vector2& Vector2::operator-=(const Vector2& v)
     return *this;
 }
 
-inline Vector2 Vector2::operator-()
+inline Vector2 Vector2::operator-() const
 {
     Vector2 result(*this);
     result.negate();
     return result;
 }
 
-inline Vector2 Vector2::operator*(float x)
+inline Vector2 Vector2::operator*(float x) const
 {
     Vector2 result(*this);
     result.scale(x);

+ 4 - 4
gameplay/src/Vector3.h

@@ -357,7 +357,7 @@ public:
      * @param v The vector to add.
      * @return The vector sum.
      */
-    inline Vector3 operator+(const Vector3& v);
+    inline Vector3 operator+(const Vector3& v) const;
 
     /**
      * Adds the given vector to this vector.
@@ -375,7 +375,7 @@ public:
      * @param v The vector to add.
      * @return The vector sum.
      */
-    inline Vector3 operator-(const Vector3& v);
+    inline Vector3 operator-(const Vector3& v) const;
 
     /**
      * Subtracts the given vector from this vector.
@@ -392,7 +392,7 @@ public:
      * 
      * @return The negation of this vector.
      */
-    inline Vector3 operator-();
+    inline Vector3 operator-() const;
 
     /**
      * Calculates the scalar product of this vector with the given value.
@@ -402,7 +402,7 @@ public:
      * @param x The value to scale by.
      * @return The scaled vector.
      */
-    inline Vector3 operator*(float x);
+    inline Vector3 operator*(float x) const;
 
     /**
      * Scales this vector by the given value.

+ 4 - 4
gameplay/src/Vector3.inl

@@ -8,7 +8,7 @@
 namespace gameplay
 {
 
-inline Vector3 Vector3::operator+(const Vector3& v)
+inline Vector3 Vector3::operator+(const Vector3& v) const
 {
     Vector3 result(*this);
     result.add(v);
@@ -21,7 +21,7 @@ inline Vector3& Vector3::operator+=(const Vector3& v)
     return *this;
 }
 
-inline Vector3 Vector3::operator-(const Vector3& v)
+inline Vector3 Vector3::operator-(const Vector3& v) const
 {
     Vector3 result(*this);
     result.subtract(v);
@@ -34,14 +34,14 @@ inline Vector3& Vector3::operator-=(const Vector3& v)
     return *this;
 }
 
-inline Vector3 Vector3::operator-()
+inline Vector3 Vector3::operator-() const
 {
     Vector3 result(*this);
     result.negate();
     return result;
 }
 
-inline Vector3 Vector3::operator*(float x)
+inline Vector3 Vector3::operator*(float x) const
 {
     Vector3 result(*this);
     result.scale(x);

+ 4 - 4
gameplay/src/Vector4.h

@@ -352,7 +352,7 @@ public:
      * @param v The vector to add.
      * @return The vector sum.
      */
-    inline Vector4 operator+(const Vector4& v);
+    inline Vector4 operator+(const Vector4& v) const;
 
     /**
      * Adds the given vector to this vector.
@@ -370,7 +370,7 @@ public:
      * @param v The vector to add.
      * @return The vector sum.
      */
-    inline Vector4 operator-(const Vector4& v);
+    inline Vector4 operator-(const Vector4& v) const;
 
     /**
      * Subtracts the given vector from this vector.
@@ -387,7 +387,7 @@ public:
      * 
      * @return The negation of this vector.
      */
-    inline Vector4 operator-();
+    inline Vector4 operator-() const;
 
     /**
      * Calculates the scalar product of this vector with the given value.
@@ -397,7 +397,7 @@ public:
      * @param x The value to scale by.
      * @return The scaled vector.
      */
-    inline Vector4 operator*(float x);
+    inline Vector4 operator*(float x) const;
 
     /**
      * Scales this vector by the given value.

+ 4 - 4
gameplay/src/Vector4.inl

@@ -8,7 +8,7 @@
 namespace gameplay
 {
 
-inline Vector4 Vector4::operator+(const Vector4& v)
+inline Vector4 Vector4::operator+(const Vector4& v) const
 {
     Vector4 result(*this);
     result.add(v);
@@ -21,7 +21,7 @@ inline Vector4& Vector4::operator+=(const Vector4& v)
     return *this;
 }
 
-inline Vector4 Vector4::operator-(const Vector4& v)
+inline Vector4 Vector4::operator-(const Vector4& v) const
 {
     Vector4 result(*this);
     result.subtract(v);
@@ -34,14 +34,14 @@ inline Vector4& Vector4::operator-=(const Vector4& v)
     return *this;
 }
 
-inline Vector4 Vector4::operator-()
+inline Vector4 Vector4::operator-() const
 {
     Vector4 result(*this);
     result.negate();
     return result;
 }
 
-inline Vector4 Vector4::operator*(float x)
+inline Vector4 Vector4::operator*(float x) const
 {
     Vector4 result(*this);
     result.scale(x);