25 #ifndef SER4CPP_RSEQ_H 26 #define SER4CPP_RSEQ_H 28 #include "ser4cpp/container/HasLength.h" 29 #include "ser4cpp/util/Comparisons.h" 47 static_assert(std::numeric_limits<L>::is_integer&& !std::numeric_limits<L>::is_signed,
"Must be an unsigned integer");
52 return RSeq(
nullptr, 0);
58 RSeq(uint8_t
const* buffer, L length) :
65 this->buffer_ =
nullptr;
69 RSeq take(L count)
const 71 return RSeq(this->buffer_, (count < this->length()) ? count : this->length());
74 RSeq skip(L count)
const 76 auto num = ser4cpp::min(this->length(), count);
77 return RSeq(this->buffer_ + num, this->length() - num);
82 auto num = ser4cpp::min(this->length(), count);
84 this->m_length -= num;
87 operator uint8_t
const* ()
const 92 bool equals(
const RSeq& rhs)
const 94 if (this->m_length == rhs.m_length)
96 return memcmp(this->buffer_, rhs.buffer_, this->m_length) == 0;
105 uint8_t
const* buffer_ =
nullptr;
ser4cpp header-only library namespace