22 #ifndef NDN_CXX_NAME_COMPONENT_HPP
23 #define NDN_CXX_NAME_COMPONENT_HPP
162 Component(uint32_t type, span<const uint8_t> value);
178 [[deprecated(
"use the constructor that takes a span<>")]]
179 Component(uint32_t type,
const uint8_t* value,
size_t count)
188 [[deprecated(
"use the constructor that takes a span<>")]]
202 template<
class Iterator>
211 template<
class Iterator>
237 template<encoding::Tag TAG>
251 wireDecode(
const Block& wire);
263 return fromEscapedString(std::string(input + beginOffset, input + endOffset));
273 return fromEscapedString(std::string(input));
281 fromEscapedString(
const std::string& input);
303 isNumber() const noexcept;
311 isNumberWithMarker(uint8_t marker) const noexcept;
318 isSegment() const noexcept;
325 isByteOffset() const noexcept;
332 isVersion() const noexcept;
339 isTimestamp() const noexcept;
346 isSequenceNumber() const noexcept;
368 toNumberWithMarker(uint8_t marker) const;
384 toByteOffset() const;
399 time::system_clock::time_point
408 toSequenceNumber() const;
439 fromNumberWithMarker(uint8_t marker, uint64_t number);
446 fromSegment(uint64_t segmentNo);
453 fromByteOffset(uint64_t offset);
460 fromVersion(uint64_t version);
467 fromTimestamp(const time::system_clock::time_point& timePoint);
474 fromSequenceNumber(uint64_t seqNo);
482 isGeneric() const noexcept
493 isImplicitSha256Digest() const noexcept;
499 [[deprecated("use one of the name::
Component constructors")]]
507 [[deprecated("use one of the name::
Component constructors")]]
509 fromImplicitSha256Digest(span<const uint8_t> digest);
517 isParametersSha256Digest() const noexcept;
523 [[deprecated("use one of the name::
Component constructors")]]
531 [[deprecated("use one of the name::
Component constructors")]]
533 fromParametersSha256Digest(span<const uint8_t> digest);
540 isKeyword() const noexcept
549 return value_size() == 0;
559 equals(
const Component& other)
const noexcept;
600 getSuccessor()
const;
616 return lhs.equals(rhs);
622 return !lhs.equals(rhs);
#define NDN_CXX_NODISCARD
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(uint32_t type, const uint8_t *value, size_t count)
Construct a NameComponent of TLV-TYPE type, copying count bytes at value as TLV-VALUE.
friend bool operator!=(const Component &lhs, const Component &rhs) noexcept
static Component fromEscapedString(const char *input, size_t beginOffset, size_t endOffset)
Decode NameComponent from a URI component.
Component(const uint8_t *value, size_t count)
Construct a GenericNameComponent, copying count bytes at value as TLV-VALUE.
static Component fromEscapedString(const char *input)
Decode NameComponent from a URI component.
friend bool operator>(const Component &lhs, const Component &rhs)
friend bool operator>=(const Component &lhs, const Component &rhs)
friend bool operator==(const Component &lhs, const Component &rhs) noexcept
Component(Iterator first, Iterator last)
Construct a GenericNameComponent, copying TLV-VALUE from a range.
Component(span< const uint8_t > buffer)
Construct a GenericNameComponent, copying the TLV-VALUE from buffer.
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 TLV-VALUE from a range.
int compare(const Component &other) const
Compare this to the other Component 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.
shared_ptr< const Buffer > ConstBufferPtr
std::ostream & operator<<(std::ostream &os, const Data &data)