24 #ifndef NDN_CXX_ENCODING_BLOCK_HPP 25 #define NDN_CXX_ENCODING_BLOCK_HPP 52 using tlv::Error::Error;
68 operator=(
const Block&);
77 operator=(
Block&&) noexcept;
104 bool verifyLength =
true);
114 Block(
const Block& block, Buffer::const_iterator begin, Buffer::const_iterator end,
115 bool verifyLength =
true);
126 Buffer::const_iterator begin, Buffer::const_iterator end,
127 Buffer::const_iterator valueBegin, Buffer::const_iterator valueEnd);
135 Block(
const uint8_t* buf,
size_t bufSize);
141 Block(uint32_t type);
160 fromStream(std::istream& is);
179 fromBuffer(
const uint8_t* buf,
size_t bufSize);
209 resetWire() noexcept;
219 return m_buffer !=
nullptr && m_begin != m_end;
225 Buffer::const_iterator
231 Buffer::const_iterator
276 return m_buffer !=
nullptr;
282 Buffer::const_iterator
291 Buffer::const_iterator
301 value()
const noexcept;
307 value_size()
const noexcept;
310 blockFromValue()
const;
334 get(uint32_t type)
const;
342 find(uint32_t type)
const;
349 remove(uint32_t type);
364 push_back(
const Block& element);
388 return m_elements.begin();
396 return m_elements.end();
404 return m_elements.size();
410 operator boost::asio::const_buffer()
const;
474 Block::Block(
Block&&) noexcept = default;
482 operator==(const
Block& lhs, const
Block& rhs);
487 return !(lhs == rhs);
504 operator "" _block(
const char* input, std::size_t len);
508 #endif // NDN_CXX_ENCODING_BLOCK_HPP
shared_ptr< const Buffer > m_buffer
Underlying buffer storing TLV-VALUE and possibly TLV-TYPE and TLV-LENGTH fields.
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
Contains the sub-elements.
Represents a TLV element of the NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
element_const_iterator elements_begin() const
Equivalent to elements().begin()
const element_container & elements() const
Get container of sub-elements.
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
Buffer::const_iterator m_valueEnd
ConstBufferPtr getBuffer() const
Get underlying buffer.
element_const_iterator elements_end() const
Equivalent to elements().end()
#define NDN_CXX_NODISCARD
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
element_container::iterator element_iterator
size_t elements_size() const
Equivalent to elements().size()
CFReleaser< CFStringRef > fromBuffer(const uint8_t *buf, size_t buflen)
Create a CFString by copying bytes from a raw buffer.
bool isValid() const noexcept
Check if the Block is valid.
bool hasValue() const noexcept
Check if the Block has a non-empty TLV-VALUE.
Buffer::const_iterator m_end
static ParseResult parse(const Data &data)
std::vector< Block > element_container
EncodingImpl< EncoderTag > EncodingBuffer
uint32_t type() const
Return the TLV-TYPE of the Block.
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator
shared_ptr< const Buffer > ConstBufferPtr