From ad82de29625483e39d157d5b496687a384c2b22a Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 20 Mar 2018 20:59:04 +0100 Subject: [PATCH] Replace typedef keywords by using --- ChangeLog.md | 1 + include/Nazara/Audio/Algorithm.inl | 4 ++-- include/Nazara/Core/Algorithm.inl | 8 ++++---- include/Nazara/Core/ObjectHandle.hpp | 4 ++-- include/Nazara/Core/ObjectRef.hpp | 4 ++-- include/Nazara/Core/String.hpp | 8 ++++---- include/Nazara/Graphics/DeferredRenderQueue.hpp | 6 +++--- include/Nazara/Math/BoundingVolume.hpp | 4 ++-- include/Nazara/Math/Box.hpp | 12 ++++++------ include/Nazara/Math/EulerAngles.hpp | 4 ++-- include/Nazara/Math/Frustum.hpp | 4 ++-- include/Nazara/Math/Matrix4.hpp | 4 ++-- include/Nazara/Math/OrientedBox.hpp | 4 ++-- include/Nazara/Math/Plane.hpp | 4 ++-- include/Nazara/Math/Quaternion.hpp | 4 ++-- include/Nazara/Math/Ray.hpp | 4 ++-- include/Nazara/Math/Rect.hpp | 12 ++++++------ include/Nazara/Math/Sphere.hpp | 4 ++-- include/Nazara/Math/Vector2.hpp | 4 ++-- include/Nazara/Math/Vector3.hpp | 12 ++++++------ include/Nazara/Math/Vector4.hpp | 12 ++++++------ include/Nazara/Platform/WindowHandle.hpp | 2 +- include/Nazara/Prerequisites.hpp | 16 ++++++++-------- include/Nazara/Utility/Formats/MD5MeshParser.hpp | 2 +- 24 files changed, 72 insertions(+), 71 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f4d1f40bb..93acf657a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -15,6 +15,7 @@ Miscellaneous: - Fix compilation with some MinGW distributions - Add Lua unit tests - NDEBUG is now defined in Release +- Replaced typedefs keywords with modern using keywords Nazara Engine: - VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. diff --git a/include/Nazara/Audio/Algorithm.inl b/include/Nazara/Audio/Algorithm.inl index 64f0b9f46..a2b5c5fe5 100644 --- a/include/Nazara/Audio/Algorithm.inl +++ b/include/Nazara/Audio/Algorithm.inl @@ -22,8 +22,8 @@ namespace Nz 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 - typedef typename std::conditional::value, UInt64, Int64>::type BiggestInt; - typedef typename std::conditional::value, BiggestInt, double>::type Biggest; + using BiggestInt = typename std::conditional::value, UInt64, Int64>::type; + using Biggest = typename std::conditional::value, BiggestInt, double>::type; for (UInt64 i = 0; i < frameCount; ++i) { diff --git a/include/Nazara/Core/Algorithm.inl b/include/Nazara/Core/Algorithm.inl index 0c549c44a..969c07bdd 100644 --- a/include/Nazara/Core/Algorithm.inl +++ b/include/Nazara/Core/Algorithm.inl @@ -195,10 +195,10 @@ namespace Nz return reversed; } - template struct PointedType {typedef T type;}; - template struct PointedType {typedef T type;}; - template struct PointedType {typedef T type;}; - template struct PointedType {typedef T type;}; + template struct PointedType { using type = T; }; + template struct PointedType { using type = T; }; + template struct PointedType { using type = T; }; + template struct PointedType { using type = T; }; template diff --git a/include/Nazara/Core/ObjectHandle.hpp b/include/Nazara/Core/ObjectHandle.hpp index 022344488..0527eb491 100644 --- a/include/Nazara/Core/ObjectHandle.hpp +++ b/include/Nazara/Core/ObjectHandle.hpp @@ -81,8 +81,8 @@ namespace Nz template bool operator>=(const T& lhs, const ObjectHandle& rhs); template bool operator>=(const ObjectHandle& lhs, const T& rhs); - template struct PointedType> { typedef T type; }; - template struct PointedType> { typedef T type; }; + template struct PointedType> { using type = T; }; + template struct PointedType> { using type = T; }; } namespace std diff --git a/include/Nazara/Core/ObjectRef.hpp b/include/Nazara/Core/ObjectRef.hpp index 379f56e02..c7959efc8 100644 --- a/include/Nazara/Core/ObjectRef.hpp +++ b/include/Nazara/Core/ObjectRef.hpp @@ -69,8 +69,8 @@ namespace Nz template bool operator>=(const ObjectRef& lhs, const T& rhs); - template struct PointedType> { typedef T type; }; - template struct PointedType const> { typedef T type; }; + template struct PointedType> { using type = T; }; + template struct PointedType const> { using type = T; }; } #include diff --git a/include/Nazara/Core/String.hpp b/include/Nazara/Core/String.hpp index 4aa11a81e..42dacc191 100644 --- a/include/Nazara/Core/String.hpp +++ b/include/Nazara/Core/String.hpp @@ -189,10 +189,10 @@ namespace Nz //char* rend(); //const char* rend() const; - typedef const char& const_reference; - typedef char* iterator; - //typedef char* reverse_iterator; - typedef char value_type; + using const_reference = const char&; + using iterator = char*; + //using reverse_iterator = char*; + using value_type = char; // Méthodes STD char& operator[](std::size_t pos); diff --git a/include/Nazara/Graphics/DeferredRenderQueue.hpp b/include/Nazara/Graphics/DeferredRenderQueue.hpp index 0cb390ace..db43a9980 100644 --- a/include/Nazara/Graphics/DeferredRenderQueue.hpp +++ b/include/Nazara/Graphics/DeferredRenderQueue.hpp @@ -47,7 +47,7 @@ namespace Nz std::vector instances; }; - typedef std::map MeshInstanceContainer; + using MeshInstanceContainer = std::map; struct BatchedModelEntry { @@ -57,7 +57,7 @@ namespace Nz bool enabled = false; }; - typedef std::map MeshMaterialBatches; + using MeshMaterialBatches = std::map; struct BatchedMaterialEntry { @@ -65,7 +65,7 @@ namespace Nz MeshMaterialBatches materialMap; }; - typedef std::map MeshPipelineBatches; + using MeshPipelineBatches = std::map; struct Layer { diff --git a/include/Nazara/Math/BoundingVolume.hpp b/include/Nazara/Math/BoundingVolume.hpp index 1faea4eb7..235259b2e 100644 --- a/include/Nazara/Math/BoundingVolume.hpp +++ b/include/Nazara/Math/BoundingVolume.hpp @@ -69,8 +69,8 @@ namespace Nz OrientedBox obb; }; - typedef BoundingVolume BoundingVolumed; - typedef BoundingVolume BoundingVolumef; + using BoundingVolumed = BoundingVolume; + using BoundingVolumef = BoundingVolume; template bool Serialize(SerializationContext& context, const BoundingVolume& boundingVolume, TypeTag>); template bool Unserialize(SerializationContext& context, BoundingVolume* boundingVolume, TypeTag>); diff --git a/include/Nazara/Math/Box.hpp b/include/Nazara/Math/Box.hpp index df7216eed..555e10130 100644 --- a/include/Nazara/Math/Box.hpp +++ b/include/Nazara/Math/Box.hpp @@ -93,12 +93,12 @@ namespace Nz T x, y, z, width, height, depth; }; - typedef Box Boxd; - typedef Box Boxf; - typedef Box Boxi; - typedef Box Boxui; - typedef Box Boxi32; - typedef Box Boxui32; + using Boxd = Box; + using Boxf = Box; + using Boxi = Box; + using Boxui = Box; + using Boxi32 = Box; + using Boxui32 = Box; template bool Serialize(SerializationContext& context, const Box& box, TypeTag>); template bool Unserialize(SerializationContext& context, Box* box, TypeTag>); diff --git a/include/Nazara/Math/EulerAngles.hpp b/include/Nazara/Math/EulerAngles.hpp index f7984dd7a..126ea399e 100644 --- a/include/Nazara/Math/EulerAngles.hpp +++ b/include/Nazara/Math/EulerAngles.hpp @@ -62,8 +62,8 @@ namespace Nz T pitch, yaw, roll; }; - typedef EulerAngles EulerAnglesd; - typedef EulerAngles EulerAnglesf; + using EulerAnglesd = EulerAngles; + using EulerAnglesf = EulerAngles; template bool Serialize(SerializationContext& context, const EulerAngles& eulerAngles, TypeTag>); template bool Unserialize(SerializationContext& context, EulerAngles* eulerAngles, TypeTag>); diff --git a/include/Nazara/Math/Frustum.hpp b/include/Nazara/Math/Frustum.hpp index 497cf9f97..a35c03e03 100644 --- a/include/Nazara/Math/Frustum.hpp +++ b/include/Nazara/Math/Frustum.hpp @@ -67,8 +67,8 @@ namespace Nz Plane m_planes[FrustumPlane_Max+1]; }; - typedef Frustum Frustumd; - typedef Frustum Frustumf; + using Frustumd = Frustum; + using Frustumf = Frustum; } template diff --git a/include/Nazara/Math/Matrix4.hpp b/include/Nazara/Math/Matrix4.hpp index 70a72c593..cb8667036 100644 --- a/include/Nazara/Math/Matrix4.hpp +++ b/include/Nazara/Math/Matrix4.hpp @@ -138,8 +138,8 @@ namespace Nz m41, m42, m43, m44; }; - typedef Matrix4 Matrix4d; - typedef Matrix4 Matrix4f; + using Matrix4d = Matrix4; + using Matrix4f = Matrix4; template bool Serialize(SerializationContext& context, const Matrix4& matrix, TypeTag>); template bool Unserialize(SerializationContext& context, Matrix4* matrix, TypeTag>); diff --git a/include/Nazara/Math/OrientedBox.hpp b/include/Nazara/Math/OrientedBox.hpp index 3e0b36922..ab136a530 100644 --- a/include/Nazara/Math/OrientedBox.hpp +++ b/include/Nazara/Math/OrientedBox.hpp @@ -68,8 +68,8 @@ namespace Nz Vector3 m_corners[BoxCorner_Max+1]; // Ne peuvent pas être modifiés directement }; - typedef OrientedBox OrientedBoxd; - typedef OrientedBox OrientedBoxf; + using OrientedBoxd = OrientedBox; + using OrientedBoxf = OrientedBox; template bool Serialize(SerializationContext& context, const OrientedBox& obb, TypeTag>); template bool Unserialize(SerializationContext& context, OrientedBox* obb, TypeTag>); diff --git a/include/Nazara/Math/Plane.hpp b/include/Nazara/Math/Plane.hpp index 8db8d9d82..d5384b3fe 100644 --- a/include/Nazara/Math/Plane.hpp +++ b/include/Nazara/Math/Plane.hpp @@ -59,8 +59,8 @@ namespace Nz T distance; }; - typedef Plane Planed; - typedef Plane Planef; + using Planed = Plane; + using Planef = Plane; template bool Serialize(SerializationContext& context, const Plane& plane, TypeTag>); template bool Unserialize(SerializationContext& context, Plane* plane, TypeTag>); diff --git a/include/Nazara/Math/Quaternion.hpp b/include/Nazara/Math/Quaternion.hpp index 93308aa5c..17c9a8757 100644 --- a/include/Nazara/Math/Quaternion.hpp +++ b/include/Nazara/Math/Quaternion.hpp @@ -88,8 +88,8 @@ namespace Nz T w, x, y, z; }; - typedef Quaternion Quaterniond; - typedef Quaternion Quaternionf; + using Quaterniond = Quaternion; + using Quaternionf = Quaternion; template bool Serialize(SerializationContext& context, const Quaternion& quat, TypeTag>); template bool Unserialize(SerializationContext& context, Quaternion* quat, TypeTag>); diff --git a/include/Nazara/Math/Ray.hpp b/include/Nazara/Math/Ray.hpp index 90f1a290b..677bf50b9 100644 --- a/include/Nazara/Math/Ray.hpp +++ b/include/Nazara/Math/Ray.hpp @@ -74,8 +74,8 @@ namespace Nz Vector3 direction, origin; }; - typedef Ray Rayd; - typedef Ray Rayf; + using Rayd = Ray; + using Rayf = Ray; template bool Serialize(SerializationContext& context, const Ray& ray, TypeTag>); template bool Unserialize(SerializationContext& context, Ray* ray, TypeTag>); diff --git a/include/Nazara/Math/Rect.hpp b/include/Nazara/Math/Rect.hpp index fa61abe05..db7ee15f0 100644 --- a/include/Nazara/Math/Rect.hpp +++ b/include/Nazara/Math/Rect.hpp @@ -87,12 +87,12 @@ namespace Nz T x, y, width, height; }; - typedef Rect Rectd; - typedef Rect Rectf; - typedef Rect Recti; - typedef Rect Rectui; - typedef Rect Recti32; - typedef Rect Rectui32; + using Rectd = Rect; + using Rectf = Rect; + using Recti = Rect; + using Rectui = Rect; + using Recti32 = Rect; + using Rectui32 = Rect; template bool Serialize(SerializationContext& context, const Rect& rect, TypeTag>); template bool Unserialize(SerializationContext& context, Rect* rect, TypeTag>); diff --git a/include/Nazara/Math/Sphere.hpp b/include/Nazara/Math/Sphere.hpp index 938da93be..0c9880287 100644 --- a/include/Nazara/Math/Sphere.hpp +++ b/include/Nazara/Math/Sphere.hpp @@ -78,8 +78,8 @@ namespace Nz T x, y, z, radius; }; - typedef Sphere Sphered; - typedef Sphere Spheref; + using Sphered = Sphere; + using Spheref = Sphere; template bool Serialize(SerializationContext& context, const Sphere& sphere, TypeTag>); template bool Unserialize(SerializationContext& context, Sphere* sphere, TypeTag>); diff --git a/include/Nazara/Math/Vector2.hpp b/include/Nazara/Math/Vector2.hpp index b3ef521de..6a7f925f6 100644 --- a/include/Nazara/Math/Vector2.hpp +++ b/include/Nazara/Math/Vector2.hpp @@ -103,8 +103,6 @@ namespace Nz T x, y; }; - template bool Serialize(SerializationContext& context, const Vector2& vector); - template bool Unserialize(SerializationContext& context, Vector2* vector); using Vector2d = Vector2; using Vector2f = Vector2; using Vector2i = Vector2; @@ -112,6 +110,8 @@ namespace Nz using Vector2i32 = Vector2; using Vector2ui32 = Vector2; + template bool Serialize(SerializationContext& context, const Vector2& vector, TypeTag>); + template bool Unserialize(SerializationContext& context, Vector2* vector, TypeTag>); } template std::ostream& operator<<(std::ostream& out, const Nz::Vector2& vec); diff --git a/include/Nazara/Math/Vector3.hpp b/include/Nazara/Math/Vector3.hpp index 6f535b9c9..7aed07d6a 100644 --- a/include/Nazara/Math/Vector3.hpp +++ b/include/Nazara/Math/Vector3.hpp @@ -125,12 +125,12 @@ namespace Nz T x, y, z; }; - typedef Vector3 Vector3d; - typedef Vector3 Vector3f; - typedef Vector3 Vector3i; - typedef Vector3 Vector3ui; - typedef Vector3 Vector3i32; - typedef Vector3 Vector3ui32; + using Vector3d = Vector3; + using Vector3f = Vector3; + using Vector3i = Vector3; + using Vector3ui = Vector3; + using Vector3i32 = Vector3; + using Vector3ui32 = Vector3; template bool Serialize(SerializationContext& context, const Vector3& vector, TypeTag>); template bool Unserialize(SerializationContext& context, Vector3* vector, TypeTag>); diff --git a/include/Nazara/Math/Vector4.hpp b/include/Nazara/Math/Vector4.hpp index 5c419fc15..f1a799fb3 100644 --- a/include/Nazara/Math/Vector4.hpp +++ b/include/Nazara/Math/Vector4.hpp @@ -101,12 +101,12 @@ namespace Nz T x, y, z, w; }; - typedef Vector4 Vector4d; - typedef Vector4 Vector4f; - typedef Vector4 Vector4i; - typedef Vector4 Vector4ui; - typedef Vector4 Vector4i32; - typedef Vector4 Vector4ui32; + using Vector4d = Vector4; + using Vector4f = Vector4; + using Vector4i = Vector4; + using Vector4ui = Vector4; + using Vector4i32 = Vector4; + using Vector4ui32 = Vector4; template bool Serialize(SerializationContext& context, const Vector4& vector, TypeTag>); template bool Unserialize(SerializationContext& context, Vector4* vector, TypeTag>); diff --git a/include/Nazara/Platform/WindowHandle.hpp b/include/Nazara/Platform/WindowHandle.hpp index b0916498c..88274f3f9 100644 --- a/include/Nazara/Platform/WindowHandle.hpp +++ b/include/Nazara/Platform/WindowHandle.hpp @@ -16,7 +16,7 @@ namespace Nz { #if defined(NAZARA_PLATFORM_WINDOWS) // http://msdn.microsoft.com/en-us/library/aa383751(v=vs.85).aspx - typedef void* WindowHandle; + using WindowHandle = void*; #elif defined(NAZARA_PLATFORM_X11) // http://en.wikipedia.org/wiki/Xlib#Data_types using WindowHandle = xcb_window_t; diff --git a/include/Nazara/Prerequisites.hpp b/include/Nazara/Prerequisites.hpp index 765d14b52..ddb2796fc 100644 --- a/include/Nazara/Prerequisites.hpp +++ b/include/Nazara/Prerequisites.hpp @@ -166,17 +166,17 @@ static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size"); namespace Nz { - typedef int8_t Int8; - typedef uint8_t UInt8; + using Int8 = int8_t; + using UInt8 = uint8_t; - typedef int16_t Int16; - typedef uint16_t UInt16; + using Int16 = int16_t; + using UInt16 = uint16_t; - typedef int32_t Int32; - typedef uint32_t UInt32; + using Int32 = int32_t; + using UInt32 = uint32_t; - typedef int64_t Int64; - typedef uint64_t UInt64; + using Int64 = int64_t; + using UInt64 = uint64_t; } #endif // NAZARA_PREREQUISITES_HPP diff --git a/include/Nazara/Utility/Formats/MD5MeshParser.hpp b/include/Nazara/Utility/Formats/MD5MeshParser.hpp index 8f3165fc8..f5cdb8637 100644 --- a/include/Nazara/Utility/Formats/MD5MeshParser.hpp +++ b/include/Nazara/Utility/Formats/MD5MeshParser.hpp @@ -28,7 +28,7 @@ namespace Nz Vector3f bindPos; }; - typedef Vector3ui Triangle; + using Triangle = Vector3ui; struct Vertex {