Converted applicable enumerations to strongly typed enumerations.

This commit is contained in:
binary1248 2017-04-04 01:13:07 +02:00
parent b3b094fc91
commit 24db1dba1a
74 changed files with 1242 additions and 1251 deletions

View file

@ -47,7 +47,7 @@ public:
/// \brief Enumeration of the sound source states
///
////////////////////////////////////////////////////////////
enum Status
enum class Status : unsigned char
{
Stopped, ///< Sound is not playing
Paused, ///< Sound is paused

View file

@ -46,7 +46,7 @@ struct SFML_GRAPHICS_API BlendMode
/// The factors are mapped directly to their OpenGL equivalents,
/// specified by glBlendFunc() or glBlendFuncSeparate().
////////////////////////////////////////////////////////
enum Factor
enum class Factor : unsigned char
{
Zero, ///< (0, 0, 0, 0)
One, ///< (1, 1, 1, 1)
@ -66,7 +66,7 @@ struct SFML_GRAPHICS_API BlendMode
/// The equations are mapped directly to their OpenGL equivalents,
/// specified by glBlendEquation() or glBlendEquationSeparate().
////////////////////////////////////////////////////////
enum Equation
enum class Equation : unsigned char
{
Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor
Subtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
@ -92,7 +92,7 @@ struct SFML_GRAPHICS_API BlendMode
/// \param blendEquation Specifies how to combine the source and destination colors and alpha.
///
////////////////////////////////////////////////////////////
BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation = Add);
BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation = Equation::Add);
////////////////////////////////////////////////////////////
/// \brief Construct the blend mode given the factors and equation.

View file

@ -36,20 +36,14 @@ namespace sf
/// and view.
///
////////////////////////////////////////////////////////////
enum PrimitiveType
enum class PrimitiveType : unsigned char
{
Points, ///< List of individual points
Lines, ///< List of individual lines
LineStrip, ///< List of connected lines, a point uses the previous point to form a line
Triangles, ///< List of individual triangles
TriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
TriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
Quads, ///< List of individual quads (deprecated, don't work with OpenGL ES)
// Deprecated names
LinesStrip = LineStrip, ///< \deprecated Use LineStrip instead
TrianglesStrip = TriangleStrip, ///< \deprecated Use TriangleStrip instead
TrianglesFan = TriangleFan ///< \deprecated Use TriangleFan instead
TriangleFan ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
};
} // namespace sf

View file

@ -57,7 +57,7 @@ public:
/// \brief Types of shaders
///
////////////////////////////////////////////////////////////
enum Type
enum class Type : unsigned char
{
Vertex, ///< %Vertex shader
Geometry, ///< Geometry shader

View file

@ -52,7 +52,7 @@ public:
/// \brief Types of texture coordinates that can be used for rendering
///
////////////////////////////////////////////////////////////
enum CoordinateType
enum class CoordinateType : unsigned char
{
Normalized, ///< Texture coordinates in range [0 .. 1]
Pixels ///< Texture coordinates in range [0 .. size]
@ -568,7 +568,7 @@ public:
/// \param coordinateType Type of texture coordinates to use
///
////////////////////////////////////////////////////////////
static void bind(const Texture* texture, CoordinateType coordinateType = Normalized);
static void bind(const Texture* texture, CoordinateType coordinateType = CoordinateType::Normalized);
////////////////////////////////////////////////////////////
/// \brief Get the maximum texture size allowed

View file

@ -52,7 +52,7 @@ public:
/// \brief Enumeration of transfer modes
///
////////////////////////////////////////////////////////////
enum TransferMode
enum class TransferMode : unsigned char
{
Binary, ///< Binary mode (file is transfered as a sequence of bytes)
Ascii, ///< Text mode using ASCII encoding
@ -71,7 +71,7 @@ public:
/// \brief Status codes possibly returned by a FTP response
///
////////////////////////////////////////////////////////////
enum Status
enum class Status : unsigned short
{
// 1xx: the requested action is being initiated,
// expect another reply before proceeding with a new command
@ -143,7 +143,7 @@ public:
/// \param message Response message
///
////////////////////////////////////////////////////////////
explicit Response(Status code = InvalidResponse, const std::string& message = "");
explicit Response(Status code = Status::InvalidResponse, const std::string& message = "");
////////////////////////////////////////////////////////////
/// \brief Check if the status code means a success
@ -465,7 +465,7 @@ public:
/// \see upload
///
////////////////////////////////////////////////////////////
Response download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = Binary);
Response download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = TransferMode::Binary);
////////////////////////////////////////////////////////////
/// \brief Upload a file to the server
@ -484,7 +484,7 @@ public:
/// \see download
///
////////////////////////////////////////////////////////////
Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary);
Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = TransferMode::Binary);
////////////////////////////////////////////////////////////
/// \brief Send a command to the FTP server

View file

@ -59,7 +59,7 @@ public:
/// \brief Enumerate the available HTTP methods for a request
///
////////////////////////////////////////////////////////////
enum Method
enum class Method : unsigned char
{
Get, ///< Request in get mode, standard method to retrieve a page
Post, ///< Request in post mode, usually to send data to a page
@ -79,7 +79,7 @@ public:
/// \param body Content of the request's body
///
////////////////////////////////////////////////////////////
Request(const std::string& uri = "/", Method method = Get, const std::string& body = "");
Request(const std::string& uri = "/", Method method = Method::Get, const std::string& body = "");
////////////////////////////////////////////////////////////
/// \brief Set the value of a field
@ -198,7 +198,7 @@ public:
/// \brief Enumerate all the valid status codes for a response
///
////////////////////////////////////////////////////////////
enum Status
enum class Status : unsigned short
{
// 2xx: success
Ok = 200, ///< Most common code returned when operation was successful

View file

@ -50,7 +50,7 @@ public:
/// \brief Status codes that may be returned by socket functions
///
////////////////////////////////////////////////////////////
enum Status
enum class Status : unsigned char
{
Done, ///< The socket has sent / received the data
NotReady, ///< The socket is not ready to send / receive data yet
@ -111,7 +111,7 @@ protected:
/// \brief Types of protocols that the socket can use
///
////////////////////////////////////////////////////////////
enum Type
enum class Type : unsigned char
{
Tcp, ///< TCP protocol
Udp ///< UDP protocol

View file

@ -184,7 +184,7 @@ public:
/// \brief Enumeration of the different types of events
///
////////////////////////////////////////////////////////////
enum EventType
enum class Type : unsigned char
{
Closed, ///< The window requested to be closed (no data)
Resized, ///< The window was resized (data in event.size)
@ -216,7 +216,7 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
EventType type; ///< Type of the event
Type type; ///< Type of the event
union
{

View file

@ -49,15 +49,14 @@ public:
enum
{
Count = 8, ///< Maximum number of supported joysticks
ButtonCount = 32, ///< Maximum number of supported buttons
AxisCount = 8 ///< Maximum number of supported axes
ButtonCount = 32 ///< Maximum number of supported buttons
};
////////////////////////////////////////////////////////////
/// \brief Axes supported by SFML joysticks
///
////////////////////////////////////////////////////////////
enum Axis
enum class Axis : unsigned char
{
X, ///< The X axis
Y, ///< The Y axis
@ -66,7 +65,9 @@ public:
U, ///< The U axis
V, ///< The V axis
PovX, ///< The X axis of the point-of-view hat
PovY ///< The Y axis of the point-of-view hat
PovY, ///< The Y axis of the point-of-view hat
Count ///< Maximum number of supported axes
};
////////////////////////////////////////////////////////////

View file

@ -45,112 +45,113 @@ public:
/// \brief Key codes
///
////////////////////////////////////////////////////////////
enum Key
enum class Key : unsigned char
{
Unknown = -1, ///< Unhandled key
A = 0, ///< The A key
B, ///< The B key
C, ///< The C key
D, ///< The D key
E, ///< The E key
F, ///< The F key
G, ///< The G key
H, ///< The H key
I, ///< The I key
J, ///< The J key
K, ///< The K key
L, ///< The L key
M, ///< The M key
N, ///< The N key
O, ///< The O key
P, ///< The P key
Q, ///< The Q key
R, ///< The R key
S, ///< The S key
T, ///< The T key
U, ///< The U key
V, ///< The V key
W, ///< The W key
X, ///< The X key
Y, ///< The Y key
Z, ///< The Z key
Num0, ///< The 0 key
Num1, ///< The 1 key
Num2, ///< The 2 key
Num3, ///< The 3 key
Num4, ///< The 4 key
Num5, ///< The 5 key
Num6, ///< The 6 key
Num7, ///< The 7 key
Num8, ///< The 8 key
Num9, ///< The 9 key
Escape, ///< The Escape key
LControl, ///< The left Control key
LShift, ///< The left Shift key
LAlt, ///< The left Alt key
LSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
RControl, ///< The right Control key
RShift, ///< The right Shift key
RAlt, ///< The right Alt key
RSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
Menu, ///< The Menu key
LBracket, ///< The [ key
RBracket, ///< The ] key
SemiColon, ///< The ; key
Comma, ///< The , key
Period, ///< The . key
Quote, ///< The ' key
Slash, ///< The / key
BackSlash, ///< The \ key
Tilde, ///< The ~ key
Equal, ///< The = key
Dash, ///< The - key
Space, ///< The Space key
Return, ///< The Return key
BackSpace, ///< The Backspace key
Tab, ///< The Tabulation key
PageUp, ///< The Page up key
PageDown, ///< The Page down key
End, ///< The End key
Home, ///< The Home key
Insert, ///< The Insert key
Delete, ///< The Delete key
Add, ///< The + key
Subtract, ///< The - key
Multiply, ///< The * key
Divide, ///< The / key
Left, ///< Left arrow
Right, ///< Right arrow
Up, ///< Up arrow
Down, ///< Down arrow
Numpad0, ///< The numpad 0 key
Numpad1, ///< The numpad 1 key
Numpad2, ///< The numpad 2 key
Numpad3, ///< The numpad 3 key
Numpad4, ///< The numpad 4 key
Numpad5, ///< The numpad 5 key
Numpad6, ///< The numpad 6 key
Numpad7, ///< The numpad 7 key
Numpad8, ///< The numpad 8 key
Numpad9, ///< The numpad 9 key
F1, ///< The F1 key
F2, ///< The F2 key
F3, ///< The F3 key
F4, ///< The F4 key
F5, ///< The F5 key
F6, ///< The F6 key
F7, ///< The F7 key
F8, ///< The F8 key
F9, ///< The F9 key
F10, ///< The F10 key
F11, ///< The F11 key
F12, ///< The F12 key
F13, ///< The F13 key
F14, ///< The F14 key
F15, ///< The F15 key
Pause, ///< The Pause key
Unknown = static_cast<unsigned char>(-1), ///< Unhandled key
KeyCount ///< Keep last -- the total number of keyboard keys
A = 0, ///< The A key
B, ///< The B key
C, ///< The C key
D, ///< The D key
E, ///< The E key
F, ///< The F key
G, ///< The G key
H, ///< The H key
I, ///< The I key
J, ///< The J key
K, ///< The K key
L, ///< The L key
M, ///< The M key
N, ///< The N key
O, ///< The O key
P, ///< The P key
Q, ///< The Q key
R, ///< The R key
S, ///< The S key
T, ///< The T key
U, ///< The U key
V, ///< The V key
W, ///< The W key
X, ///< The X key
Y, ///< The Y key
Z, ///< The Z key
Num0, ///< The 0 key
Num1, ///< The 1 key
Num2, ///< The 2 key
Num3, ///< The 3 key
Num4, ///< The 4 key
Num5, ///< The 5 key
Num6, ///< The 6 key
Num7, ///< The 7 key
Num8, ///< The 8 key
Num9, ///< The 9 key
Escape, ///< The Escape key
LControl, ///< The left Control key
LShift, ///< The left Shift key
LAlt, ///< The left Alt key
LSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
RControl, ///< The right Control key
RShift, ///< The right Shift key
RAlt, ///< The right Alt key
RSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
Menu, ///< The Menu key
LBracket, ///< The [ key
RBracket, ///< The ] key
SemiColon, ///< The ; key
Comma, ///< The , key
Period, ///< The . key
Quote, ///< The ' key
Slash, ///< The / key
BackSlash, ///< The \ key
Tilde, ///< The ~ key
Equal, ///< The = key
Dash, ///< The - key
Space, ///< The Space key
Return, ///< The Return key
BackSpace, ///< The Backspace key
Tab, ///< The Tabulation key
PageUp, ///< The Page up key
PageDown, ///< The Page down key
End, ///< The End key
Home, ///< The Home key
Insert, ///< The Insert key
Delete, ///< The Delete key
Add, ///< The + key
Subtract, ///< The - key
Multiply, ///< The * key
Divide, ///< The / key
Left, ///< Left arrow
Right, ///< Right arrow
Up, ///< Up arrow
Down, ///< Down arrow
Numpad0, ///< The numpad 0 key
Numpad1, ///< The numpad 1 key
Numpad2, ///< The numpad 2 key
Numpad3, ///< The numpad 3 key
Numpad4, ///< The numpad 4 key
Numpad5, ///< The numpad 5 key
Numpad6, ///< The numpad 6 key
Numpad7, ///< The numpad 7 key
Numpad8, ///< The numpad 8 key
Numpad9, ///< The numpad 9 key
F1, ///< The F1 key
F2, ///< The F2 key
F3, ///< The F3 key
F4, ///< The F4 key
F5, ///< The F5 key
F6, ///< The F6 key
F7, ///< The F7 key
F8, ///< The F8 key
F9, ///< The F9 key
F10, ///< The F10 key
F11, ///< The F11 key
F12, ///< The F12 key
F13, ///< The F13 key
F14, ///< The F14 key
F15, ///< The F15 key
Pause, ///< The Pause key
Count ///< Keep last -- the total number of keyboard keys
};
////////////////////////////////////////////////////////////

View file

@ -48,7 +48,7 @@ public:
/// \brief Mouse buttons
///
////////////////////////////////////////////////////////////
enum Button
enum class Button : unsigned char
{
Left, ///< The left mouse button
Right, ///< The right mouse button
@ -56,14 +56,14 @@ public:
XButton1, ///< The first extra mouse button
XButton2, ///< The second extra mouse button
ButtonCount ///< Keep last -- the total number of mouse buttons
Count ///< Keep last -- the total number of mouse buttons
};
////////////////////////////////////////////////////////////
/// \brief Mouse wheels
///
////////////////////////////////////////////////////////////
enum Wheel
enum class Wheel : unsigned char
{
VerticalWheel, ///< The vertical mouse wheel
HorizontalWheel ///< The horizontal mouse wheel

View file

@ -47,7 +47,7 @@ public:
/// \brief Sensor type
///
////////////////////////////////////////////////////////////
enum Type
enum class Type : unsigned char
{
Accelerometer, ///< Measures the raw acceleration (m/s^2)
Gyroscope, ///< Measures the raw rotation rates (degrees/s)