22 #ifndef NDN_CXX_NAME_COMPONENT_HPP
23 #define NDN_CXX_NAME_COMPONENT_HPP
163 Component(uint32_t type, span<const uint8_t> value);
182 template<
class Iterator>
191 template<
class Iterator>
209 template<encoding::Tag TAG>
223 wireDecode(
const Block& wire);
231 fromUri(std::string_view input);
233 [[deprecated(
"use fromUri")]]
260 isNumber() const noexcept;
268 isNumberWithMarker(uint8_t marker) const noexcept;
275 isSegment() const noexcept;
282 isByteOffset() const noexcept;
289 isVersion() const noexcept;
296 isTimestamp() const noexcept;
303 isSequenceNumber() const noexcept;
325 toNumberWithMarker(uint8_t marker) const;
341 toByteOffset() const;
356 time::system_clock::time_point
365 toSequenceNumber() const;
396 fromNumberWithMarker(uint8_t marker, uint64_t number);
403 fromSegment(uint64_t segmentNo);
410 fromByteOffset(uint64_t offset);
417 fromVersion(uint64_t version);
424 fromTimestamp(const time::system_clock::time_point& timePoint);
431 fromSequenceNumber(uint64_t seqNo);
439 isGeneric() const noexcept
450 isImplicitSha256Digest() const noexcept;
458 isParametersSha256Digest() const noexcept;
465 isKeyword() const noexcept
474 return value_size() == 0;
516 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.
static Component fromEscapedString(std::string_view input)
static Component fromUri(std::string_view input)
Construct a NameComponent from its string representation in NDN URI format.
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.
Error(const char *expectedType, uint32_t actualType)
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
Block makeBinaryBlock(uint32_t type, span< const uint8_t > value)
Create a TLV block copying the TLV-VALUE from a byte range.
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