diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index 6d48e520..b4cf5d2e 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -72,10 +72,21 @@ public: /// \param sizeInBytes Number of bytes to append /// /// \see clear + /// \see readCurrentReadPosition /// //////////////////////////////////////////////////////////// void append(const void* data, std::size_t sizeInBytes); + //////////////////////////////////////////////////////////// + /// \brief Get a current reading position + /// + /// \return Current position + /// + /// \see append + /// + //////////////////////////////////////////////////////////// + std::size_t getReadPosition() const; + //////////////////////////////////////////////////////////// /// \brief Clear the packet /// diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index ac039412..2cb85bdb 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -63,6 +63,13 @@ void Packet::append(const void* data, std::size_t sizeInBytes) } +//////////////////////////////////////////////////////////// +std::size_t Packet::getReadPosition() const +{ + return m_readPos; +} + + //////////////////////////////////////////////////////////// void Packet::clear() {