From 632a015663487181ea817731779c2b225937eaa0 Mon Sep 17 00:00:00 2001 From: Michal Marszalek <1aam2am1@gmail.com> Date: Sat, 10 Mar 2018 19:20:04 +0100 Subject: [PATCH] Added readCurrentReadPosition in sf::Packet --- include/SFML/Network/Packet.hpp | 11 +++++++++++ src/SFML/Network/Packet.cpp | 7 +++++++ 2 files changed, 18 insertions(+) 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() {