1#ifndef NDNPH_TLV_VALUE_HPP
2#define NDNPH_TLV_VALUE_HPP
14 return Value(
reinterpret_cast<const uint8_t*
>(str), std::strlen(str));
25 explicit Value(
const uint8_t* first,
const uint8_t* last)
27 , m_size(last - first) {}
25 explicit Value(
const uint8_t* first,
const uint8_t* last) {
…}
34 explicit operator bool()
const {
34 explicit operator bool()
const {
…}
42 const uint8_t*
end()
const {
43 return m_value + m_size;
42 const uint8_t*
end()
const {
…}
52 if (room !=
nullptr) {
53 std::copy_n(m_value, m_size, room);
65 return Decoder(m_value, m_size);
74 uint8_t* copyV = region.
alloc(m_size);
75 if (copyV ==
nullptr) {
79 return Value(copyV, m_size);
83 const uint8_t* m_value =
nullptr;
Decoded TLV.
Definition decoder.hpp:13
size_t length
Definition decoder.hpp:39
const uint8_t * value
Definition decoder.hpp:40
TLV decoder.
Definition decoder.hpp:10
TLV encoder that accepts items in reverse order.
Definition encoder.hpp:10
uint8_t * prependRoom(size_t size)
Make room to prepend an object.
Definition encoder.hpp:90
Region-based memory allocator thats owns memory of NDNph objects.
Definition region.hpp:9
uint8_t * alloc(size_t size)
Allocate a buffer with no alignment requirement.
Definition region.hpp:27
A sequence of bytes, usually TLV-VALUE.
Definition value.hpp:11
const uint8_t * end() const
Definition value.hpp:42
Value(const Encoder &encoder)
Reference encoder output.
Definition value.hpp:30
Value(const uint8_t *first, const uint8_t *last)
Reference a byte range.
Definition value.hpp:25
Value clone(Region ®ion) const
Clone buffer into given region.
Definition value.hpp:73
Decoder makeDecoder() const
Create a Decoder over this value buffer.
Definition value.hpp:64
const uint8_t * begin() const
Definition value.hpp:38
bool decodeFrom(const Decoder::Tlv &d)
Definition value.hpp:57
static Value fromString(const char *str)
Definition value.hpp:13
Value(const uint8_t *value, size_t size)
Reference a byte range.
Definition value.hpp:20
void encodeTo(Encoder &encoder) const
Definition value.hpp:50
size_t size() const
Definition value.hpp:46
bool operator==(const Value &lhs, const Value &rhs)
Definition value.hpp:88
#define NDNPH_DECLARE_NE(T, specifier)
Declare operator!= in terms of operator==.
Definition operators.hpp:7