Cleanup pass

This commit is contained in:
Lynix
2017-04-22 15:08:05 +02:00
parent ec310b9577
commit 06038a4d81
25 changed files with 124 additions and 206 deletions

View File

@@ -74,8 +74,8 @@ namespace Nz
Box& Transform(const Matrix4<T>& matrix, bool applyTranslation = true);
Box& Translate(const Vector3<T>& translation);
T& operator[](unsigned int i);
T operator[](unsigned int i) const;
T& operator[](std::size_t i);
T operator[](std::size_t i) const;
Box operator*(T scalar) const;
Box operator*(const Vector3<T>& vec) const;

View File

@@ -735,24 +735,15 @@ namespace Nz
* \brief Returns the ith element of the box
* \return A reference to the ith element of the box
*
* \remark Access to index greather than 6 is undefined behavior
* \remark Produce a NazaraError if you try to acces to index greather than 6 with NAZARA_MATH_SAFE defined
* \remark Access to index greater than 6 is undefined behavior
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
*/
template<typename T>
T& Box<T>::operator[](unsigned int i)
T& Box<T>::operator[](std::size_t i)
{
#if NAZARA_MATH_SAFE
if (i >= 6)
{
StringStream ss;
ss << "Index out of range: (" << i << " >= 6)";
NazaraError(ss);
throw std::domain_error(ss.ToString());
}
#endif
NazaraAssert(i < 6, "Index out of range");
return *(&x+i);
}
@@ -761,24 +752,15 @@ namespace Nz
* \brief Returns the ith element of the box
* \return A value to the ith element of the box
*
* \remark Access to index greather than 6 is undefined behavior
* \remark Produce a NazaraError if you try to acces to index greather than 6 with NAZARA_MATH_SAFE defined
* \remark Access to index greater than 6 is undefined behavior
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
*/
template<typename T>
T Box<T>::operator[](unsigned int i) const
T Box<T>::operator[](std::size_t i) const
{
#if NAZARA_MATH_SAFE
if (i >= 6)
{
StringStream ss;
ss << "Index out of range: (" << i << " >= 6)";
NazaraError(ss);
throw std::domain_error(ss.ToString());
}
#endif
NazaraAssert(i < 6, "Index out of range");
return *(&x+i);
}

View File

@@ -64,8 +64,8 @@ namespace Nz
Rect& Translate(const Vector2<T>& translation);
T& operator[](unsigned int i);
T operator[](unsigned int i) const;
T& operator[](std::size_t i);
T operator[](std::size_t i) const;
Rect operator*(T scalar) const;
Rect operator*(const Vector2<T>& vec) const;

View File

@@ -578,23 +578,14 @@ namespace Nz
* \return A reference to the ith element of the rectangle
*
* \remark Access to index greather than 4 is undefined behavior
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
*/
template<typename T>
T& Rect<T>::operator[](unsigned int i)
T& Rect<T>::operator[](std::size_t i)
{
#if NAZARA_MATH_SAFE
if (i >= 4)
{
StringStream ss;
ss << "Index out of range: (" << i << " >= 4)";
NazaraError(ss);
throw std::domain_error(ss.ToString());
}
#endif
NazaraAssert(i < 4, "Index out of range");
return *(&x+i);
}
@@ -603,24 +594,15 @@ namespace Nz
* \brief Returns the ith element of the rectangle
* \return A value to the ith element of the rectangle
*
* \remark Access to index greather than 4 is undefined behavior
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
* \remark Access to index greater than 4 is undefined behavior
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
*/
template<typename T>
T Rect<T>::operator[](unsigned int i) const
T Rect<T>::operator[](std::size_t i) const
{
#if NAZARA_MATH_SAFE
if (i >= 4)
{
StringStream ss;
ss << "Index out of range: (" << i << " >= 4)";
NazaraError(ss);
throw std::domain_error(ss.ToString());
}
#endif
NazaraAssert(i < 4, "Index out of range");
return *(&x+i);
}

View File

@@ -60,8 +60,8 @@ namespace Nz
String ToString() const;
T& operator[](unsigned int i);
T operator[](unsigned int i) const;
T& operator[](std::size_t i);
T operator[](std::size_t i) const;
Sphere operator*(T scalar) const;
Sphere& operator=(const Sphere& other) = default;

View File

@@ -466,24 +466,15 @@ namespace Nz
* \brief Returns the ith element of the sphere
* \return A reference to the ith element of the sphere
*
* \remark Access to index greather than 4 is undefined behavior
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
* \remark Access to index greater than 4 is undefined behavior
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
*/
template<typename T>
T& Sphere<T>::operator[](unsigned int i)
T& Sphere<T>::operator[](std::size_t i)
{
#if NAZARA_MATH_SAFE
if (i >= 4)
{
StringStream ss;
ss << "Index out of range: (" << i << " >= 4)";
NazaraError(ss);
throw std::domain_error(ss.ToString());
}
#endif
NazaraAssert(i < 4, "Index out of range");
return *(&x+i);
}
@@ -492,24 +483,15 @@ namespace Nz
* \brief Returns the ith element of the sphere
* \return A value to the ith element of the sphere
*
* \remark Access to index greather than 4 is undefined behavior
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
* \remark Access to index greater than 4 is undefined behavior
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
*/
template<typename T>
T Sphere<T>::operator[](unsigned int i) const
T Sphere<T>::operator[](std::size_t i) const
{
#if NAZARA_MATH_SAFE
if (i >= 4)
{
StringStream ss;
ss << "Index out of range: (" << i << " >= 4)";
NazaraError(ss);
throw std::domain_error(ss.ToString());
}
#endif
NazaraAssert(i < 4, "Index out of range");
return *(&x+i);
}