22#ifndef NDN_CXX_NAME_COMPONENT_HPP
23#define NDN_CXX_NAME_COMPONENT_HPP
118 using Block::Error::Error;
156 :
Component(tlv::GenericNameComponent,
std::move(buffer))
163 Component(uint32_t type, span<const uint8_t> value);
170 :
Component(tlv::GenericNameComponent, value)
182 template<
class Iterator>
184 :
Block(makeBinaryBlock(type, first, last))
191 template<
class Iterator>
193 :
Component(tlv::GenericNameComponent, first, last)
209 template<encoding::Tag TAG>
223 wireDecode(
const Block& wire);
231 fromUri(std::string_view input);
253 isNumber() const noexcept;
261 isNumberWithMarker(uint8_t marker) const noexcept;
268 isSegment() const noexcept;
275 isByteOffset() const noexcept;
282 isVersion() const noexcept;
289 isTimestamp() const noexcept;
296 isSequenceNumber() const noexcept;
318 toNumberWithMarker(uint8_t marker) const;
334 toByteOffset() const;
349 time::system_clock::time_point
358 toSequenceNumber() const;
369 fromNumber(uint64_t number, uint32_t type = tlv::GenericNameComponent);
389 fromNumberWithMarker(uint8_t marker, uint64_t number);
396 fromSegment(uint64_t segmentNo);
403 fromByteOffset(uint64_t offset);
410 fromVersion(uint64_t version);
417 fromTimestamp(const time::system_clock::time_point& timePoint);
424 fromSequenceNumber(uint64_t seqNo);
432 isGeneric() const noexcept
443 isImplicitSha256Digest() const noexcept;
451 isParametersSha256Digest() const noexcept;
458 isKeyword() const noexcept
467 return value_size() == 0;
509 getSuccessor()
const;
Represents a TLV element of the NDN packet format.
Represents a name component.
Component(ConstBufferPtr buffer)
Construct a GenericNameComponent, using TLV-VALUE from buffer.
Component(span< const uint8_t > value)
Construct a GenericNameComponent, copying the TLV-VALUE from value.
Component(Iterator first, Iterator last)
Construct a GenericNameComponent, copying the TLV-VALUE from a range.
void toUri(std::ostream &os, UriFormat format=UriFormat::DEFAULT) const
Write *this to the output stream, escaping characters according to the NDN URI format.
bool empty() const noexcept
Component(uint32_t type, Iterator first, Iterator last)
Construct a NameComponent of TLV-TYPE type, copying the TLV-VALUE from a range.
int compare(const Component &other) const
Compare this component to other using NDN canonical ordering.
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
Convention
Identify a style of NDN Naming Conventions.
@ MARKER
Component markers (revision 1)
@ TYPED
Typed name components (revision 3)
void setConventionDecoding(Convention convention)
Set which Naming Conventions style(s) to accept while decoding.
Convention getConventionEncoding() noexcept
Return which Naming Conventions style to use while encoding.
void setConventionEncoding(Convention convention)
Set which Naming Conventions style to use while encoding.
UriFormat
Format used for the URI representation of a name.
@ CANONICAL
Always use <type-number>=<percent-encoded-value> format.
@ DEFAULT
Use the library's default format; currently equivalent to UriFormat::ENV_OR_ALTERNATE.
@ ALTERNATE
Always prefer the alternate format when available.
@ ENV_OR_ALTERNATE
Same as UriFormat::ALTERNATE, unless NDN_NAME_ALT_URI environment variable is set to '0'.
@ ENV_OR_CANONICAL
Same as UriFormat::CANONICAL, unless NDN_NAME_ALT_URI environment variable is set to '1'.
Convention getConventionDecoding() noexcept
Return which Naming Conventions style(s) to accept while decoding.
std::ostream & operator<<(std::ostream &os, const Data &data)
std::shared_ptr< const Buffer > ConstBufferPtr