22 #ifndef NDN_CXX_NAME_HPP 23 #define NDN_CXX_NAME_HPP 85 Name(
const char* uri);
91 Name(std::string uri);
117 template<encoding::Tag TAG>
165 i +=
static_cast<ssize_t
>(
size());
200 getSubName(ssize_t iStartComponent,
size_t nComponents =
npos)
const;
259 set(ssize_t i,
const Component& component);
316 [[deprecated(
"use the overload that takes a span<>")]]
320 return append(type, make_span(value, count));
328 [[deprecated(
"use the overload that takes a span<>")]]
332 return append(make_span(value, count));
343 template<
class Iterator>
345 append(uint32_t type, Iterator first, Iterator last)
357 template<
class Iterator>
530 std::char_traits<char>::length(keyword)}));
640 compare(
size_t pos1,
size_t count1,
641 const Name& other,
size_t pos2 = 0,
size_t count2 =
npos)
const;
699 mutable Block m_wire;
723 #endif // NDN_CXX_NAME_HPP Name & appendImplicitSha256Digest(span< const uint8_t > digestBytes)
Append an ImplicitSha256Digest component.
friend bool operator==(const Name &lhs, const Name &rhs)
Name & appendByteOffset(uint64_t offset)
Append a byte offset component.
static Component fromSequenceNumber(uint64_t seqNo)
Create a sequence number component using NDN naming conventions.
friend bool operator>=(const Name &lhs, const Name &rhs)
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
Copyright (c) 2011-2015 Regents of the University of California.
Name & appendParametersSha256Digest(ConstBufferPtr digest)
Append a ParametersSha256Digest component.
bool equals(const Name &other) const
Check if this name equals another name.
static Component fromNumberWithMarker(uint8_t marker, uint64_t number)
Create a component encoded as NameComponentWithMarker.
const Block & wireEncode() const
Perform wire encoding, or return existing wire encoding.
UriFormat
Format used for the URI representation of a name.
const_iterator end() const
End iterator.
const Component & operator[](ssize_t i) const
Equivalent to get(i).
friend std::ostream & operator<<(std::ostream &os, const Name &name)
Print the URI representation of a name.
Name & appendImplicitSha256Digest(ConstBufferPtr digest)
Append an ImplicitSha256Digest component.
std::reverse_iterator< iterator > reverse_iterator
bool isPrefixOf(const Name &other) const
Check if this name is a prefix of another name.
friend bool operator<(const Name &lhs, const Name &rhs)
Name getSuccessor() const
Get the successor of a name.
const_reverse_iterator rend() const
Reverse end iterator.
static const size_t npos
Indicates "until the end" in getSubName() and compare().
friend bool operator>(const Name &lhs, const Name &rhs)
Represents a TLV element of the NDN packet format.
const_reverse_iterator rbegin() const
Reverse begin iterator.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
Name & append(Component &&component)
Append a component.
Name & appendNumber(uint64_t number)
Append a component with a NonNegativeInteger.
Name & append(const Component &component)
Append a component.
Name & append(span< const uint8_t > value)
Append a GenericNameComponent, copying the TLV-VALUE from value.
Name & appendVersion(const optional< uint64_t > &version=nullopt)
Append a version component.
friend bool operator!=(const Name &lhs, const Name &rhs)
const element_container & elements() const
Get container of sub-elements.
std::reverse_iterator< const_iterator > const_reverse_iterator
friend bool operator<=(const Name &lhs, const Name &rhs)
const Component & at(ssize_t i) const
Returns an immutable reference to the component at the specified index, with bounds checking...
static Component fromSegment(uint64_t segmentNo)
Create a segment number component using NDN naming conventions.
Use the library's default format; currently equivalent to UriFormat::ENV_OR_ALTERNATE.
int compare(const Name &other) const
Compare this to the other Name using NDN canonical ordering.
NDN_CXX_NODISCARD bool empty() const
Checks if the name is empty, i.e.
static Component fromByteOffset(uint64_t offset)
Create a byte offset component using NDN naming conventions.
#define NDN_CXX_NODISCARD
component_container::size_type size_type
Name & append(uint32_t type, Iterator first, Iterator last)
Append a NameComponent of TLV-TYPE type, copying TLV-VALUE from a range.
name::Component Component
Name & append(uint32_t type, span< const uint8_t > value)
Append a NameComponent of TLV-TYPE type, copying the TLV-VALUE from value.
Name & appendSequenceNumber(uint64_t seqNo)
Append a sequence number component.
std::istream & operator>>(std::istream &is, Name &name)
Parse URI from stream as Name.
Represents an absolute name.
void push_back(const Block &element)
Append a sub-element.
Name & append(Iterator first, Iterator last)
Append a GenericNameComponent, copying TLV-VALUE from a range.
size_t elements_size() const
Equivalent to elements().size()
Name & append(const uint8_t *value, size_t count)
Append a GenericNameComponent, copying count bytes at value as TLV-VALUE.
const_iterator begin() const
Begin iterator.
void push_back(const T &component)
Append a component.
size_t size() const
Returns the number of components.
Represents a name component.
void erase(ssize_t i)
Erase the component at the specified index.
static Component fromNumber(uint64_t number, uint32_t type=tlv::GenericNameComponent)
Create a component encoded as NonNegativeInteger.
Name & appendTimestamp(const optional< time::system_clock::time_point > ×tamp=nullopt)
Append a timestamp component.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
Name & appendKeyword(const char *keyword)
Append a keyword component.
Name & append(const char *str)
Append a GenericNameComponent, copying TLV-VALUE from a null-terminated string.
bool hasWire() const noexcept
Check if this instance already has wire encoding.
Name deepCopy() const
Make a deep copy of the name, reallocating the underlying memory buffer.
component_container::difference_type difference_type
Name & appendNumberWithMarker(uint8_t marker, uint64_t number)
Append a component with a marked number.
Name & appendParametersSha256Digest(span< const uint8_t > digestBytes)
Append a ParametersSha256Digest component.
void wireDecode(const Block &wire)
Decode name from wire encoding.
Name & append(uint32_t type, const uint8_t *value, size_t count)
Append a NameComponent of TLV-TYPE type, copying count bytes at value as TLV-VALUE.
std::vector< Component > component_container
void clear()
Remove all components.
Name & appendParametersSha256DigestPlaceholder()
Append a placeholder for a ParametersSha256Digest component.
PartialName getSubName(ssize_t iStartComponent, size_t nComponents=npos) const
Extracts some components as a sub-name (PartialName).
const nullopt_t nullopt((nullopt_t::init()))
Name & appendSegment(uint64_t segmentNo)
Append a segment number (sequential) component.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Interest)
Name()
Create an empty name.
Name & appendKeyword(span< const uint8_t > keyword)
Append a keyword component.
shared_ptr< const Buffer > ConstBufferPtr