24 #ifndef NDN_ENCODING_BLOCK_HPP 25 #define NDN_ENCODING_BLOCK_HPP 52 using tlv::Error::Error;
67 operator=(
const Block&);
76 operator=(
Block&&) noexcept;
103 bool verifyLength =
true);
113 Block(
const Block& block, Buffer::const_iterator begin, Buffer::const_iterator end,
114 bool verifyLength =
true);
125 Buffer::const_iterator begin, Buffer::const_iterator end,
126 Buffer::const_iterator valueBegin, Buffer::const_iterator valueEnd);
134 Block(
const uint8_t* buf,
size_t bufSize);
140 Block(uint32_t type);
159 fromStream(std::istream& is);
167 static std::tuple<bool, Block>
177 static std::tuple<bool, Block>
178 fromBuffer(
const uint8_t* buf,
size_t bufSize);
189 return m_type == std::numeric_limits<uint32_t>::max();
216 Buffer::const_iterator
222 Buffer::const_iterator
239 shared_ptr<const Buffer>
262 return m_buffer !=
nullptr;
268 Buffer::const_iterator
277 Buffer::const_iterator
294 blockFromValue()
const;
318 get(uint32_t type)
const;
325 find(uint32_t type)
const;
332 remove(uint32_t type);
347 push_back(
const Block& element);
371 return m_elements.begin();
379 return m_elements.end();
387 return m_elements.size();
393 operator boost::asio::const_buffer()
const;
429 uint32_t m_type = std::numeric_limits<uint32_t>::max();
457 Block::Block(
Block&&) noexcept = default;
465 operator==(const
Block& lhs, const
Block& rhs);
470 return !(lhs == rhs);
487 operator "" _block(
const char* input, std::size_t len);
491 #endif // NDN_ENCODING_BLOCK_HPP
shared_ptr< const Buffer > m_buffer
underlying buffer storing TLV-VALUE and possibly TLV-TYPE and TLV-LENGTH fields
bool empty() const
Check if the Block is empty.
bool hasValue() const
Get begin iterator of TLV-VALUE.
const element_container & elements() const
Get container of sub elements.
Buffer::const_iterator m_valueBegin
Buffer::const_iterator m_begin
std::ostream & operator<<(std::ostream &os, const Data &data)
element_container::const_iterator element_const_iterator
element_container m_elements
sub elements
Represents a TLV element of NDN packet format.
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
Buffer::const_iterator m_valueEnd
element_container::iterator element_iterator
size_t elements_size() const
Equivalent to elements().size()
uint32_t type() const
Get TLV-TYPE.
CFReleaser< CFStringRef > fromBuffer(const uint8_t *buf, size_t buflen)
Create a CFString by copying bytes from a raw buffer.
static std::tuple< bool, const uint8_t *, size_t, const uint8_t *, size_t > parse(const Data &data)
Buffer::const_iterator m_end
shared_ptr< const Buffer > getBuffer() const
Get underlying buffer.
element_const_iterator elements_end() const
Equivalent to elements().end()
element_const_iterator elements_begin() const
Equivalent to elements().begin()
std::vector< Block > element_container
EncodingImpl< EncoderTag > EncodingBuffer
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator
shared_ptr< const Buffer > ConstBufferPtr