From 09c2dafba51e742d6170dc29b43bcc277895a9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sun, 4 Dec 2016 14:30:13 +0100 Subject: [PATCH] added a length() method for checking message length --- chat_messages.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chat_messages.hpp b/chat_messages.hpp index 4ebe687..ee9dd27 100644 --- a/chat_messages.hpp +++ b/chat_messages.hpp @@ -36,6 +36,9 @@ namespace chat std::string get_content() const { return _content; } + + size_t length() const + { return sizeof(char) + _content.size() + sizeof(char); } }; std::ostream& operator<<(std::ostream& os, const chat_message& msg)