From 8c776f33c1a1b19c9753777b49cc9d8ab53cfdc1 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Wed, 4 Apr 2012 22:33:53 +0200 Subject: [PATCH] Private virtual functions are now protected, so that sub-classes can call them if necessary (and they appear in the API doc :) --- include/SFML/Audio/SoundBufferRecorder.hpp | 4 ++- include/SFML/Audio/SoundRecorder.hpp | 4 +-- include/SFML/Audio/SoundStream.hpp | 22 ++++++------ include/SFML/Graphics/Drawable.hpp | 2 +- include/SFML/Graphics/RenderWindow.hpp | 4 ++- include/SFML/Network/Packet.hpp | 42 +++++++++++----------- include/SFML/Window/Window.hpp | 4 ++- src/SFML/Window/Linux/WindowImplX11.hpp | 16 ++++----- src/SFML/Window/Win32/WindowImplWin32.hpp | 16 ++++----- src/SFML/Window/WindowImpl.hpp | 12 +++---- 10 files changed, 67 insertions(+), 59 deletions(-) diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp index af43fbf7..eb7b7cb0 100644 --- a/include/SFML/Audio/SoundBufferRecorder.hpp +++ b/include/SFML/Audio/SoundBufferRecorder.hpp @@ -58,7 +58,7 @@ public : //////////////////////////////////////////////////////////// const SoundBuffer& getBuffer() const; -private : +protected: //////////////////////////////////////////////////////////// /// \brief Start capturing audio data @@ -85,6 +85,8 @@ private : //////////////////////////////////////////////////////////// virtual void onStop(); +private : + //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp index c6130600..5edba901 100644 --- a/include/SFML/Audio/SoundRecorder.hpp +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -109,8 +109,6 @@ protected : //////////////////////////////////////////////////////////// SoundRecorder(); -private : - //////////////////////////////////////////////////////////// /// \brief Start capturing audio data /// @@ -151,6 +149,8 @@ private : //////////////////////////////////////////////////////////// virtual void onStop(); +private : + //////////////////////////////////////////////////////////// /// \brief Function called as the entry point of the thread /// diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp index e4c2f2b1..04a70158 100644 --- a/include/SFML/Audio/SoundStream.hpp +++ b/include/SFML/Audio/SoundStream.hpp @@ -201,17 +201,6 @@ protected : //////////////////////////////////////////////////////////// void initialize(unsigned int channelCount, unsigned int sampleRate); -private : - - //////////////////////////////////////////////////////////// - /// \brief Function called as the entry point of the thread - /// - /// This function starts the streaming loop, and returns - /// only when the sound is stopped. - /// - //////////////////////////////////////////////////////////// - void streamData(); - //////////////////////////////////////////////////////////// /// \brief Request a new chunk of audio samples from the stream source /// @@ -239,6 +228,17 @@ private : //////////////////////////////////////////////////////////// virtual void onSeek(Time timeOffset) = 0; +private : + + //////////////////////////////////////////////////////////// + /// \brief Function called as the entry point of the thread + /// + /// This function starts the streaming loop, and returns + /// only when the sound is stopped. + /// + //////////////////////////////////////////////////////////// + void streamData(); + //////////////////////////////////////////////////////////// /// \brief Fill a new buffer with audio samples, and append /// it to the playing queue diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp index 12ed77aa..b5e5f0af 100644 --- a/include/SFML/Graphics/Drawable.hpp +++ b/include/SFML/Graphics/Drawable.hpp @@ -51,7 +51,7 @@ public : //////////////////////////////////////////////////////////// virtual ~Drawable() {} -private : +protected : friend class RenderTarget; diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index 0d75c3ee..9db11ac4 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -127,7 +127,7 @@ public : //////////////////////////////////////////////////////////// Image capture() const; -private : +protected: //////////////////////////////////////////////////////////// /// \brief Function called after the window has been created @@ -148,6 +148,8 @@ private : //////////////////////////////////////////////////////////// virtual void onResize(); +private : + //////////////////////////////////////////////////////////// /// \brief Activate the target for rendering /// diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index c8684414..69f5c57d 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -208,30 +208,11 @@ public: Packet& operator <<(const std::wstring& data); Packet& operator <<(const String& data); -private : +protected: friend class TcpSocket; friend class UdpSocket; - //////////////////////////////////////////////////////////// - /// Disallow comparisons between packets - /// - //////////////////////////////////////////////////////////// - bool operator ==(const Packet& right) const; - bool operator !=(const Packet& right) const; - - //////////////////////////////////////////////////////////// - /// \brief Check if the packet can extract a given number of bytes - /// - /// This function updates accordingly the state of the packet. - /// - /// \param size Size to check - /// - /// \return True if \a size bytes can be read from the packet - /// - //////////////////////////////////////////////////////////// - bool checkSize(std::size_t size); - //////////////////////////////////////////////////////////// /// \brief Called before the packet is sent over the network /// @@ -271,6 +252,27 @@ private : //////////////////////////////////////////////////////////// virtual void onReceive(const void* data, std::size_t size); +private : + + //////////////////////////////////////////////////////////// + /// Disallow comparisons between packets + /// + //////////////////////////////////////////////////////////// + bool operator ==(const Packet& right) const; + bool operator !=(const Packet& right) const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the packet can extract a given number of bytes + /// + /// This function updates accordingly the state of the packet. + /// + /// \param size Size to check + /// + /// \return True if \a size bytes can be read from the packet + /// + //////////////////////////////////////////////////////////// + bool checkSize(std::size_t size); + //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index 23ffa332..9921aa1e 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -423,7 +423,7 @@ public : //////////////////////////////////////////////////////////// WindowHandle getSystemHandle() const; -private : +protected : //////////////////////////////////////////////////////////// /// \brief Function called after the window has been created @@ -444,6 +444,8 @@ private : //////////////////////////////////////////////////////////// virtual void onResize(); +private: + //////////////////////////////////////////////////////////// /// \brief Processes an event before it is sent to the user /// diff --git a/src/SFML/Window/Linux/WindowImplX11.hpp b/src/SFML/Window/Linux/WindowImplX11.hpp index 1d53a9c3..d57177fd 100644 --- a/src/SFML/Window/Linux/WindowImplX11.hpp +++ b/src/SFML/Window/Linux/WindowImplX11.hpp @@ -81,8 +81,6 @@ public : //////////////////////////////////////////////////////////// ::Display* getDisplay() const; -private : - //////////////////////////////////////////////////////////// /// \brief Get the OS-specific handle of the window /// @@ -91,12 +89,6 @@ private : //////////////////////////////////////////////////////////// virtual WindowHandle getSystemHandle() const; - //////////////////////////////////////////////////////////// - /// \brief Process incoming events from the operating system - /// - //////////////////////////////////////////////////////////// - virtual void processEvents(); - //////////////////////////////////////////////////////////// /// \brief Get the position of the window /// @@ -171,6 +163,14 @@ private : //////////////////////////////////////////////////////////// virtual void setKeyRepeatEnabled(bool enabled); +protected : + + //////////////////////////////////////////////////////////// + /// \brief Process incoming events from the operating system + /// + //////////////////////////////////////////////////////////// + virtual void processEvents(); + private : //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp index a86da89a..542c57dc 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.hpp +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp @@ -70,8 +70,6 @@ public : //////////////////////////////////////////////////////////// ~WindowImplWin32(); -private : - //////////////////////////////////////////////////////////// /// \brief Get the OS-specific handle of the window /// @@ -80,12 +78,6 @@ private : //////////////////////////////////////////////////////////// virtual WindowHandle getSystemHandle() const; - //////////////////////////////////////////////////////////// - /// \brief Process incoming events from the operating system - /// - //////////////////////////////////////////////////////////// - virtual void processEvents(); - //////////////////////////////////////////////////////////// /// \brief Get the position of the window /// @@ -160,6 +152,14 @@ private : //////////////////////////////////////////////////////////// virtual void setKeyRepeatEnabled(bool enabled); +protected: + + //////////////////////////////////////////////////////////// + /// \brief Process incoming events from the operating system + /// + //////////////////////////////////////////////////////////// + virtual void processEvents(); + private : //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp index 81067f4d..d60960f3 100644 --- a/src/SFML/Window/WindowImpl.hpp +++ b/src/SFML/Window/WindowImpl.hpp @@ -211,6 +211,12 @@ protected : //////////////////////////////////////////////////////////// void pushEvent(const Event& event); + //////////////////////////////////////////////////////////// + /// \brief Process incoming events from the operating system + /// + //////////////////////////////////////////////////////////// + virtual void processEvents() = 0; + private : //////////////////////////////////////////////////////////// @@ -219,12 +225,6 @@ private : //////////////////////////////////////////////////////////// void processJoystickEvents(); - //////////////////////////////////////////////////////////// - /// \brief Process incoming events from the operating system - /// - //////////////////////////////////////////////////////////// - virtual void processEvents() = 0; - //////////////////////////////////////////////////////////// // Member data ////////////////////////////////////////////////////////////