Browse Source

Physics: fixed debug output operator for AbstractShape::Type.

It could be found by ADL only from Physics namespace itself, which is
not too useful.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
de72421a7c
  1. 8
      src/Physics/AbstractShape.cpp
  2. 9
      src/Physics/AbstractShape.h

8
src/Physics/AbstractShape.cpp

@ -31,7 +31,9 @@ template class AbstractShape<2>;
template class AbstractShape<3>;
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug operator<<(Debug debug, AbstractShape2D::Type value) {
namespace Implementation {
Debug operator<<(Debug debug, ShapeDimensionTraits<2>::Type value) {
switch(value) {
#define _val(value) case AbstractShape2D::Type::value: return debug << "AbstractShape2D::Type::" #value;
_val(Point)
@ -48,7 +50,7 @@ Debug operator<<(Debug debug, AbstractShape2D::Type value) {
return debug << "AbstractShape2D::Type::(unknown)";
}
Debug operator<<(Debug debug, AbstractShape3D::Type value) {
Debug operator<<(Debug debug, ShapeDimensionTraits<3>::Type value) {
switch(value) {
#define _val(value) case AbstractShape3D::Type::value: return debug << "AbstractShape3D::Type::" #value;
_val(Point)
@ -65,6 +67,8 @@ Debug operator<<(Debug debug, AbstractShape3D::Type value) {
return debug << "AbstractShape2D::Type::(unknown)";
}
}
#endif
}}

9
src/Physics/AbstractShape.h

@ -56,6 +56,9 @@ namespace Implementation {
Plane
};
};
Debug MAGNUM_PHYSICS_EXPORT operator<<(Debug debug, ShapeDimensionTraits<2>::Type value);
Debug MAGNUM_PHYSICS_EXPORT operator<<(Debug debug, ShapeDimensionTraits<3>::Type value);
}
#endif
@ -118,17 +121,15 @@ template<std::uint8_t dimensions> class MAGNUM_PHYSICS_EXPORT AbstractShape {
virtual bool collides(const AbstractShape<dimensions>* other) const;
};
/** @brief Abstract two-dimensional shape */
typedef AbstractShape<2> AbstractShape2D;
/** @brief Abstract three-dimensional shape */
typedef AbstractShape<3> AbstractShape3D;
#ifdef DOXYGEN_GENERATING_OUTPUT
/** @debugoperator{Magnum::Physics::AbstractShape} */
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug MAGNUM_PHYSICS_EXPORT operator<<(Debug debug, AbstractShape2D::Type value);
Debug MAGNUM_PHYSICS_EXPORT operator<<(Debug debug, AbstractShape3D::Type value);
#else
template<std::uint8_t dimensions> Debug operator<<(Debug debug, typename AbstractShape<dimensions>::Type value);
#endif

Loading…
Cancel
Save