diff --git a/Doxyfile b/Doxyfile index a2f3df876..b758d6dfb 100644 --- a/Doxyfile +++ b/Doxyfile @@ -195,6 +195,7 @@ TAB_SIZE = 8 # You can put \n's in the value part of an alias to insert newlines. ALIASES = \ + "debugoperator{1}=@relates \1\n@brief Debug output operator" \ "todoc=@xrefitem todox \"Documentation todo\" \"Documentation-related todo list\"" \ "requires_gl30=@xrefitem RequiresGL30 \"Requires OpenGL 3.0\" \"Functionality requiring OpenGL 3.0\"" \ "requires_gl31=@xrefitem RequiresGL31 \"Requires OpenGL 3.1\" \"Functionality requiring OpenGL 3.1\"" \ diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 3ab2c2b97..24dee3c7d 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -260,6 +260,22 @@ template class Matrix { T _data[size*size]; }; +/** @debugoperator{Matrix} */ +template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Matrix& value) { + debug << "Matrix("; + debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, false); + for(size_t row = 0; row != size; ++row) { + if(row != 0) debug << ",\n "; + for(size_t col = 0; col != size; ++col) { + if(col != 0) debug << ", "; + debug << value[col][row]; + } + } + debug << ')'; + debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, true); + return debug; +} + #ifndef DOXYGEN_GENERATING_OUTPUT #define MAGNUM_MATRIX_SUBCLASS_IMPLEMENTATION(Type, VectorType, size) \ inline constexpr static Type& from(T* data) { \ @@ -330,21 +346,6 @@ template class MatrixDeterminant<1, T> { }; } - -template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Matrix& value) { - debug << "Matrix("; - debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, false); - for(size_t row = 0; row != size; ++row) { - if(row != 0) debug << ",\n "; - for(size_t col = 0; col != size; ++col) { - if(col != 0) debug << ", "; - debug << value[col][row]; - } - } - debug << ')'; - debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, true); - return debug; -} #endif }} diff --git a/src/Math/Matrix3.h b/src/Math/Matrix3.h index eede7cce6..667ffc3e4 100644 --- a/src/Math/Matrix3.h +++ b/src/Math/Matrix3.h @@ -50,11 +50,10 @@ template class Matrix3: public Matrix<3, T> { MAGNUM_MATRIX_SUBCLASS_IMPLEMENTATION(Matrix3, Vector3, 3) }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @debugoperator{Matrix3} */ template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Matrix3& value) { return debug << static_cast&>(value); } -#endif }} diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index 8fb94c644..87aba6270 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -137,11 +137,10 @@ template class Matrix4: public Matrix<4, T> { MAGNUM_MATRIX_SUBCLASS_IMPLEMENTATION(Matrix4, Vector4, 4) }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @debugoperator{Matrix4} */ template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Matrix4& value) { return debug << static_cast&>(value); } -#endif }} diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 1a62a56f3..d2321292c 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -266,6 +266,19 @@ template class Vector { T _data[size]; }; +/** @debugoperator{Vector} */ +template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Vector& value) { + debug << "Vector("; + debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, false); + for(size_t i = 0; i != size; ++i) { + if(i != 0) debug << ", "; + debug << value[i]; + } + debug << ')'; + debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, true); + return debug; +} + #ifndef DOXYGEN_GENERATING_OUTPUT #define MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(Type, size) \ inline constexpr static Type& from(T* data) { \ @@ -312,18 +325,6 @@ template class Vector { \ inline Type operator-() const { return Vector::operator-(); } \ inline Type normalized() const { return Vector::normalized(); } - -template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Vector& value) { - debug << "Vector("; - debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, false); - for(size_t i = 0; i != size; ++i) { - if(i != 0) debug << ", "; - debug << value[i]; - } - debug << ')'; - debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, true); - return debug; -} #endif }} diff --git a/src/Math/Vector2.h b/src/Math/Vector2.h index 95844297f..5920261c4 100644 --- a/src/Math/Vector2.h +++ b/src/Math/Vector2.h @@ -48,11 +48,10 @@ template class Vector2: public Vector<2, T> { MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(Vector2, 2) }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @debugoperator{Vector2} */ template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Vector2& value) { return debug << static_cast&>(value); } -#endif }} diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index 5653ca6de..f9e56a2e7 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -95,11 +95,10 @@ template class Vector3: public Vector<3, T> { MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(Vector3, 3) }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @debugoperator{Vector3} */ template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Vector3& value) { return debug << static_cast&>(value); } -#endif }} diff --git a/src/Math/Vector4.h b/src/Math/Vector4.h index 2661f8344..a447bfac4 100644 --- a/src/Math/Vector4.h +++ b/src/Math/Vector4.h @@ -98,11 +98,10 @@ template class Vector4: public Vector<4, T> { MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(Vector4, 4) }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @debugoperator{Vector4} */ template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Magnum::Math::Vector4& value) { return debug << static_cast&>(value); } -#endif }}