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}
${NON_ANDROID_GCC_WARNINGS}
-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

View File

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

View File

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

View File

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

View File

@ -267,7 +267,7 @@ private:
////////////////////////////////////////////////////////////
// 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

View File

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

View File

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

View File

@ -327,7 +327,7 @@ private:
////////////////////////////////////////////////////////////
// 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
@ -387,7 +387,7 @@ private:
////////////////////////////////////////////////////////////
// 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

View File

@ -61,37 +61,37 @@ namespace 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)
///
////////////////////////////////////////////////////////////
typedef Vector2<int> Ivec2;
using Ivec2 = Vector2<int>;
////////////////////////////////////////////////////////////
/// \brief 2D bool vector (\p bvec2 in GLSL)
///
////////////////////////////////////////////////////////////
typedef Vector2<bool> Bvec2;
using Bvec2 = Vector2<bool>;
////////////////////////////////////////////////////////////
/// \brief 3D float vector (\p vec3 in GLSL)
///
////////////////////////////////////////////////////////////
typedef Vector3<float> Vec3;
using Vec3 = Vector3<float>;
////////////////////////////////////////////////////////////
/// \brief 3D int vector (\p ivec3 in GLSL)
///
////////////////////////////////////////////////////////////
typedef Vector3<int> Ivec3;
using Ivec3 = Vector3<int>;
////////////////////////////////////////////////////////////
/// \brief 3D bool vector (\p bvec3 in GLSL)
///
////////////////////////////////////////////////////////////
typedef Vector3<bool> Bvec3;
using Bvec3 = Vector3<bool>;
#ifdef SFML_DOXYGEN
@ -107,7 +107,7 @@ namespace Glsl
/// sf::Glsl::Vec4 color = sf::Color::Cyan;
/// \endcode
////////////////////////////////////////////////////////////
typedef implementation-defined Vec4;
using Vec4 = implementation-defined;
////////////////////////////////////////////////////////////
/// \brief 4D int vector (\p ivec4 in GLSL)
@ -121,13 +121,13 @@ namespace Glsl
/// sf::Glsl::Ivec4 color = sf::Color::Cyan;
/// \endcode
////////////////////////////////////////////////////////////
typedef implementation-defined Ivec4;
using Ivec4 = implementation-defined;
////////////////////////////////////////////////////////////
/// \brief 4D bool vector (\p bvec4 in GLSL)
///
////////////////////////////////////////////////////////////
typedef implementation-defined Bvec4;
using Bvec4 = implementation-defined;
////////////////////////////////////////////////////////////
/// \brief 3x3 float matrix (\p mat3 in GLSL)
@ -152,7 +152,7 @@ namespace Glsl
/// sf::Glsl::Mat3 matrix = transform;
/// \endcode
////////////////////////////////////////////////////////////
typedef implementation-defined Mat3;
using Mat3 = implementation-defined;
////////////////////////////////////////////////////////////
/// \brief 4x4 float matrix (\p mat4 in GLSL)
@ -178,15 +178,15 @@ namespace Glsl
/// sf::Glsl::Mat4 matrix = transform;
/// \endcode
////////////////////////////////////////////////////////////
typedef implementation-defined Mat4;
using Mat4 = implementation-defined;
#else // SFML_DOXYGEN
typedef priv::Vector4<float> Vec4;
typedef priv::Vector4<int> Ivec4;
typedef priv::Vector4<bool> Bvec4;
typedef priv::Matrix<3, 3> Mat3;
typedef priv::Matrix<4, 4> Mat4;
using Vec4 = priv::Vector4<float>;
using Ivec4 = priv::Vector4<int>;
using Bvec4 = priv::Vector4<bool>;
using Mat3 = priv::Matrix<3, 3>;
using Mat4 = priv::Matrix<4, 4>;
#endif // SFML_DOXYGEN
@ -205,7 +205,7 @@ namespace Glsl
/// These types are exclusively used by the sf::Shader class.
///
/// 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.
/// Others are newly defined, such as Glsl::Vec4 or Glsl::Mat3. Their
/// 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>
// Create typedefs for the most common types
typedef Rect<int> IntRect;
typedef Rect<float> FloatRect;
// Create type aliases for the most common types
using IntRect = Rect<int>;
using FloatRect = Rect<float>;
} // namespace sf
@ -245,7 +245,7 @@ typedef Rect<float> FloatRect;
/// don't intersect.
///
/// 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<float> is sf::FloatRect
///

View File

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

View File

@ -173,7 +173,7 @@ public:
////////////////////////////////////////////////////////////
// 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
@ -333,7 +333,7 @@ public:
////////////////////////////////////////////////////////////
// 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

View File

@ -47,7 +47,7 @@ class UdpSocket;
class SFML_NETWORK_API Packet
{
// 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:

View File

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

View File

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

View File

@ -730,10 +730,10 @@ public:
#include <SFML/System/Utf.inl>
// Make typedefs to get rid of the template syntax
typedef Utf<8> Utf8;
typedef Utf<16> Utf16;
typedef Utf<32> Utf32;
// Make type aliases to get rid of the template syntax
using Utf8 = Utf<8>;
using Utf16 = Utf<16>;
using Utf32 = Utf<32>;
} // namespace sf
@ -756,8 +756,8 @@ typedef Utf<32> Utf32;
/// can use any character / string type for a given encoding.
///
/// It has 3 specializations:
/// \li sf::Utf<8> (typedef'd to sf::Utf8)
/// \li sf::Utf<16> (typedef'd to sf::Utf16)
/// \li sf::Utf<32> (typedef'd to sf::Utf32)
/// \li sf::Utf<8> (with sf::Utf8 type alias)
/// \li sf::Utf<16> (with sf::Utf16 type alias)
/// \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>
// Define the most common types
typedef Vector2<int> Vector2i;
typedef Vector2<unsigned int> Vector2u;
typedef Vector2<float> Vector2f;
using Vector2i = Vector2<int>;
using Vector2u = Vector2<unsigned int>;
using Vector2f = Vector2<float>;
} // namespace sf
@ -274,7 +274,7 @@ typedef Vector2<float> Vector2f;
/// and comparisons (==, !=), for example int or float.
///
/// 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<int> is sf::Vector2i
/// \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>
// Define the most common types
typedef Vector3<int> Vector3i;
typedef Vector3<float> Vector3f;
using Vector3i = Vector3<int>;
using Vector3f = Vector3<float>;
} // namespace sf
@ -275,7 +275,7 @@ typedef Vector3<float> Vector3f;
/// and comparisons (==, !=), for example int or float.
///
/// 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<int> is sf::Vector3i
///

View File

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

View File

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

View File

@ -34,15 +34,15 @@
#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__)
typedef struct VkSurfaceKHR_T* VkSurfaceKHR;
using VkSurfaceKHR = struct VkSurfaceKHR_T*;
#else
typedef uint64_t VkSurfaceKHR;
using VkSurfaceKHR = uint64_t;
#endif
@ -52,7 +52,7 @@ struct VkAllocationCallbacks;
namespace sf
{
typedef void (*VulkanFunctionPointer)();
using VulkanFunctionPointer = void (*)();
////////////////////////////////////////////////////////////
/// \brief Vulkan helper functions
@ -109,6 +109,6 @@ public:
/// \class sf::Vulkan
/// \ingroup window
///
///
///
///
////////////////////////////////////////////////////////////

View File

@ -384,7 +384,7 @@ public:
/// \brief Get the OS-specific handle of the window
///
/// 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
/// very specific stuff to implement that SFML doesn't support,
/// or implement a temporary workaround until a bug is fixed.

View File

@ -30,7 +30,7 @@
////////////////////////////////////////////////////////////
#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)
struct HWND__;
#endif
@ -40,32 +40,32 @@ namespace sf
#if defined(SFML_SYSTEM_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)
// Window handle is Window (unsigned long) on Unix - X11
typedef unsigned long WindowHandle;
using WindowHandle = unsigned long;
#elif defined(SFML_SYSTEM_MACOS)
// Window handle is NSWindow or NSView (void*) on Mac OS X - Cocoa
typedef void* WindowHandle;
using WindowHandle = void*;
#elif defined(SFML_SYSTEM_IOS)
// Window handle is UIWindow (void*) on iOS - UIKit
typedef void* WindowHandle;
using WindowHandle = void*;
#elif defined(SFML_SYSTEM_ANDROID)
// Window handle is ANativeWindow* (void*) on Android
typedef void* WindowHandle;
using WindowHandle = void*;
#elif defined(SFML_DOXYGEN)
// Define typedef symbol so that Doxygen can attach some documentation to it
typedef "platform-specific" WindowHandle;
// Define type alias symbol so that Doxygen can attach some documentation to it
using WindowHandle = "platform-specific";
#endif

View File

@ -71,7 +71,7 @@ namespace
// Map to help us detect whether a different RenderTarget
// 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;
// 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__))
namespace {
typedef void (*activityOnCreatePointer)(ANativeActivity*, void*, size_t);
using activityOnCreatePointer = void (*)(ANativeActivity*, void*, size_t);
}
const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,12 +30,12 @@
#if defined(SFML_SYSTEM_WINDOWS)
#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)
#include <SFML/Window/Unix/VulkanImplX11.hpp>
typedef sf::priv::VulkanImplX11 VulkanImplType;
using VulkanImplType = sf::priv::VulkanImplX11;
#else

View File

@ -78,7 +78,7 @@ namespace
bool plugged;
};
typedef std::vector<JoystickRecord> JoystickList;
using JoystickList = std::vector<JoystickRecord>;
JoystickList joystickList;
struct JoystickBlacklistEntry
@ -87,7 +87,7 @@ namespace
unsigned int productId;
};
typedef std::vector<JoystickBlacklistEntry> JoystickBlacklist;
using JoystickBlacklist = std::vector<JoystickBlacklistEntry>;
JoystickBlacklist joystickBlacklist;
const DWORD directInputEventBufferSize = 32;
@ -403,7 +403,7 @@ void JoystickImpl::initializeDInput()
if (dinput8dll)
{
// 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")));
if (directInput8Create)

View File

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

View File

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