Replace typedef keywords by using

This commit is contained in:
Lynix 2018-03-20 20:59:04 +01:00
parent 69f079fcc8
commit ad82de2962
24 changed files with 72 additions and 71 deletions

View File

@ -15,6 +15,7 @@ Miscellaneous:
- Fix compilation with some MinGW distributions - Fix compilation with some MinGW distributions
- Add Lua unit tests - Add Lua unit tests
- NDEBUG is now defined in Release - NDEBUG is now defined in Release
- Replaced typedefs keywords with modern using keywords
Nazara Engine: Nazara Engine:
- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. - VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned.

View File

@ -22,8 +22,8 @@ namespace Nz
void MixToMono(T* input, T* output, UInt32 channelCount, UInt64 frameCount) void MixToMono(T* input, T* output, UInt32 channelCount, UInt64 frameCount)
{ {
// To avoid overflow, we use, as an accumulator, a type which is large enough: (u)int 64 bits for integers, double for floatings // To avoid overflow, we use, as an accumulator, a type which is large enough: (u)int 64 bits for integers, double for floatings
typedef typename std::conditional<std::is_unsigned<T>::value, UInt64, Int64>::type BiggestInt; using BiggestInt = typename std::conditional<std::is_unsigned<T>::value, UInt64, Int64>::type;
typedef typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type Biggest; using Biggest = typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type;
for (UInt64 i = 0; i < frameCount; ++i) for (UInt64 i = 0; i < frameCount; ++i)
{ {

View File

@ -195,10 +195,10 @@ namespace Nz
return reversed; return reversed;
} }
template<typename T> struct PointedType<T*> {typedef T type;}; template<typename T> struct PointedType<T*> { using type = T; };
template<typename T> struct PointedType<T* const> {typedef T type;}; template<typename T> struct PointedType<T* const> { using type = T; };
template<typename T> struct PointedType<T* volatile> {typedef T type;}; template<typename T> struct PointedType<T* volatile> { using type = T; };
template<typename T> struct PointedType<T* const volatile> {typedef T type;}; template<typename T> struct PointedType<T* const volatile> { using type = T; };
template<typename T> template<typename T>

View File

@ -81,8 +81,8 @@ namespace Nz
template<typename T> bool operator>=(const T& lhs, const ObjectHandle<T>& rhs); template<typename T> bool operator>=(const T& lhs, const ObjectHandle<T>& rhs);
template<typename T> bool operator>=(const ObjectHandle<T>& lhs, const T& rhs); template<typename T> bool operator>=(const ObjectHandle<T>& lhs, const T& rhs);
template<typename T> struct PointedType<ObjectHandle<T>> { typedef T type; }; template<typename T> struct PointedType<ObjectHandle<T>> { using type = T; };
template<typename T> struct PointedType<const ObjectHandle<T>> { typedef T type; }; template<typename T> struct PointedType<const ObjectHandle<T>> { using type = T; };
} }
namespace std namespace std

View File

@ -69,8 +69,8 @@ namespace Nz
template<typename T> bool operator>=(const ObjectRef<T>& lhs, const T& rhs); template<typename T> bool operator>=(const ObjectRef<T>& lhs, const T& rhs);
template<typename T> struct PointedType<ObjectRef<T>> { typedef T type; }; template<typename T> struct PointedType<ObjectRef<T>> { using type = T; };
template<typename T> struct PointedType<ObjectRef<T> const> { typedef T type; }; template<typename T> struct PointedType<ObjectRef<T> const> { using type = T; };
} }
#include <Nazara/Core/ObjectRef.inl> #include <Nazara/Core/ObjectRef.inl>

View File

@ -189,10 +189,10 @@ namespace Nz
//char* rend(); //char* rend();
//const char* rend() const; //const char* rend() const;
typedef const char& const_reference; using const_reference = const char&;
typedef char* iterator; using iterator = char*;
//typedef char* reverse_iterator; //using reverse_iterator = char*;
typedef char value_type; using value_type = char;
// Méthodes STD // Méthodes STD
char& operator[](std::size_t pos); char& operator[](std::size_t pos);

View File

@ -47,7 +47,7 @@ namespace Nz
std::vector<Matrix4f> instances; std::vector<Matrix4f> instances;
}; };
typedef std::map<MeshData, MeshInstanceEntry, ForwardRenderQueue::MeshDataComparator> MeshInstanceContainer; using MeshInstanceContainer = std::map<MeshData, MeshInstanceEntry, ForwardRenderQueue::MeshDataComparator>;
struct BatchedModelEntry struct BatchedModelEntry
{ {
@ -57,7 +57,7 @@ namespace Nz
bool enabled = false; bool enabled = false;
}; };
typedef std::map<const Material*, BatchedModelEntry, ForwardRenderQueue::MaterialComparator> MeshMaterialBatches; using MeshMaterialBatches = std::map<const Material*, BatchedModelEntry, ForwardRenderQueue::MaterialComparator>;
struct BatchedMaterialEntry struct BatchedMaterialEntry
{ {
@ -65,7 +65,7 @@ namespace Nz
MeshMaterialBatches materialMap; MeshMaterialBatches materialMap;
}; };
typedef std::map<const MaterialPipeline*, BatchedMaterialEntry, ForwardRenderQueue::MaterialPipelineComparator> MeshPipelineBatches; using MeshPipelineBatches = std::map<const MaterialPipeline*, BatchedMaterialEntry, ForwardRenderQueue::MaterialPipelineComparator>;
struct Layer struct Layer
{ {

View File

@ -69,8 +69,8 @@ namespace Nz
OrientedBox<T> obb; OrientedBox<T> obb;
}; };
typedef BoundingVolume<double> BoundingVolumed; using BoundingVolumed = BoundingVolume<double>;
typedef BoundingVolume<float> BoundingVolumef; using BoundingVolumef = BoundingVolume<float>;
template<typename T> bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume, TypeTag<BoundingVolume<T>>); template<typename T> bool Serialize(SerializationContext& context, const BoundingVolume<T>& boundingVolume, TypeTag<BoundingVolume<T>>);
template<typename T> bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume, TypeTag<BoundingVolume<T>>); template<typename T> bool Unserialize(SerializationContext& context, BoundingVolume<T>* boundingVolume, TypeTag<BoundingVolume<T>>);

View File

@ -93,12 +93,12 @@ namespace Nz
T x, y, z, width, height, depth; T x, y, z, width, height, depth;
}; };
typedef Box<double> Boxd; using Boxd = Box<double>;
typedef Box<float> Boxf; using Boxf = Box<float>;
typedef Box<int> Boxi; using Boxi = Box<int>;
typedef Box<unsigned int> Boxui; using Boxui = Box<unsigned int>;
typedef Box<Int32> Boxi32; using Boxi32 = Box<Int32>;
typedef Box<UInt32> Boxui32; using Boxui32 = Box<UInt32>;
template<typename T> bool Serialize(SerializationContext& context, const Box<T>& box, TypeTag<Box<T>>); template<typename T> bool Serialize(SerializationContext& context, const Box<T>& box, TypeTag<Box<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Box<T>* box, TypeTag<Box<T>>); template<typename T> bool Unserialize(SerializationContext& context, Box<T>* box, TypeTag<Box<T>>);

View File

@ -62,8 +62,8 @@ namespace Nz
T pitch, yaw, roll; T pitch, yaw, roll;
}; };
typedef EulerAngles<double> EulerAnglesd; using EulerAnglesd = EulerAngles<double>;
typedef EulerAngles<float> EulerAnglesf; using EulerAnglesf = EulerAngles<float>;
template<typename T> bool Serialize(SerializationContext& context, const EulerAngles<T>& eulerAngles, TypeTag<EulerAngles<T>>); template<typename T> bool Serialize(SerializationContext& context, const EulerAngles<T>& eulerAngles, TypeTag<EulerAngles<T>>);
template<typename T> bool Unserialize(SerializationContext& context, EulerAngles<T>* eulerAngles, TypeTag<EulerAngles<T>>); template<typename T> bool Unserialize(SerializationContext& context, EulerAngles<T>* eulerAngles, TypeTag<EulerAngles<T>>);

View File

@ -67,8 +67,8 @@ namespace Nz
Plane<T> m_planes[FrustumPlane_Max+1]; Plane<T> m_planes[FrustumPlane_Max+1];
}; };
typedef Frustum<double> Frustumd; using Frustumd = Frustum<double>;
typedef Frustum<float> Frustumf; using Frustumf = Frustum<float>;
} }
template<typename T> template<typename T>

View File

@ -138,8 +138,8 @@ namespace Nz
m41, m42, m43, m44; m41, m42, m43, m44;
}; };
typedef Matrix4<double> Matrix4d; using Matrix4d = Matrix4<double>;
typedef Matrix4<float> Matrix4f; using Matrix4f = Matrix4<float>;
template<typename T> bool Serialize(SerializationContext& context, const Matrix4<T>& matrix, TypeTag<Matrix4<T>>); template<typename T> bool Serialize(SerializationContext& context, const Matrix4<T>& matrix, TypeTag<Matrix4<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Matrix4<T>* matrix, TypeTag<Matrix4<T>>); template<typename T> bool Unserialize(SerializationContext& context, Matrix4<T>* matrix, TypeTag<Matrix4<T>>);

View File

@ -68,8 +68,8 @@ namespace Nz
Vector3<T> m_corners[BoxCorner_Max+1]; // Ne peuvent pas être modifiés directement Vector3<T> m_corners[BoxCorner_Max+1]; // Ne peuvent pas être modifiés directement
}; };
typedef OrientedBox<double> OrientedBoxd; using OrientedBoxd = OrientedBox<double>;
typedef OrientedBox<float> OrientedBoxf; using OrientedBoxf = OrientedBox<float>;
template<typename T> bool Serialize(SerializationContext& context, const OrientedBox<T>& obb, TypeTag<OrientedBox<T>>); template<typename T> bool Serialize(SerializationContext& context, const OrientedBox<T>& obb, TypeTag<OrientedBox<T>>);
template<typename T> bool Unserialize(SerializationContext& context, OrientedBox<T>* obb, TypeTag<OrientedBox<T>>); template<typename T> bool Unserialize(SerializationContext& context, OrientedBox<T>* obb, TypeTag<OrientedBox<T>>);

View File

@ -59,8 +59,8 @@ namespace Nz
T distance; T distance;
}; };
typedef Plane<double> Planed; using Planed = Plane<double>;
typedef Plane<float> Planef; using Planef = Plane<float>;
template<typename T> bool Serialize(SerializationContext& context, const Plane<T>& plane, TypeTag<Plane<T>>); template<typename T> bool Serialize(SerializationContext& context, const Plane<T>& plane, TypeTag<Plane<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Plane<T>* plane, TypeTag<Plane<T>>); template<typename T> bool Unserialize(SerializationContext& context, Plane<T>* plane, TypeTag<Plane<T>>);

View File

@ -88,8 +88,8 @@ namespace Nz
T w, x, y, z; T w, x, y, z;
}; };
typedef Quaternion<double> Quaterniond; using Quaterniond = Quaternion<double>;
typedef Quaternion<float> Quaternionf; using Quaternionf = Quaternion<float>;
template<typename T> bool Serialize(SerializationContext& context, const Quaternion<T>& quat, TypeTag<Quaternion<T>>); template<typename T> bool Serialize(SerializationContext& context, const Quaternion<T>& quat, TypeTag<Quaternion<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Quaternion<T>* quat, TypeTag<Quaternion<T>>); template<typename T> bool Unserialize(SerializationContext& context, Quaternion<T>* quat, TypeTag<Quaternion<T>>);

View File

@ -74,8 +74,8 @@ namespace Nz
Vector3<T> direction, origin; Vector3<T> direction, origin;
}; };
typedef Ray<double> Rayd; using Rayd = Ray<double>;
typedef Ray<float> Rayf; using Rayf = Ray<float>;
template<typename T> bool Serialize(SerializationContext& context, const Ray<T>& ray, TypeTag<Ray<T>>); template<typename T> bool Serialize(SerializationContext& context, const Ray<T>& ray, TypeTag<Ray<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Ray<T>* ray, TypeTag<Ray<T>>); template<typename T> bool Unserialize(SerializationContext& context, Ray<T>* ray, TypeTag<Ray<T>>);

View File

@ -87,12 +87,12 @@ namespace Nz
T x, y, width, height; T x, y, width, height;
}; };
typedef Rect<double> Rectd; using Rectd = Rect<double>;
typedef Rect<float> Rectf; using Rectf = Rect<float>;
typedef Rect<int> Recti; using Recti = Rect<int>;
typedef Rect<unsigned int> Rectui; using Rectui = Rect<unsigned int>;
typedef Rect<Int32> Recti32; using Recti32 = Rect<Int32>;
typedef Rect<UInt32> Rectui32; using Rectui32 = Rect<UInt32>;
template<typename T> bool Serialize(SerializationContext& context, const Rect<T>& rect, TypeTag<Rect<T>>); template<typename T> bool Serialize(SerializationContext& context, const Rect<T>& rect, TypeTag<Rect<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Rect<T>* rect, TypeTag<Rect<T>>); template<typename T> bool Unserialize(SerializationContext& context, Rect<T>* rect, TypeTag<Rect<T>>);

View File

@ -78,8 +78,8 @@ namespace Nz
T x, y, z, radius; T x, y, z, radius;
}; };
typedef Sphere<double> Sphered; using Sphered = Sphere<double>;
typedef Sphere<float> Spheref; using Spheref = Sphere<float>;
template<typename T> bool Serialize(SerializationContext& context, const Sphere<T>& sphere, TypeTag<Sphere<T>>); template<typename T> bool Serialize(SerializationContext& context, const Sphere<T>& sphere, TypeTag<Sphere<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Sphere<T>* sphere, TypeTag<Sphere<T>>); template<typename T> bool Unserialize(SerializationContext& context, Sphere<T>* sphere, TypeTag<Sphere<T>>);

View File

@ -103,8 +103,6 @@ namespace Nz
T x, y; T x, y;
}; };
template<typename T> bool Serialize(SerializationContext& context, const Vector2<T>& vector);
template<typename T> bool Unserialize(SerializationContext& context, Vector2<T>* vector);
using Vector2d = Vector2<double>; using Vector2d = Vector2<double>;
using Vector2f = Vector2<float>; using Vector2f = Vector2<float>;
using Vector2i = Vector2<int>; using Vector2i = Vector2<int>;
@ -112,6 +110,8 @@ namespace Nz
using Vector2i32 = Vector2<Int32>; using Vector2i32 = Vector2<Int32>;
using Vector2ui32 = Vector2<UInt32>; using Vector2ui32 = Vector2<UInt32>;
template<typename T> bool Serialize(SerializationContext& context, const Vector2<T>& vector, TypeTag<Vector2<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Vector2<T>* vector, TypeTag<Vector2<T>>);
} }
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector2<T>& vec); template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector2<T>& vec);

View File

@ -125,12 +125,12 @@ namespace Nz
T x, y, z; T x, y, z;
}; };
typedef Vector3<double> Vector3d; using Vector3d = Vector3<double>;
typedef Vector3<float> Vector3f; using Vector3f = Vector3<float>;
typedef Vector3<int> Vector3i; using Vector3i = Vector3<int>;
typedef Vector3<unsigned int> Vector3ui; using Vector3ui = Vector3<unsigned int>;
typedef Vector3<Int32> Vector3i32; using Vector3i32 = Vector3<Int32>;
typedef Vector3<UInt32> Vector3ui32; using Vector3ui32 = Vector3<UInt32>;
template<typename T> bool Serialize(SerializationContext& context, const Vector3<T>& vector, TypeTag<Vector3<T>>); template<typename T> bool Serialize(SerializationContext& context, const Vector3<T>& vector, TypeTag<Vector3<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Vector3<T>* vector, TypeTag<Vector3<T>>); template<typename T> bool Unserialize(SerializationContext& context, Vector3<T>* vector, TypeTag<Vector3<T>>);

View File

@ -101,12 +101,12 @@ namespace Nz
T x, y, z, w; T x, y, z, w;
}; };
typedef Vector4<double> Vector4d; using Vector4d = Vector4<double>;
typedef Vector4<float> Vector4f; using Vector4f = Vector4<float>;
typedef Vector4<int> Vector4i; using Vector4i = Vector4<int>;
typedef Vector4<unsigned int> Vector4ui; using Vector4ui = Vector4<unsigned int>;
typedef Vector4<Int32> Vector4i32; using Vector4i32 = Vector4<Int32>;
typedef Vector4<UInt32> Vector4ui32; using Vector4ui32 = Vector4<UInt32>;
template<typename T> bool Serialize(SerializationContext& context, const Vector4<T>& vector, TypeTag<Vector4<T>>); template<typename T> bool Serialize(SerializationContext& context, const Vector4<T>& vector, TypeTag<Vector4<T>>);
template<typename T> bool Unserialize(SerializationContext& context, Vector4<T>* vector, TypeTag<Vector4<T>>); template<typename T> bool Unserialize(SerializationContext& context, Vector4<T>* vector, TypeTag<Vector4<T>>);

View File

@ -16,7 +16,7 @@ namespace Nz
{ {
#if defined(NAZARA_PLATFORM_WINDOWS) #if defined(NAZARA_PLATFORM_WINDOWS)
// http://msdn.microsoft.com/en-us/library/aa383751(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/aa383751(v=vs.85).aspx
typedef void* WindowHandle; using WindowHandle = void*;
#elif defined(NAZARA_PLATFORM_X11) #elif defined(NAZARA_PLATFORM_X11)
// http://en.wikipedia.org/wiki/Xlib#Data_types // http://en.wikipedia.org/wiki/Xlib#Data_types
using WindowHandle = xcb_window_t; using WindowHandle = xcb_window_t;

View File

@ -166,17 +166,17 @@ static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
namespace Nz namespace Nz
{ {
typedef int8_t Int8; using Int8 = int8_t;
typedef uint8_t UInt8; using UInt8 = uint8_t;
typedef int16_t Int16; using Int16 = int16_t;
typedef uint16_t UInt16; using UInt16 = uint16_t;
typedef int32_t Int32; using Int32 = int32_t;
typedef uint32_t UInt32; using UInt32 = uint32_t;
typedef int64_t Int64; using Int64 = int64_t;
typedef uint64_t UInt64; using UInt64 = uint64_t;
} }
#endif // NAZARA_PREREQUISITES_HPP #endif // NAZARA_PREREQUISITES_HPP

View File

@ -28,7 +28,7 @@ namespace Nz
Vector3f bindPos; Vector3f bindPos;
}; };
typedef Vector3ui Triangle; using Triangle = Vector3ui;
struct Vertex struct Vertex
{ {