A Name::Component holds a read-only name component value. More...
#include <name.hpp>
Public Member Functions | |
| Component () | |
| Create a new Name::Component with a zero-length value. | |
| Component (const std::vector< uint8_t > &value) | |
| Create a new Name::Component, copying the given value. More... | |
| Component (const uint8_t *value, size_t valueLen) | |
| Create a new Name::Component, copying the given value. More... | |
| Component (const char *value) | |
| Create a new Name::Component, copying the bytes from the value string. More... | |
| Component (const std::string &value) | |
| Create a new Name::Component, copying the bytes from the value string. More... | |
| Component (const Blob &value) | |
| Create a new Name::Component, taking another pointer to the Blob value. More... | |
| void | get (struct ndn_NameComponent &componentStruct) const |
| Set the componentStruct to point to this component, without copying any memory. More... | |
| const Blob & | getValue () const |
| void | toEscapedString (std::ostringstream &result) const |
| Write this component value to result, escaping characters according to the NDN URI Scheme. More... | |
| std::string | toEscapedString () const |
| Convert this component value by escaping characters according to the NDN URI Scheme. More... | |
| uint64_t | toNumber () const |
| Interpret this name component as a network-ordered number and return an integer. More... | |
| uint64_t | toNumberWithMarker (uint8_t marker) const |
| Interpret this name component as a network-ordered number with a marker and return an integer. More... | |
| uint64_t | toNumberWithPrefix (const uint8_t *prefix, size_t prefixLength) const |
| Interpret this name component as a network-ordered number with a prefix and return an integer. More... | |
| bool | hasPrefix (const uint8_t *prefix, size_t prefixLength) const |
| Check if this name component begins with the given prefix. More... | |
| uint64_t | toSegment () const |
| Interpret this name component as a segment number according to NDN naming conventions for "Segment number" (marker 0x00). More... | |
| uint64_t | toSegmentOffset () const |
| Interpret this name component as a segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB). More... | |
| uint64_t DEPRECATED_IN_NDN_CPP | toSeqNum () const |
| bool DEPRECATED_IN_NDN_CPP | isFinalSegment () const |
| uint64_t DEPRECATED_IN_NDN_CPP | toFinalSegment () const |
| uint64_t | toVersion () const |
| Interpret this name component as a version number according to NDN naming conventions for "Versioning" (marker 0xFD). More... | |
| uint64_t | toTimestamp () const |
| Interpret this name component as a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC). More... | |
| uint64_t | toSequenceNumber () const |
| Interpret this name component as a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE). More... | |
| bool | equals (const Component &other) const |
| Check if this is the same component as other. More... | |
| bool | operator== (const Component &other) const |
| Check if this is the same component as other. More... | |
| bool | operator!= (const Component &other) const |
| Check if this is not the same component as other. More... | |
| int | compare (const Component &other) const |
| Compare this to the other Component using NDN canonical ordering. More... | |
| bool | operator<= (const Component &other) const |
| Return true if this is less than or equal to the other Component in the NDN canonical ordering. More... | |
| bool | operator< (const Component &other) const |
| Return true if this is less than the other Component in the NDN canonical ordering. More... | |
| bool | operator>= (const Component &other) const |
| Return true if this is less than or equal to the other Component in the NDN canonical ordering. More... | |
| bool | operator> (const Component &other) const |
| Return true if this is greater than the other Component in the NDN canonical ordering. More... | |
Static Public Member Functions | |
| static Component | fromNumber (uint64_t number) |
| Create a component whose value is the nonNegativeInteger encoding of the number. More... | |
| static Component | fromNumberWithMarker (uint64_t number, uint8_t marker) |
| Create a component whose value is the marker appended with the nonNegativeInteger encoding of the number. More... | |
| static Component | fromNumberWithPrefix (uint64_t number, const uint8_t *prefix, size_t prefixLength) |
| Create a component whose value is the prefix appended with the network-ordered encoding of the number. More... | |
| static const uint8_t * | getFinalSegmentPrefix () |
| static size_t | getFinalSegmentPrefixLength () |
A Name::Component holds a read-only name component value.
|
inline |
Create a new Name::Component, copying the given value.
| value | The value byte array. |
|
inline |
Create a new Name::Component, copying the given value.
| value | Pointer to the value byte array. |
| valueLen | Length of value. |
|
inline |
Create a new Name::Component, copying the bytes from the value string.
NOTE: This does not escape XX values. If you need to escape, use Name::fromEscapedString. Also, if the string has "/", this does not split into separate components. If you need that then use Name(value).
| value | A null-terminated string with the bytes to copy. |
|
inline |
Create a new Name::Component, copying the bytes from the value string.
NOTE: This does not escape XX values. If you need to escape, use Name::fromEscapedString. Also, if the string has "/", this does not split into separate components. If you need that then use Name(value).
| value | A string with the bytes to copy. |
|
inline |
Create a new Name::Component, taking another pointer to the Blob value.
| value | A blob with a pointer to an immutable array. The pointer is copied. |
| int ndn::Name::Component::compare | ( | const Component & | other | ) | const |
|
inline |
Check if this is the same component as other.
| other | The other Component to compare with. |
|
static |
Create a component whose value is the nonNegativeInteger encoding of the number.
| number | The number to be encoded. |
|
static |
Create a component whose value is the marker appended with the nonNegativeInteger encoding of the number.
| number | The number to be encoded. |
| marker | The marker to use as the first byte of the component. |
|
static |
Create a component whose value is the prefix appended with the network-ordered encoding of the number.
Note: if the number is zero, no bytes are used for the number - the result will have only the prefix.
| number | The number to be encoded. |
| prefix | The prefix to use as the first bytes of the component. |
| prefixLength | The length of prefix. |
| void ndn::Name::Component::get | ( | struct ndn_NameComponent & componentStruct | ) | const |
Set the componentStruct to point to this component, without copying any memory.
WARNING: The resulting pointer in componentStruct is invalid after a further use of this object which could reallocate memory.
| componentStruct | The C ndn_NameComponent struct to receive the pointer. |
|
inlinestatic |
|
inlinestatic |
| bool ndn::Name::Component::hasPrefix | ( | const uint8_t * | prefix, |
| size_t | prefixLength | ||
| ) | const |
Check if this name component begins with the given prefix.
| prefix | The required prefix of the component. |
| prefixLength | The length of prefix. |
|
inline |
|
inline |
Check if this is not the same component as other.
| other | The other Component to compare with. |
|
inline |
|
inline |
|
inline |
Check if this is the same component as other.
| other | The other Component to compare with. |
|
inline |
|
inline |
|
inline |
Write this component value to result, escaping characters according to the NDN URI Scheme.
This also adds "..." to a value with zero or more ".".
| result | the string stream to write to. |
|
inline |
Convert this component value by escaping characters according to the NDN URI Scheme.
This also adds "..." to a value with zero or more ".".
|
inline |
| uint64_t ndn::Name::Component::toNumber | ( | ) | const |
Interpret this name component as a network-ordered number and return an integer.
| uint64_t ndn::Name::Component::toNumberWithMarker | ( | uint8_t | marker | ) | const |
Interpret this name component as a network-ordered number with a marker and return an integer.
| marker | The required first byte of the component. |
| runtime_error | If the first byte of the component does not equal the marker. |
| uint64_t ndn::Name::Component::toNumberWithPrefix | ( | const uint8_t * | prefix, |
| size_t | prefixLength | ||
| ) | const |
Interpret this name component as a network-ordered number with a prefix and return an integer.
| prefix | The required prefix of the component. |
| prefixLength | The length of prefix. |
| runtime_error | If the first bytes of the component do not equal the prefix. |
|
inline |
Interpret this name component as a segment number according to NDN naming conventions for "Segment number" (marker 0x00).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| runtime_error | If the first byte of the component is not the expected marker. |
|
inline |
Interpret this name component as a segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| runtime_error | If the first byte of the component is not the expected marker. |
|
inline |
|
inline |
Interpret this name component as a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| runtime_error | If the first byte of the component is not the expected marker. |
|
inline |
Interpret this name component as a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| runtime_error | If the first byte of the component is not the expected marker. |
|
inline |
Interpret this name component as a version number according to NDN naming conventions for "Versioning" (marker 0xFD).
Note that this returns the exact number from the component without converting it to a time representation.
| runtime_error | If the first byte of the component is not the expected marker. |
1.8.9.1