Use alias declarations instead of 'typedef'

This commit is contained in:
Vittorio Romeo 2021-12-08 17:00:44 +00:00
parent f03a415121
commit 9a0cc4b7dc
41 changed files with 143 additions and 143 deletions

View File

@ -84,7 +84,7 @@ function(set_file_warnings)
${CLANG_AND_GCC_WARNINGS} ${CLANG_AND_GCC_WARNINGS}
${NON_ANDROID_GCC_WARNINGS} ${NON_ANDROID_GCC_WARNINGS}
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted -Wlogical-op # warn about logical operations being used where bitwise were probably wanted
# -Wuseless-cast # warn if you perform a cast to the same type (disabled because it is not portable as some typedefs might vary between platforms) # -Wuseless-cast # warn if you perform a cast to the same type (disabled because it is not portable as some type aliases might vary between platforms)
) )
# Don't enable -Wduplicated-branches for GCC < 8.1 since it will lead to false positives # Don't enable -Wduplicated-branches for GCC < 8.1 since it will lead to false positives

View File

@ -18,7 +18,7 @@ namespace
sf::Text value; sf::Text value;
}; };
typedef std::unordered_map<std::string, JoystickObject> Texts; using Texts = std::unordered_map<std::string, JoystickObject>;
Texts texts; Texts texts;
std::ostringstream sstr; std::ostringstream sstr;
float threshold = 0.1f; float threshold = 0.1f;

View File

@ -20,8 +20,8 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
namespace namespace
{ {
typedef float Vec3[3]; using Vec3 = float[3];
typedef float Matrix[4][4]; using Matrix = float[4][4];
// Multiply 2 matrices // Multiply 2 matrices
void matrixMultiply(Matrix& result, const Matrix& left, const Matrix& right) void matrixMultiply(Matrix& result, const Matrix& left, const Matrix& right)

View File

@ -84,7 +84,7 @@ public:
}; };
// Define the relevant Span types // Define the relevant Span types
typedef Span<Time> TimeSpan; using TimeSpan = Span<Time>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -267,7 +267,7 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::unordered_set<Sound*> SoundList; //!< Set of unique sound instances using SoundList = std::unordered_set<Sound *>; //!< Set of unique sound instances
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data

View File

@ -148,14 +148,14 @@ private:
bool (*check)(InputStream&); bool (*check)(InputStream&);
SoundFileReader* (*create)(); SoundFileReader* (*create)();
}; };
typedef std::vector<ReaderFactory> ReaderFactoryArray; using ReaderFactoryArray = std::vector<ReaderFactory>;
struct WriterFactory struct WriterFactory
{ {
bool (*check)(const std::string&); bool (*check)(const std::string&);
SoundFileWriter* (*create)(); SoundFileWriter* (*create)();
}; };
typedef std::vector<WriterFactory> WriterFactoryArray; using WriterFactoryArray = std::vector<WriterFactory>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Static member data // Static member data

View File

@ -178,24 +178,24 @@ namespace sf
// we can use them without doing any kind of check // we can use them without doing any kind of check
// 8 bits integer types // 8 bits integer types
typedef signed char Int8; using Int8 = signed char;
typedef unsigned char Uint8; using Uint8 = unsigned char;
// 16 bits integer types // 16 bits integer types
typedef signed short Int16; using Int16 = short;
typedef unsigned short Uint16; using Uint16 = unsigned short;
// 32 bits integer types // 32 bits integer types
typedef signed int Int32; using Int32 = int;
typedef unsigned int Uint32; using Uint32 = unsigned int;
// 64 bits integer types // 64 bits integer types
#if defined(_MSC_VER) #if defined(_MSC_VER)
typedef signed __int64 Int64; using Int64 = signed __int64;
typedef unsigned __int64 Uint64; using Uint64 = unsigned __int64;
#else #else
typedef signed long long Int64; using Int64 = long long;
typedef unsigned long long Uint64; using Uint64 = unsigned long long;
#endif #endif
} // namespace sf } // namespace sf

View File

@ -327,7 +327,7 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::unordered_map<Uint64, Glyph> GlyphTable; //!< Table mapping a codepoint to its glyph using GlyphTable = std::unordered_map<Uint64, Glyph>; //!< Table mapping a codepoint to its glyph
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Structure defining a page of glyphs /// \brief Structure defining a page of glyphs
@ -387,7 +387,7 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::unordered_map<unsigned int, Page> PageTable; //!< Table mapping a character size to its page (texture) using PageTable = std::unordered_map<unsigned int, Page>; //!< Table mapping a character size to its page (texture)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data

View File

@ -61,37 +61,37 @@ namespace Glsl
/// \brief 2D float vector (\p vec2 in GLSL) /// \brief 2D float vector (\p vec2 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef Vector2<float> Vec2; using Vec2 = Vector2<float>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 2D int vector (\p ivec2 in GLSL) /// \brief 2D int vector (\p ivec2 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef Vector2<int> Ivec2; using Ivec2 = Vector2<int>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 2D bool vector (\p bvec2 in GLSL) /// \brief 2D bool vector (\p bvec2 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef Vector2<bool> Bvec2; using Bvec2 = Vector2<bool>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 3D float vector (\p vec3 in GLSL) /// \brief 3D float vector (\p vec3 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef Vector3<float> Vec3; using Vec3 = Vector3<float>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 3D int vector (\p ivec3 in GLSL) /// \brief 3D int vector (\p ivec3 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef Vector3<int> Ivec3; using Ivec3 = Vector3<int>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 3D bool vector (\p bvec3 in GLSL) /// \brief 3D bool vector (\p bvec3 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef Vector3<bool> Bvec3; using Bvec3 = Vector3<bool>;
#ifdef SFML_DOXYGEN #ifdef SFML_DOXYGEN
@ -107,7 +107,7 @@ namespace Glsl
/// sf::Glsl::Vec4 color = sf::Color::Cyan; /// sf::Glsl::Vec4 color = sf::Color::Cyan;
/// \endcode /// \endcode
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef implementation-defined Vec4; using Vec4 = implementation-defined;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 4D int vector (\p ivec4 in GLSL) /// \brief 4D int vector (\p ivec4 in GLSL)
@ -121,13 +121,13 @@ namespace Glsl
/// sf::Glsl::Ivec4 color = sf::Color::Cyan; /// sf::Glsl::Ivec4 color = sf::Color::Cyan;
/// \endcode /// \endcode
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef implementation-defined Ivec4; using Ivec4 = implementation-defined;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 4D bool vector (\p bvec4 in GLSL) /// \brief 4D bool vector (\p bvec4 in GLSL)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef implementation-defined Bvec4; using Bvec4 = implementation-defined;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 3x3 float matrix (\p mat3 in GLSL) /// \brief 3x3 float matrix (\p mat3 in GLSL)
@ -152,7 +152,7 @@ namespace Glsl
/// sf::Glsl::Mat3 matrix = transform; /// sf::Glsl::Mat3 matrix = transform;
/// \endcode /// \endcode
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef implementation-defined Mat3; using Mat3 = implementation-defined;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief 4x4 float matrix (\p mat4 in GLSL) /// \brief 4x4 float matrix (\p mat4 in GLSL)
@ -178,15 +178,15 @@ namespace Glsl
/// sf::Glsl::Mat4 matrix = transform; /// sf::Glsl::Mat4 matrix = transform;
/// \endcode /// \endcode
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef implementation-defined Mat4; using Mat4 = implementation-defined;
#else // SFML_DOXYGEN #else // SFML_DOXYGEN
typedef priv::Vector4<float> Vec4; using Vec4 = priv::Vector4<float>;
typedef priv::Vector4<int> Ivec4; using Ivec4 = priv::Vector4<int>;
typedef priv::Vector4<bool> Bvec4; using Bvec4 = priv::Vector4<bool>;
typedef priv::Matrix<3, 3> Mat3; using Mat3 = priv::Matrix<3, 3>;
typedef priv::Matrix<4, 4> Mat4; using Mat4 = priv::Matrix<4, 4>;
#endif // SFML_DOXYGEN #endif // SFML_DOXYGEN
@ -205,7 +205,7 @@ namespace Glsl
/// These types are exclusively used by the sf::Shader class. /// These types are exclusively used by the sf::Shader class.
/// ///
/// Types that already exist in SFML, such as \ref sf::Vector2<T> /// Types that already exist in SFML, such as \ref sf::Vector2<T>
/// and \ref sf::Vector3<T>, are reused as typedefs, so you can use /// and \ref sf::Vector3<T>, are reused as type aliases, so you can use
/// the types in this namespace as well as the original ones. /// the types in this namespace as well as the original ones.
/// Others are newly defined, such as Glsl::Vec4 or Glsl::Mat3. Their /// Others are newly defined, such as Glsl::Vec4 or Glsl::Mat3. Their
/// actual type is an implementation detail and should not be used. /// actual type is an implementation detail and should not be used.

View File

@ -212,9 +212,9 @@ bool operator !=(const Rect<T>& left, const Rect<T>& right);
#include <SFML/Graphics/Rect.inl> #include <SFML/Graphics/Rect.inl>
// Create typedefs for the most common types // Create type aliases for the most common types
typedef Rect<int> IntRect; using IntRect = Rect<int>;
typedef Rect<float> FloatRect; using FloatRect = Rect<float>;
} // namespace sf } // namespace sf
@ -245,7 +245,7 @@ typedef Rect<float> FloatRect;
/// don't intersect. /// don't intersect.
/// ///
/// sf::Rect is a template and may be used with any numeric type, but /// sf::Rect is a template and may be used with any numeric type, but
/// for simplicity the instantiations used by SFML are typedef'd: /// for simplicity type aliases for the instantiations used by SFML are given:
/// \li sf::Rect<int> is sf::IntRect /// \li sf::Rect<int> is sf::IntRect
/// \li sf::Rect<float> is sf::FloatRect /// \li sf::Rect<float> is sf::FloatRect
/// ///

View File

@ -739,8 +739,8 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::unordered_map<int, const Texture*> TextureTable; using TextureTable = std::unordered_map<int, const Texture *>;
typedef std::unordered_map<std::string, int> UniformTable; using UniformTable = std::unordered_map<std::string, int>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data

View File

@ -173,7 +173,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::map<std::string, std::string> FieldTable; // Use an ordered map for predictable payloads using FieldTable = std::map<std::string, std::string>; // Use an ordered map for predictable payloads
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
@ -333,7 +333,7 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::map<std::string, std::string> FieldTable; // Use an ordered map for predictable payloads using FieldTable = std::map<std::string, std::string>; // Use an ordered map for predictable payloads
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data

View File

@ -47,7 +47,7 @@ class UdpSocket;
class SFML_NETWORK_API Packet class SFML_NETWORK_API Packet
{ {
// A bool-like type that cannot be converted to integer or pointer types // A bool-like type that cannot be converted to integer or pointer types
typedef bool (Packet::*BoolType)(std::size_t); using BoolType = bool (Packet::*)(std::size_t);
public: public:

View File

@ -43,11 +43,11 @@ namespace sf
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
typedef UINT_PTR SocketHandle; using SocketHandle = UINT_PTR;
#else #else
typedef int SocketHandle; using SocketHandle = int;
#endif #endif

View File

@ -49,8 +49,8 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef std::basic_string<Uint32>::iterator Iterator; //!< Iterator type using Iterator = std::basic_string<Uint32>::iterator; //!< Iterator type
typedef std::basic_string<Uint32>::const_iterator ConstIterator; //!< Read-only iterator type using ConstIterator = std::basic_string<Uint32>::const_iterator; //!< Read-only iterator type
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Static member data // Static member data

View File

@ -730,10 +730,10 @@ public:
#include <SFML/System/Utf.inl> #include <SFML/System/Utf.inl>
// Make typedefs to get rid of the template syntax // Make type aliases to get rid of the template syntax
typedef Utf<8> Utf8; using Utf8 = Utf<8>;
typedef Utf<16> Utf16; using Utf16 = Utf<16>;
typedef Utf<32> Utf32; using Utf32 = Utf<32>;
} // namespace sf } // namespace sf
@ -756,8 +756,8 @@ typedef Utf<32> Utf32;
/// can use any character / string type for a given encoding. /// can use any character / string type for a given encoding.
/// ///
/// It has 3 specializations: /// It has 3 specializations:
/// \li sf::Utf<8> (typedef'd to sf::Utf8) /// \li sf::Utf<8> (with sf::Utf8 type alias)
/// \li sf::Utf<16> (typedef'd to sf::Utf16) /// \li sf::Utf<16> (with sf::Utf16 type alias)
/// \li sf::Utf<32> (typedef'd to sf::Utf32) /// \li sf::Utf<32> (with sf::Utf32 type alias)
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -250,9 +250,9 @@ bool operator !=(const Vector2<T>& left, const Vector2<T>& right);
#include <SFML/System/Vector2.inl> #include <SFML/System/Vector2.inl>
// Define the most common types // Define the most common types
typedef Vector2<int> Vector2i; using Vector2i = Vector2<int>;
typedef Vector2<unsigned int> Vector2u; using Vector2u = Vector2<unsigned int>;
typedef Vector2<float> Vector2f; using Vector2f = Vector2<float>;
} // namespace sf } // namespace sf
@ -274,7 +274,7 @@ typedef Vector2<float> Vector2f;
/// and comparisons (==, !=), for example int or float. /// and comparisons (==, !=), for example int or float.
/// ///
/// You generally don't have to care about the templated form (sf::Vector2<T>), /// You generally don't have to care about the templated form (sf::Vector2<T>),
/// the most common specializations have special typedefs: /// the most common specializations have special type aliases:
/// \li sf::Vector2<float> is sf::Vector2f /// \li sf::Vector2<float> is sf::Vector2f
/// \li sf::Vector2<int> is sf::Vector2i /// \li sf::Vector2<int> is sf::Vector2i
/// \li sf::Vector2<unsigned int> is sf::Vector2u /// \li sf::Vector2<unsigned int> is sf::Vector2u

View File

@ -252,8 +252,8 @@ bool operator !=(const Vector3<T>& left, const Vector3<T>& right);
#include <SFML/System/Vector3.inl> #include <SFML/System/Vector3.inl>
// Define the most common types // Define the most common types
typedef Vector3<int> Vector3i; using Vector3i = Vector3<int>;
typedef Vector3<float> Vector3f; using Vector3f = Vector3<float>;
} // namespace sf } // namespace sf
@ -275,7 +275,7 @@ typedef Vector3<float> Vector3f;
/// and comparisons (==, !=), for example int or float. /// and comparisons (==, !=), for example int or float.
/// ///
/// You generally don't have to care about the templated form (sf::Vector3<T>), /// You generally don't have to care about the templated form (sf::Vector3<T>),
/// the most common specializations have special typedefs: /// the most common specializations have special type aliases:
/// \li sf::Vector3<float> is sf::Vector3f /// \li sf::Vector3<float> is sf::Vector3f
/// \li sf::Vector3<int> is sf::Vector3i /// \li sf::Vector3<int> is sf::Vector3i
/// ///

View File

@ -41,7 +41,7 @@ namespace priv
class GlContext; class GlContext;
} }
typedef void (*GlFunctionPointer)(); using GlFunctionPointer = void (*)();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Class holding a valid drawing context /// \brief Class holding a valid drawing context

View File

@ -37,7 +37,7 @@ namespace sf
class Context; class Context;
typedef void(*ContextDestroyCallback)(void*); using ContextDestroyCallback = void (*)(void *);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Base class for classes that require an OpenGL context /// \brief Base class for classes that require an OpenGL context

View File

@ -34,15 +34,15 @@
#include <stdint.h> #include <stdint.h>
typedef struct VkInstance_T* VkInstance; using VkInstance = struct VkInstance_T*;
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
typedef struct VkSurfaceKHR_T* VkSurfaceKHR; using VkSurfaceKHR = struct VkSurfaceKHR_T*;
#else #else
typedef uint64_t VkSurfaceKHR; using VkSurfaceKHR = uint64_t;
#endif #endif
@ -52,7 +52,7 @@ struct VkAllocationCallbacks;
namespace sf namespace sf
{ {
typedef void (*VulkanFunctionPointer)(); using VulkanFunctionPointer = void (*)();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Vulkan helper functions /// \brief Vulkan helper functions
@ -109,6 +109,6 @@ public:
/// \class sf::Vulkan /// \class sf::Vulkan
/// \ingroup window /// \ingroup window
/// ///
/// ///
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -384,7 +384,7 @@ public:
/// \brief Get the OS-specific handle of the window /// \brief Get the OS-specific handle of the window
/// ///
/// The type of the returned handle is sf::WindowHandle, /// The type of the returned handle is sf::WindowHandle,
/// which is a typedef to the handle type defined by the OS. /// which is a type alias to the handle type defined by the OS.
/// You shouldn't need to use this function, unless you have /// You shouldn't need to use this function, unless you have
/// very specific stuff to implement that SFML doesn't support, /// very specific stuff to implement that SFML doesn't support,
/// or implement a temporary workaround until a bug is fixed. /// or implement a temporary workaround until a bug is fixed.

View File

@ -30,7 +30,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Config.hpp> #include <SFML/Config.hpp>
// Windows' HWND is a typedef on struct HWND__* // Windows' HWND is a type alias for struct HWND__*
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
struct HWND__; struct HWND__;
#endif #endif
@ -40,32 +40,32 @@ namespace sf
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
// Window handle is HWND (HWND__*) on Windows // Window handle is HWND (HWND__*) on Windows
typedef HWND__* WindowHandle; using WindowHandle = HWND__ *;
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD) #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD)
// Window handle is Window (unsigned long) on Unix - X11 // Window handle is Window (unsigned long) on Unix - X11
typedef unsigned long WindowHandle; using WindowHandle = unsigned long;
#elif defined(SFML_SYSTEM_MACOS) #elif defined(SFML_SYSTEM_MACOS)
// Window handle is NSWindow or NSView (void*) on Mac OS X - Cocoa // Window handle is NSWindow or NSView (void*) on Mac OS X - Cocoa
typedef void* WindowHandle; using WindowHandle = void*;
#elif defined(SFML_SYSTEM_IOS) #elif defined(SFML_SYSTEM_IOS)
// Window handle is UIWindow (void*) on iOS - UIKit // Window handle is UIWindow (void*) on iOS - UIKit
typedef void* WindowHandle; using WindowHandle = void*;
#elif defined(SFML_SYSTEM_ANDROID) #elif defined(SFML_SYSTEM_ANDROID)
// Window handle is ANativeWindow* (void*) on Android // Window handle is ANativeWindow* (void*) on Android
typedef void* WindowHandle; using WindowHandle = void*;
#elif defined(SFML_DOXYGEN) #elif defined(SFML_DOXYGEN)
// Define typedef symbol so that Doxygen can attach some documentation to it // Define type alias symbol so that Doxygen can attach some documentation to it
typedef "platform-specific" WindowHandle; using WindowHandle = "platform-specific";
#endif #endif

View File

@ -71,7 +71,7 @@ namespace
// Map to help us detect whether a different RenderTarget // Map to help us detect whether a different RenderTarget
// has been activated within a single context // has been activated within a single context
typedef std::unordered_map<sf::Uint64, sf::Uint64> ContextRenderTargetMap; using ContextRenderTargetMap = std::unordered_map<sf::Uint64, sf::Uint64>;
ContextRenderTargetMap contextRenderTargetMap; ContextRenderTargetMap contextRenderTargetMap;
// Check if a RenderTarget with the given ID is active in the current context // Check if a RenderTarget with the given ID is active in the current context

View File

@ -35,7 +35,7 @@
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sfml-activity", __VA_ARGS__)) #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_INFO, "sfml-activity", __VA_ARGS__))
namespace { namespace {
typedef void (*activityOnCreatePointer)(ANativeActivity*, void*, size_t); using activityOnCreatePointer = void (*)(ANativeActivity*, void*, size_t);
} }
const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo) const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)

View File

@ -54,8 +54,8 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef socklen_t AddrLength; using AddrLength = socklen_t;
typedef size_t Size; using Size = size_t;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Create an internal sockaddr_in address /// \brief Create an internal sockaddr_in address

View File

@ -57,8 +57,8 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Types // Types
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef int AddrLength; using AddrLength = int;
typedef int Size; using Size = int;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Create an internal sockaddr_in address /// \brief Create an internal sockaddr_in address

View File

@ -48,12 +48,12 @@
#if defined(SFML_OPENGL_ES) #if defined(SFML_OPENGL_ES)
typedef sf::priv::EglContext ContextType; using ContextType = sf::priv::EglContext;
#else #else
#include <SFML/Window/Win32/WglContext.hpp> #include <SFML/Window/Win32/WglContext.hpp>
typedef sf::priv::WglContext ContextType; using ContextType = sf::priv::WglContext;
#endif #endif
@ -61,48 +61,48 @@
#if defined(SFML_OPENGL_ES) #if defined(SFML_OPENGL_ES)
typedef sf::priv::EglContext ContextType; using ContextType = sf::priv::EglContext;
#else #else
#include <SFML/Window/Unix/GlxContext.hpp> #include <SFML/Window/Unix/GlxContext.hpp>
typedef sf::priv::GlxContext ContextType; using ContextType = sf::priv::GlxContext;
#endif #endif
#elif defined(SFML_SYSTEM_MACOS) #elif defined(SFML_SYSTEM_MACOS)
#include <SFML/Window/OSX/SFContext.hpp> #include <SFML/Window/OSX/SFContext.hpp>
typedef sf::priv::SFContext ContextType; using ContextType = sf::priv::SFContext;
#elif defined(SFML_SYSTEM_IOS) #elif defined(SFML_SYSTEM_IOS)
#include <SFML/Window/iOS/EaglContext.hpp> #include <SFML/Window/iOS/EaglContext.hpp>
typedef sf::priv::EaglContext ContextType; using ContextType = sf::priv::EaglContext;
#elif defined(SFML_SYSTEM_ANDROID) #elif defined(SFML_SYSTEM_ANDROID)
typedef sf::priv::EglContext ContextType; using ContextType = sf::priv::EglContext;
#endif #endif
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
typedef void (APIENTRY *glEnableFuncType)(GLenum); using glEnableFuncType = void (APIENTRY *)(GLenum);
typedef GLenum (APIENTRY *glGetErrorFuncType)(); using glGetErrorFuncType = GLenum (APIENTRY *)();
typedef void (APIENTRY *glGetIntegervFuncType)(GLenum, GLint*); using glGetIntegervFuncType = void (APIENTRY *)(GLenum, GLint*);
typedef const GLubyte* (APIENTRY *glGetStringFuncType)(GLenum); using glGetStringFuncType = const GLubyte* (APIENTRY *)(GLenum);
typedef const GLubyte* (APIENTRY *glGetStringiFuncType)(GLenum, GLuint); using glGetStringiFuncType = const GLubyte* (APIENTRY *)(GLenum, GLuint);
typedef GLboolean (APIENTRY *glIsEnabledFuncType)(GLenum); using glIsEnabledFuncType = GLboolean (APIENTRY *)(GLenum);
#else #else
typedef void (*glEnableFuncType)(GLenum); using glEnableFuncType = void (*)(GLenum);
typedef GLenum (*glGetErrorFuncType)(); using glGetErrorFuncType = GLenum (*)();
typedef void (*glGetIntegervFuncType)(GLenum, GLint*); using glGetIntegervFuncType = void (*)(GLenum, GLint*);
typedef const GLubyte* (*glGetStringFuncType)(GLenum); using glGetStringFuncType = const GLubyte* (*)(GLenum);
typedef const GLubyte* (*glGetStringiFuncType)(GLenum, GLuint); using glGetStringiFuncType = const GLubyte* (*)(GLenum, GLuint);
typedef GLboolean (*glIsEnabledFuncType)(GLenum); using glIsEnabledFuncType = GLboolean (*)(GLenum);
#endif #endif
@ -176,7 +176,7 @@ namespace
// context is going to be destroyed // context is going to be destroyed
// Unshareable OpenGL resources rely on this to clean up properly // Unshareable OpenGL resources rely on this to clean up properly
// whenever a context containing them is destroyed // whenever a context containing them is destroyed
typedef std::unordered_map<sf::ContextDestroyCallback, void*> ContextDestroyCallbacks; using ContextDestroyCallbacks = std::unordered_map<sf::ContextDestroyCallback, void *>;
ContextDestroyCallbacks contextDestroyCallbacks; ContextDestroyCallbacks contextDestroyCallbacks;
// This structure contains all the state necessary to // This structure contains all the state necessary to

View File

@ -32,11 +32,11 @@
#ifdef __OBJC__ #ifdef __OBJC__
@class NSAutoreleasePool; @class NSAutoreleasePool;
typedef NSAutoreleasePool* NSAutoreleasePoolRef; using NSAutoreleasePoolRef = NSAutoreleasePool*;
#else // If C++ #else // If C++
typedef void* NSAutoreleasePoolRef; using NSAutoreleasePoolRef = void*;
#endif #endif

View File

@ -39,11 +39,11 @@
#ifdef __OBJC__ #ifdef __OBJC__
@class NSCursor; @class NSCursor;
typedef NSCursor* NSCursorRef; using NSCursorRef = NSCursor*;
#else // If C++ #else // If C++
typedef void* NSCursorRef; using NSCursorRef = void*;
#endif #endif

View File

@ -42,7 +42,7 @@ namespace sf
namespace priv namespace priv
{ {
typedef std::vector<IOHIDElementRef> IOHIDElements; using IOHIDElements = std::vector<IOHIDElementRef>;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief sf::priv::InputImpl helper /// \brief sf::priv::InputImpl helper

View File

@ -116,9 +116,9 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
typedef long Location; using Location = long;
typedef std::unordered_map<sf::Joystick::Axis, IOHIDElementRef> AxisMap; using AxisMap = std::unordered_map<sf::Joystick::Axis, IOHIDElementRef>;
typedef std::vector<IOHIDElementRef> ButtonsVector; using ButtonsVector = std::vector<IOHIDElementRef>;
AxisMap m_axis; ///< Axes (but not POV/Hat) of the joystick AxisMap m_axis; ///< Axes (but not POV/Hat) of the joystick
IOHIDElementRef m_hat; ///< POV/Hat axis of the joystick IOHIDElementRef m_hat; ///< POV/Hat axis of the joystick

View File

@ -37,19 +37,19 @@
#ifdef __OBJC__ #ifdef __OBJC__
@class NSOpenGLContext; @class NSOpenGLContext;
typedef NSOpenGLContext* NSOpenGLContextRef; using NSOpenGLContextRef = NSOpenGLContext*;
@class NSOpenGLView; @class NSOpenGLView;
typedef NSOpenGLView* NSOpenGLViewRef; using NSOpenGLViewRef = NSOpenGLView*;
@class NSWindow; @class NSWindow;
typedef NSWindow* NSWindowRef; using NSWindowRef = NSWindow*;
#else // If C++ #else // If C++
typedef void* NSOpenGLContextRef; using NSOpenGLContextRef = void*;
typedef void* NSOpenGLViewRef; using NSOpenGLViewRef = void*;
typedef void* NSWindowRef; using NSWindowRef = void*;
#endif #endif

View File

@ -39,17 +39,17 @@
#ifdef __OBJC__ #ifdef __OBJC__
#import <SFML/Window/OSX/WindowImplDelegateProtocol.h> #import <SFML/Window/OSX/WindowImplDelegateProtocol.h>
typedef id<WindowImplDelegateProtocol,NSObject> WindowImplDelegateRef; using WindowImplDelegateRef = id<WindowImplDelegateProtocol,NSObject>;
@class NSOpenGLContext; @class NSOpenGLContext;
typedef NSOpenGLContext* NSOpenGLContextRef; using NSOpenGLContextRef = NSOpenGLContext*;
#else // If C++ #else // If C++
typedef unsigned short unichar; // See NSString.h using unichar = unsigned short; // See NSString.h
typedef void* WindowImplDelegateRef; using WindowImplDelegateRef = void*;
typedef void* NSOpenGLContextRef; using NSOpenGLContextRef = void*;
#endif #endif

View File

@ -42,7 +42,7 @@ namespace
unsigned int referenceCount = 0; unsigned int referenceCount = 0;
sf::Mutex mutex; sf::Mutex mutex;
typedef std::unordered_map<std::string, Atom> AtomMap; using AtomMap = std::unordered_map<std::string, Atom>;
AtomMap atoms; AtomMap atoms;
} }

View File

@ -48,7 +48,7 @@ namespace
bool plugged; bool plugged;
}; };
typedef std::vector<JoystickRecord> JoystickList; using JoystickList = std::vector<JoystickRecord>;
JoystickList joystickList; JoystickList joystickList;
bool isJoystick(udev_device* udevDevice) bool isJoystick(udev_device* udevDevice)

View File

@ -52,10 +52,10 @@
#ifdef SFML_OPENGL_ES #ifdef SFML_OPENGL_ES
#include <SFML/Window/EglContext.hpp> #include <SFML/Window/EglContext.hpp>
typedef sf::priv::EglContext ContextType; using ContextType = sf::priv::EglContext;
#else #else
#include <SFML/Window/Unix/GlxContext.hpp> #include <SFML/Window/Unix/GlxContext.hpp>
typedef sf::priv::GlxContext ContextType; using ContextType = sf::priv::GlxContext;
#endif #endif
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -30,12 +30,12 @@
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/VulkanImplWin32.hpp> #include <SFML/Window/Win32/VulkanImplWin32.hpp>
typedef sf::priv::VulkanImplWin32 VulkanImplType; using VulkanImplType = sf::priv::VulkanImplWin32;
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD) #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD)
#include <SFML/Window/Unix/VulkanImplX11.hpp> #include <SFML/Window/Unix/VulkanImplX11.hpp>
typedef sf::priv::VulkanImplX11 VulkanImplType; using VulkanImplType = sf::priv::VulkanImplX11;
#else #else

View File

@ -78,7 +78,7 @@ namespace
bool plugged; bool plugged;
}; };
typedef std::vector<JoystickRecord> JoystickList; using JoystickList = std::vector<JoystickRecord>;
JoystickList joystickList; JoystickList joystickList;
struct JoystickBlacklistEntry struct JoystickBlacklistEntry
@ -87,7 +87,7 @@ namespace
unsigned int productId; unsigned int productId;
}; };
typedef std::vector<JoystickBlacklistEntry> JoystickBlacklist; using JoystickBlacklist = std::vector<JoystickBlacklistEntry>;
JoystickBlacklist joystickBlacklist; JoystickBlacklist joystickBlacklist;
const DWORD directInputEventBufferSize = 32; const DWORD directInputEventBufferSize = 32;
@ -403,7 +403,7 @@ void JoystickImpl::initializeDInput()
if (dinput8dll) if (dinput8dll)
{ {
// Try to get the address of the DirectInput8Create entry point // Try to get the address of the DirectInput8Create entry point
typedef HRESULT(WINAPI *DirectInput8CreateFunc)(HINSTANCE, DWORD, REFIID, LPVOID*, LPUNKNOWN); using DirectInput8CreateFunc = HRESULT (*)(HINSTANCE, DWORD, const IID &, LPVOID *, LPUNKNOWN);
DirectInput8CreateFunc directInput8Create = reinterpret_cast<DirectInput8CreateFunc>(reinterpret_cast<void*>(GetProcAddress(dinput8dll, "DirectInput8Create"))); DirectInput8CreateFunc directInput8Create = reinterpret_cast<DirectInput8CreateFunc>(reinterpret_cast<void*>(GetProcAddress(dinput8dll, "DirectInput8Create")));
if (directInput8Create) if (directInput8Create)

View File

@ -85,7 +85,7 @@ namespace
ProcessPerMonitorDpiAware = 2 ProcessPerMonitorDpiAware = 2
}; };
typedef HRESULT (WINAPI* SetProcessDpiAwarenessFuncType)(ProcessDpiAwareness); using SetProcessDpiAwarenessFuncType = HRESULT (*)(ProcessDpiAwareness);
SetProcessDpiAwarenessFuncType SetProcessDpiAwarenessFunc = reinterpret_cast<SetProcessDpiAwarenessFuncType>(reinterpret_cast<void*>(GetProcAddress(shCoreDll, "SetProcessDpiAwareness"))); SetProcessDpiAwarenessFuncType SetProcessDpiAwarenessFunc = reinterpret_cast<SetProcessDpiAwarenessFuncType>(reinterpret_cast<void*>(GetProcAddress(shCoreDll, "SetProcessDpiAwareness")));
if (SetProcessDpiAwarenessFunc) if (SetProcessDpiAwarenessFunc)
@ -113,7 +113,7 @@ namespace
if (user32Dll) if (user32Dll)
{ {
typedef BOOL (WINAPI* SetProcessDPIAwareFuncType)(void); using SetProcessDPIAwareFuncType = BOOL (*)();
SetProcessDPIAwareFuncType SetProcessDPIAwareFunc = reinterpret_cast<SetProcessDPIAwareFuncType>(reinterpret_cast<void*>(GetProcAddress(user32Dll, "SetProcessDPIAware"))); SetProcessDPIAwareFuncType SetProcessDPIAwareFunc = reinterpret_cast<SetProcessDPIAwareFuncType>(reinterpret_cast<void*>(GetProcAddress(user32Dll, "SetProcessDPIAware")));
if (SetProcessDPIAwareFunc) if (SetProcessDPIAwareFunc)

View File

@ -36,37 +36,37 @@
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/WindowImplWin32.hpp> #include <SFML/Window/Win32/WindowImplWin32.hpp>
typedef sf::priv::WindowImplWin32 WindowImplType; using WindowImplType = sf::priv::WindowImplWin32;
#include <SFML/Window/Win32/VulkanImplWin32.hpp> #include <SFML/Window/Win32/VulkanImplWin32.hpp>
typedef sf::priv::VulkanImplWin32 VulkanImplType; using VulkanImplType = sf::priv::VulkanImplWin32;
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD) #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD)
#include <SFML/Window/Unix/WindowImplX11.hpp> #include <SFML/Window/Unix/WindowImplX11.hpp>
typedef sf::priv::WindowImplX11 WindowImplType; using WindowImplType = sf::priv::WindowImplX11;
#include <SFML/Window/Unix/VulkanImplX11.hpp> #include <SFML/Window/Unix/VulkanImplX11.hpp>
typedef sf::priv::VulkanImplX11 VulkanImplType; using VulkanImplType = sf::priv::VulkanImplX11;
#elif defined(SFML_SYSTEM_MACOS) #elif defined(SFML_SYSTEM_MACOS)
#include <SFML/Window/OSX/WindowImplCocoa.hpp> #include <SFML/Window/OSX/WindowImplCocoa.hpp>
typedef sf::priv::WindowImplCocoa WindowImplType; using WindowImplType = sf::priv::WindowImplCocoa;
#define SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE #define SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE
#elif defined(SFML_SYSTEM_IOS) #elif defined(SFML_SYSTEM_IOS)
#include <SFML/Window/iOS/WindowImplUIKit.hpp> #include <SFML/Window/iOS/WindowImplUIKit.hpp>
typedef sf::priv::WindowImplUIKit WindowImplType; using WindowImplType = sf::priv::WindowImplUIKit;
#define SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE #define SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE
#elif defined(SFML_SYSTEM_ANDROID) #elif defined(SFML_SYSTEM_ANDROID)
#include <SFML/Window/Android/WindowImplAndroid.hpp> #include <SFML/Window/Android/WindowImplAndroid.hpp>
typedef sf::priv::WindowImplAndroid WindowImplType; using WindowImplType = sf::priv::WindowImplAndroid;
#define SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE #define SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE