operator<< for VarInt
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
namespace sp {
|
||||
|
||||
@@ -55,6 +56,11 @@ class VarInt {
|
||||
* \param var The variable integer to deserialize
|
||||
*/
|
||||
friend DataBuffer& operator>>(DataBuffer& in, VarInt& var);
|
||||
|
||||
/**
|
||||
* \brief overriding stream operator
|
||||
*/
|
||||
friend std::ostream& operator<<(std::ostream& a_Stream, const sp::VarInt& a_VarInt);
|
||||
};
|
||||
|
||||
} // namespace sp
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <sp/common/VarInt.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sp/common/DataBuffer.h>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace sp {
|
||||
|
||||
@@ -49,4 +49,9 @@ DataBuffer& operator>>(DataBuffer& in, VarInt& var) {
|
||||
return in;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& a_Stream, const sp::VarInt& a_VarInt) {
|
||||
a_Stream << a_VarInt.GetValue();
|
||||
return a_Stream;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
|
||||
Reference in New Issue
Block a user