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
- 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.

View File

@ -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<std::is_unsigned<T>::value, UInt64, Int64>::type BiggestInt;
typedef typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type Biggest;
using BiggestInt = typename std::conditional<std::is_unsigned<T>::value, UInt64, Int64>::type;
using Biggest = typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type;
for (UInt64 i = 0; i < frameCount; ++i)
{

View File

@ -195,10 +195,10 @@ namespace Nz
return reversed;
}
template<typename T> struct PointedType<T*> {typedef T type;};
template<typename T> struct PointedType<T* const> {typedef T type;};
template<typename T> struct PointedType<T* volatile> {typedef T type;};
template<typename T> struct PointedType<T* const volatile> {typedef T type;};
template<typename T> struct PointedType<T*> { using type = T; };
template<typename T> struct PointedType<T* const> { using type = T; };
template<typename T> struct PointedType<T* volatile> { using type = T; };
template<typename T> struct PointedType<T* const volatile> { using type = 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 ObjectHandle<T>& lhs, const T& rhs);
template<typename T> struct PointedType<ObjectHandle<T>> { typedef T type; };
template<typename T> struct PointedType<const ObjectHandle<T>> { typedef T type; };
template<typename T> struct PointedType<ObjectHandle<T>> { using type = T; };
template<typename T> struct PointedType<const ObjectHandle<T>> { using type = T; };
}
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> struct PointedType<ObjectRef<T>> { typedef T type; };
template<typename T> struct PointedType<ObjectRef<T> const> { typedef T type; };
template<typename T> struct PointedType<ObjectRef<T>> { using type = T; };
template<typename T> struct PointedType<ObjectRef<T> const> { using type = T; };
}
#include <Nazara/Core/ObjectRef.inl>

View File

@ -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);

View File

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

View File

@ -69,8 +69,8 @@ namespace Nz
OrientedBox<T> obb;
};
typedef BoundingVolume<double> BoundingVolumed;
typedef BoundingVolume<float> BoundingVolumef;
using BoundingVolumed = BoundingVolume<double>;
using BoundingVolumef = BoundingVolume<float>;
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>>);

View File

@ -93,12 +93,12 @@ namespace Nz
T x, y, z, width, height, depth;
};
typedef Box<double> Boxd;
typedef Box<float> Boxf;
typedef Box<int> Boxi;
typedef Box<unsigned int> Boxui;
typedef Box<Int32> Boxi32;
typedef Box<UInt32> Boxui32;
using Boxd = Box<double>;
using Boxf = Box<float>;
using Boxi = Box<int>;
using Boxui = Box<unsigned int>;
using Boxi32 = Box<Int32>;
using Boxui32 = Box<UInt32>;
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>>);

View File

@ -62,8 +62,8 @@ namespace Nz
T pitch, yaw, roll;
};
typedef EulerAngles<double> EulerAnglesd;
typedef EulerAngles<float> EulerAnglesf;
using EulerAnglesd = EulerAngles<double>;
using EulerAnglesf = EulerAngles<float>;
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>>);

View File

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

View File

@ -138,8 +138,8 @@ namespace Nz
m41, m42, m43, m44;
};
typedef Matrix4<double> Matrix4d;
typedef Matrix4<float> Matrix4f;
using Matrix4d = Matrix4<double>;
using Matrix4f = Matrix4<float>;
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>>);

View File

@ -68,8 +68,8 @@ namespace Nz
Vector3<T> m_corners[BoxCorner_Max+1]; // Ne peuvent pas être modifiés directement
};
typedef OrientedBox<double> OrientedBoxd;
typedef OrientedBox<float> OrientedBoxf;
using OrientedBoxd = OrientedBox<double>;
using OrientedBoxf = OrientedBox<float>;
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>>);

View File

@ -59,8 +59,8 @@ namespace Nz
T distance;
};
typedef Plane<double> Planed;
typedef Plane<float> Planef;
using Planed = Plane<double>;
using Planef = Plane<float>;
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>>);

View File

@ -88,8 +88,8 @@ namespace Nz
T w, x, y, z;
};
typedef Quaternion<double> Quaterniond;
typedef Quaternion<float> Quaternionf;
using Quaterniond = Quaternion<double>;
using Quaternionf = Quaternion<float>;
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>>);

View File

@ -74,8 +74,8 @@ namespace Nz
Vector3<T> direction, origin;
};
typedef Ray<double> Rayd;
typedef Ray<float> Rayf;
using Rayd = Ray<double>;
using Rayf = Ray<float>;
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>>);

View File

@ -87,12 +87,12 @@ namespace Nz
T x, y, width, height;
};
typedef Rect<double> Rectd;
typedef Rect<float> Rectf;
typedef Rect<int> Recti;
typedef Rect<unsigned int> Rectui;
typedef Rect<Int32> Recti32;
typedef Rect<UInt32> Rectui32;
using Rectd = Rect<double>;
using Rectf = Rect<float>;
using Recti = Rect<int>;
using Rectui = Rect<unsigned int>;
using Recti32 = Rect<Int32>;
using Rectui32 = Rect<UInt32>;
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>>);

View File

@ -78,8 +78,8 @@ namespace Nz
T x, y, z, radius;
};
typedef Sphere<double> Sphered;
typedef Sphere<float> Spheref;
using Sphered = Sphere<double>;
using Spheref = Sphere<float>;
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>>);

View File

@ -103,8 +103,6 @@ namespace Nz
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 Vector2f = Vector2<float>;
using Vector2i = Vector2<int>;
@ -112,6 +110,8 @@ namespace Nz
using Vector2i32 = Vector2<Int32>;
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);

View File

@ -125,12 +125,12 @@ namespace Nz
T x, y, z;
};
typedef Vector3<double> Vector3d;
typedef Vector3<float> Vector3f;
typedef Vector3<int> Vector3i;
typedef Vector3<unsigned int> Vector3ui;
typedef Vector3<Int32> Vector3i32;
typedef Vector3<UInt32> Vector3ui32;
using Vector3d = Vector3<double>;
using Vector3f = Vector3<float>;
using Vector3i = Vector3<int>;
using Vector3ui = Vector3<unsigned int>;
using Vector3i32 = Vector3<Int32>;
using Vector3ui32 = Vector3<UInt32>;
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>>);

View File

@ -101,12 +101,12 @@ namespace Nz
T x, y, z, w;
};
typedef Vector4<double> Vector4d;
typedef Vector4<float> Vector4f;
typedef Vector4<int> Vector4i;
typedef Vector4<unsigned int> Vector4ui;
typedef Vector4<Int32> Vector4i32;
typedef Vector4<UInt32> Vector4ui32;
using Vector4d = Vector4<double>;
using Vector4f = Vector4<float>;
using Vector4i = Vector4<int>;
using Vector4ui = Vector4<unsigned int>;
using Vector4i32 = Vector4<Int32>;
using Vector4ui32 = Vector4<UInt32>;
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>>);

View File

@ -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;

View File

@ -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

View File

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