esp8266ndn
NDN Arduino library for ESP8266 and more
|
Name. More...
#include <name.hpp>
Inherits ndnph::Printable.
Classes | |
class | Iterator |
Iterator over name components. More... | |
Public Types | |
enum | CompareResult { CMP_LT = -2 , CMP_LPREFIX = -1 , CMP_EQUAL = 0 , CMP_RPREFIX = +1 , CMP_GT = +2 } |
Name compare result. More... | |
Public Member Functions | |
Name (const uint8_t *value=nullptr, size_t length=0) | |
Construct referencing TLV-VALUE. | |
template<typename It > | |
Name (Region ®ion, It first, It last) | |
Construct from TLV-VALUE. | |
Name (Region ®ion, std::initializer_list< uint8_t > value) | |
Construct from TLV-VALUE. | |
operator bool () const | |
Return true if Name is non-empty. | |
size_t | length () const |
const uint8_t * | value () const |
size_t | size () const |
Get number of components. | |
Iterator | begin () const |
Iterator | end () const |
Component | operator[] (int i) const |
Access i-th component. | |
Name | slice (int first=0, int last=0) const |
Get sub name [first, last). | |
Name | getPrefix (int n=0) const |
Get prefix of n components. | |
template<typename... C> | |
Name | append (Region ®ion, const C &... comps) const |
Append a sequence of components. | |
Name | clone (Region ®ion) const |
Clone TLV-VALUE into given region. | |
CompareResult | compare (const Name &other) const |
Compare with other name. | |
bool | isPrefixOf (const Name &other) const |
Determine if this name is a prefix of other. | |
void | encodeTo (Encoder &encoder) const |
bool | decodeFrom (const Decoder::Tlv &d) |
size_t | printTo (::Print &p) const final |
Print name as URI. | |
![]() | |
operator Esp32Printable () const | |
Static Public Member Functions | |
static Name | parse (Region ®ion, const char *uri) |
Parse from URI. | |
Name.
This type is immutable, except `decodeFrom()` method.
|
inlineexplicit |
Construct referencing TLV-VALUE.
|
inlineexplicit |
Construct from TLV-VALUE.
|
inlineexplicit |
Construct from TLV-VALUE.
|
inline |
Append a sequence of components.
comps | a mix of Components and Convention+argument pairs. |
Name() | any Component is invalid or allocation error. |
If you need to append multiple components, it's recommended to append them all at once, so that memory allocation and copying occur only once.
|
inline |
Clone TLV-VALUE into given region.
|
inline |
Compare with other name.
|
inline |
|
inline |
|
inline |
|
inline |
Get prefix of n components.
n | number of component; if non-positive, count from end. |
|
inline |
Determine if this name is a prefix of other.
|
inline |
|
inlineexplicit |
Return true if Name is non-empty.
|
inline |
Access i-th component.
Parse from URI.
region | memory region; must have 2*strlen (uri) available room. |
uri | URI in canonical format; scheme and authority must be omitted; `8=` prefix of GenericNameComponent may be omitted. |
|
inlinefinalvirtual |
Print name as URI.
Implements ndnph::Printable.
|
inline |
Get number of components.
|
inline |
Get sub name [first, last).
first | inclusive first component index; if negative, count from end. |
last | exclusive last component index; if non-positive, count from end. |
|
inline |