From 891a0d326315dfdfc6bfd8b942f55729842ba869 Mon Sep 17 00:00:00 2001 From: ZXShady <153229951+ZXShady@users.noreply.github.com> Date: Wed, 19 Feb 2025 23:18:23 +0000 Subject: [PATCH] Remove explicit `sf::` prefix on `Exception` --- src/SFML/Audio/InputSoundFile.cpp | 6 ++--- src/SFML/Audio/Music.cpp | 6 ++--- src/SFML/Audio/OutputSoundFile.cpp | 2 +- src/SFML/Audio/SoundBuffer.cpp | 8 +++---- src/SFML/Graphics/Image.cpp | 6 ++--- src/SFML/Graphics/RenderTexture.cpp | 2 +- src/SFML/Graphics/Shader.cpp | 36 ++++++++++++++--------------- src/SFML/Graphics/Texture.cpp | 18 +++++++-------- src/SFML/System/FileInputStream.cpp | 2 +- src/SFML/Window/Cursor.cpp | 6 ++--- 10 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/SFML/Audio/InputSoundFile.cpp b/src/SFML/Audio/InputSoundFile.cpp index 089455256..96c90c049 100644 --- a/src/SFML/Audio/InputSoundFile.cpp +++ b/src/SFML/Audio/InputSoundFile.cpp @@ -71,7 +71,7 @@ void InputSoundFile::StreamDeleter::operator()(InputStream* ptr) const InputSoundFile::InputSoundFile(const std::filesystem::path& filename) { if (!openFromFile(filename)) - throw sf::Exception("Failed to open input sound file"); + throw Exception("Failed to open input sound file"); } @@ -79,7 +79,7 @@ InputSoundFile::InputSoundFile(const std::filesystem::path& filename) InputSoundFile::InputSoundFile(const void* data, std::size_t sizeInBytes) { if (!openFromMemory(data, sizeInBytes)) - throw sf::Exception("Failed to open input sound file from memory"); + throw Exception("Failed to open input sound file from memory"); } @@ -87,7 +87,7 @@ InputSoundFile::InputSoundFile(const void* data, std::size_t sizeInBytes) InputSoundFile::InputSoundFile(InputStream& stream) { if (!openFromStream(stream)) - throw sf::Exception("Failed to open input sound file from stream"); + throw Exception("Failed to open input sound file from stream"); } diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index 66047e68a..029daab0c 100644 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp @@ -69,7 +69,7 @@ Music::Music() : m_impl(std::make_unique()) Music::Music(const std::filesystem::path& filename) : Music() { if (!openFromFile(filename)) - throw sf::Exception("Failed to open music from file"); + throw Exception("Failed to open music from file"); } @@ -77,7 +77,7 @@ Music::Music(const std::filesystem::path& filename) : Music() Music::Music(const void* data, std::size_t sizeInBytes) : Music() { if (!openFromMemory(data, sizeInBytes)) - throw sf::Exception("Failed to open music from memory"); + throw Exception("Failed to open music from memory"); } @@ -85,7 +85,7 @@ Music::Music(const void* data, std::size_t sizeInBytes) : Music() Music::Music(InputStream& stream) : Music() { if (!openFromStream(stream)) - throw sf::Exception("Failed to open music from stream"); + throw Exception("Failed to open music from stream"); } diff --git a/src/SFML/Audio/OutputSoundFile.cpp b/src/SFML/Audio/OutputSoundFile.cpp index ee2ab605b..0a249b41e 100644 --- a/src/SFML/Audio/OutputSoundFile.cpp +++ b/src/SFML/Audio/OutputSoundFile.cpp @@ -44,7 +44,7 @@ OutputSoundFile::OutputSoundFile(const std::filesystem::path& filename, const std::vector& channelMap) { if (!openFromFile(filename, sampleRate, channelCount, channelMap)) - throw sf::Exception("Failed to open output sound file"); + throw Exception("Failed to open output sound file"); } diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index fca41c561..fcfa70121 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -44,7 +44,7 @@ namespace sf SoundBuffer::SoundBuffer(const std::filesystem::path& filename) { if (!loadFromFile(filename)) - throw sf::Exception("Failed to open sound buffer from file"); + throw Exception("Failed to open sound buffer from file"); } @@ -52,7 +52,7 @@ SoundBuffer::SoundBuffer(const std::filesystem::path& filename) SoundBuffer::SoundBuffer(const void* data, std::size_t sizeInBytes) { if (!loadFromMemory(data, sizeInBytes)) - throw sf::Exception("Failed to open sound buffer from memory"); + throw Exception("Failed to open sound buffer from memory"); } @@ -60,7 +60,7 @@ SoundBuffer::SoundBuffer(const void* data, std::size_t sizeInBytes) SoundBuffer::SoundBuffer(InputStream& stream) { if (!loadFromStream(stream)) - throw sf::Exception("Failed to open sound buffer from stream"); + throw Exception("Failed to open sound buffer from stream"); } @@ -72,7 +72,7 @@ SoundBuffer::SoundBuffer(const std::int16_t* samples, const std::vector& channelMap) { if (!loadFromSamples(samples, sampleCount, channelCount, sampleRate, channelMap)) - throw sf::Exception("Failed to open sound buffer from samples"); + throw Exception("Failed to open sound buffer from samples"); } diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index 8d7219f03..798febf34 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -116,7 +116,7 @@ Image::Image(Vector2u size, const std::uint8_t* pixels) Image::Image(const std::filesystem::path& filename) { if (!loadFromFile(filename)) - throw sf::Exception("Failed to open image from file"); + throw Exception("Failed to open image from file"); } @@ -124,7 +124,7 @@ Image::Image(const std::filesystem::path& filename) Image::Image(const void* data, std::size_t size) { if (!loadFromMemory(data, size)) - throw sf::Exception("Failed to open image from memory"); + throw Exception("Failed to open image from memory"); } @@ -132,7 +132,7 @@ Image::Image(const void* data, std::size_t size) Image::Image(InputStream& stream) { if (!loadFromStream(stream)) - throw sf::Exception("Failed to open image from stream"); + throw Exception("Failed to open image from stream"); } diff --git a/src/SFML/Graphics/RenderTexture.cpp b/src/SFML/Graphics/RenderTexture.cpp index 655fce32c..5b7a6a326 100644 --- a/src/SFML/Graphics/RenderTexture.cpp +++ b/src/SFML/Graphics/RenderTexture.cpp @@ -48,7 +48,7 @@ RenderTexture::RenderTexture() = default; RenderTexture::RenderTexture(Vector2u size, const ContextSettings& settings) { if (!resize(size, settings)) - throw sf::Exception("Failed to create render texture"); + throw Exception("Failed to create render texture"); } diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 596d22007..2968b9505 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -228,7 +228,7 @@ struct Shader::UniformBinder Shader::Shader(const std::filesystem::path& filename, Type type) { if (!loadFromFile(filename, type)) - throw sf::Exception("Failed to load shader from file"); + throw Exception("Failed to load shader from file"); } @@ -236,7 +236,7 @@ Shader::Shader(const std::filesystem::path& filename, Type type) Shader::Shader(const std::filesystem::path& vertexShaderFilename, const std::filesystem::path& fragmentShaderFilename) { if (!loadFromFile(vertexShaderFilename, fragmentShaderFilename)) - throw sf::Exception("Failed to load shader from files"); + throw Exception("Failed to load shader from files"); } @@ -246,7 +246,7 @@ Shader::Shader(const std::filesystem::path& vertexShaderFilename, const std::filesystem::path& fragmentShaderFilename) { if (!loadFromFile(vertexShaderFilename, geometryShaderFilename, fragmentShaderFilename)) - throw sf::Exception("Failed to load shader from files"); + throw Exception("Failed to load shader from files"); } @@ -254,7 +254,7 @@ Shader::Shader(const std::filesystem::path& vertexShaderFilename, Shader::Shader(std::string_view shader, Type type) { if (!loadFromMemory(shader, type)) - throw sf::Exception("Failed to load shader from memory"); + throw Exception("Failed to load shader from memory"); } @@ -262,7 +262,7 @@ Shader::Shader(std::string_view shader, Type type) Shader::Shader(std::string_view vertexShader, std::string_view fragmentShader) { if (!loadFromMemory(vertexShader, fragmentShader)) - throw sf::Exception("Failed to load shader from memory"); + throw Exception("Failed to load shader from memory"); } @@ -270,7 +270,7 @@ Shader::Shader(std::string_view vertexShader, std::string_view fragmentShader) Shader::Shader(std::string_view vertexShader, std::string_view geometryShader, std::string_view fragmentShader) { if (!loadFromMemory(vertexShader, geometryShader, fragmentShader)) - throw sf::Exception("Failed to load shader from memory"); + throw Exception("Failed to load shader from memory"); } @@ -278,7 +278,7 @@ Shader::Shader(std::string_view vertexShader, std::string_view geometryShader, s Shader::Shader(InputStream& stream, Type type) { if (!loadFromStream(stream, type)) - throw sf::Exception("Failed to load shader from stream"); + throw Exception("Failed to load shader from stream"); } @@ -286,7 +286,7 @@ Shader::Shader(InputStream& stream, Type type) Shader::Shader(InputStream& vertexShaderStream, InputStream& fragmentShaderStream) { if (!loadFromStream(vertexShaderStream, fragmentShaderStream)) - throw sf::Exception("Failed to load shader from streams"); + throw Exception("Failed to load shader from streams"); } @@ -294,7 +294,7 @@ Shader::Shader(InputStream& vertexShaderStream, InputStream& fragmentShaderStrea Shader::Shader(InputStream& vertexShaderStream, InputStream& geometryShaderStream, InputStream& fragmentShaderStream) { if (!loadFromStream(vertexShaderStream, geometryShaderStream, fragmentShaderStream)) - throw sf::Exception("Failed to load shader from streams"); + throw Exception("Failed to load shader from streams"); } @@ -998,7 +998,7 @@ namespace sf //////////////////////////////////////////////////////////// Shader::Shader(const std::filesystem::path& /* filename */, Type /* type */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } @@ -1006,7 +1006,7 @@ Shader::Shader(const std::filesystem::path& /* filename */, Type /* type */) Shader::Shader(const std::filesystem::path& /* vertexShaderFilename */, const std::filesystem::path& /* fragmentShaderFilename */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } @@ -1015,42 +1015,42 @@ Shader::Shader(const std::filesystem::path& /* vertexShaderFilename */, const std::filesystem::path& /* geometryShaderFilename */, const std::filesystem::path& /* fragmentShaderFilename */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } //////////////////////////////////////////////////////////// Shader::Shader(std::string_view /* shader */, Type /* type */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } //////////////////////////////////////////////////////////// Shader::Shader(std::string_view /* vertexShader */, std::string_view /* fragmentShader */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } //////////////////////////////////////////////////////////// Shader::Shader(std::string_view /* vertexShader */, std::string_view /* geometryShader */, std::string_view /* fragmentShader */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } //////////////////////////////////////////////////////////// Shader::Shader(InputStream& /* stream */, Type /* type */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } //////////////////////////////////////////////////////////// Shader::Shader(InputStream& /* vertexShaderStream */, InputStream& /* fragmentShaderStream */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } @@ -1059,7 +1059,7 @@ Shader::Shader(InputStream& /* vertexShaderStream */, InputStream& /* geometryShaderStream */, InputStream& /* fragmentShaderStream */) { - throw sf::Exception("Shaders are not supported with OpenGL ES 1"); + throw Exception("Shaders are not supported with OpenGL ES 1"); } diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index 6e0bcbf69..2fb14d06a 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -76,7 +76,7 @@ Texture::Texture() : m_cacheId(TextureImpl::getUniqueId()) Texture::Texture(const std::filesystem::path& filename, bool sRgb) : Texture() { if (!loadFromFile(filename, sRgb)) - throw sf::Exception("Failed to load texture from file"); + throw Exception("Failed to load texture from file"); } @@ -84,7 +84,7 @@ Texture::Texture(const std::filesystem::path& filename, bool sRgb) : Texture() Texture::Texture(const std::filesystem::path& filename, bool sRgb, const IntRect& area) : Texture() { if (!loadFromFile(filename, sRgb, area)) - throw sf::Exception("Failed to load texture from file"); + throw Exception("Failed to load texture from file"); } @@ -92,7 +92,7 @@ Texture::Texture(const std::filesystem::path& filename, bool sRgb, const IntRect Texture::Texture(const void* data, std::size_t size, bool sRgb) : Texture() { if (!loadFromMemory(data, size, sRgb)) - throw sf::Exception("Failed to load texture from memory"); + throw Exception("Failed to load texture from memory"); } @@ -100,7 +100,7 @@ Texture::Texture(const void* data, std::size_t size, bool sRgb) : Texture() Texture::Texture(const void* data, std::size_t size, bool sRgb, const IntRect& area) : Texture() { if (!loadFromMemory(data, size, sRgb, area)) - throw sf::Exception("Failed to load texture from memory"); + throw Exception("Failed to load texture from memory"); } @@ -108,7 +108,7 @@ Texture::Texture(const void* data, std::size_t size, bool sRgb, const IntRect& a Texture::Texture(InputStream& stream, bool sRgb) : Texture() { if (!loadFromStream(stream, sRgb)) - throw sf::Exception("Failed to load texture from stream"); + throw Exception("Failed to load texture from stream"); } @@ -116,7 +116,7 @@ Texture::Texture(InputStream& stream, bool sRgb) : Texture() Texture::Texture(InputStream& stream, bool sRgb, const IntRect& area) : Texture() { if (!loadFromStream(stream, sRgb, area)) - throw sf::Exception("Failed to load texture from stream"); + throw Exception("Failed to load texture from stream"); } @@ -124,7 +124,7 @@ Texture::Texture(InputStream& stream, bool sRgb, const IntRect& area) : Texture( Texture::Texture(const Image& image, bool sRgb) : Texture() { if (!loadFromImage(image, sRgb)) - throw sf::Exception("Failed to load texture from image"); + throw Exception("Failed to load texture from image"); } @@ -132,7 +132,7 @@ Texture::Texture(const Image& image, bool sRgb) : Texture() Texture::Texture(const Image& image, bool sRgb, const IntRect& area) : Texture() { if (!loadFromImage(image, sRgb, area)) - throw sf::Exception("Failed to load texture from image"); + throw Exception("Failed to load texture from image"); } @@ -140,7 +140,7 @@ Texture::Texture(const Image& image, bool sRgb, const IntRect& area) : Texture() Texture::Texture(Vector2u size, bool sRgb) : Texture() { if (!resize(size, sRgb)) - throw sf::Exception("Failed to create texture"); + throw Exception("Failed to create texture"); } diff --git a/src/SFML/System/FileInputStream.cpp b/src/SFML/System/FileInputStream.cpp index 6cec6e7ad..cda2efa6d 100644 --- a/src/SFML/System/FileInputStream.cpp +++ b/src/SFML/System/FileInputStream.cpp @@ -53,7 +53,7 @@ FileInputStream::FileInputStream() = default; FileInputStream::FileInputStream(const std::filesystem::path& filename) { if (!open(filename)) - throw sf::Exception("Failed to open file input stream"); + throw Exception("Failed to open file input stream"); } diff --git a/src/SFML/Window/Cursor.cpp b/src/SFML/Window/Cursor.cpp index 944777c92..8c41395f3 100644 --- a/src/SFML/Window/Cursor.cpp +++ b/src/SFML/Window/Cursor.cpp @@ -48,10 +48,10 @@ Cursor::Cursor() : m_impl(std::make_unique()) Cursor::Cursor(const std::uint8_t* pixels, Vector2u size, Vector2u hotspot) : Cursor() { if ((pixels == nullptr) || (size.x == 0) || (size.y == 0)) - throw sf::Exception("Failed to create cursor from pixels (invalid arguments)"); + throw Exception("Failed to create cursor from pixels (invalid arguments)"); if (!m_impl->loadFromPixels(pixels, size, hotspot)) - throw sf::Exception("Failed to create cursor from pixels"); + throw Exception("Failed to create cursor from pixels"); } @@ -59,7 +59,7 @@ Cursor::Cursor(const std::uint8_t* pixels, Vector2u size, Vector2u hotspot) : Cu Cursor::Cursor(Type type) : Cursor() { if (!m_impl->loadFromSystem(type)) - throw sf::Exception("Failed to create cursor from type"); + throw Exception("Failed to create cursor from type"); }