A Name::Component holds a read-only name component value. More...
#include <name.hpp>
Public Member Functions | |
| Component () | |
| Create a new GENERIC Name::Component with a zero-length value. | |
| Component (const std::vector< uint8_t > &value, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a new Name::Component, copying the given value. More... | |
| Component (const uint8_t *value, size_t valueLength, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a new Name::Component, copying the given value. More... | |
| Component (const char *value, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a new Name::Component, copying the bytes from the value string. More... | |
| Component (const std::string &value, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a new Name::Component, copying the bytes from the value string. More... | |
| Component (const Blob &value, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) | |
| Create a new Name::Component, taking another pointer to the Blob value. More... | |
| Component (const NameLite::Component &componentLite) | |
| Create a new Name::Component, copying bytes from the NameLite::Component value and using its type. More... | |
| void | get (NameLite::Component &componentLite) const |
| Set componentLite to point to this component, without copying any memory. More... | |
| const Blob & | getValue () const |
| Get the component value. More... | |
| ndn_NameComponentType | getType () const |
| Get the name component type. More... | |
| int | getOtherTypeCode () const |
| Get the component type code from the packet which is other than a recognized ndn_NameComponentType enum value. More... | |
| 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... | |
| bool | isSegment () const |
| Check if this component is a segment number according to NDN naming conventions for "Segment number" (marker 0x00) and return an integer. More... | |
| bool | isSegmentOffset () const |
| Check if this component is a segment byte offset according to NDN naming conventions for "Byte offset" (marker 0xFB) and return an integer. More... | |
| bool | isVersion () const |
| Check if this component is a version number according to NDN naming conventions for "Versioning" (marker 0xFD) and return an integer. More... | |
| bool | isTimestamp () const |
| Check if this component is a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC) and return an integer. More... | |
| bool | isSequenceNumber () const |
| Check if this component is a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE) and return an integer. More... | |
| bool | isGeneric () const |
| Check if this component is a generic component. More... | |
| bool | isImplicitSha256Digest () const |
| Check if this component is an ImplicitSha256Digest component. More... | |
| bool | isParametersSha256Digest () const |
| Check if this component is a ParametersSha256Digest component. 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... | |
| Component | getSuccessor () const |
| Get the successor of this component, as described in Name::getSuccessor. 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, ndn_NameComponentType type=ndn_NameComponentType_GENERIC, int otherTypeCode=-1) |
| Create a component whose value is the nonNegativeInteger encoding of the number. More... | |
| static Component | fromNumberWithMarker (uint64_t number, uint8_t marker) |
| Create a GENERIC 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 GENERIC component whose value is the prefix appended with the network-ordered encoding of the number. More... | |
| static Component | fromSegment (uint64_t segment) |
| Create a component with the encoded segment number according to NDN naming conventions for "Segment number" (marker 0x00). More... | |
| static Component | fromSegmentOffset (uint64_t segmentOffset) |
| Create a component with the encoded segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB). More... | |
| static Component | fromVersion (uint64_t version) |
| Create a component with the encoded version number according to NDN naming conventions for "Versioning" (marker 0xFD). More... | |
| static Component | fromTimestamp (uint64_t timestamp) |
| Create a component with the encoded timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC). More... | |
| static Component | fromSequenceNumber (uint64_t sequenceNumber) |
| Create a component with the encoded sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE). More... | |
| static Component | fromImplicitSha256Digest (const Blob &digest) |
| Create a component of type ImplicitSha256DigestComponent, so that isImplicitSha256Digest() is true. More... | |
| static Component | fromImplicitSha256Digest (const uint8_t *digest, size_t digestLength) |
| Create a component of type ImplicitSha256DigestComponent, so that isImplicitSha256Digest() is true. More... | |
| static Component | fromImplicitSha256Digest (const std::vector< uint8_t > &digest) |
| Create a component of type ImplicitSha256DigestComponent, so that isImplicitSha256Digest() is true. More... | |
| static Component | fromParametersSha256Digest (const Blob &digest) |
| Create a component of type ParametersSha256DigestComponent, so that isParametersSha256Digest() is true. More... | |
| static Component | fromParametersSha256Digest (const uint8_t *digest, size_t digestLength) |
| Create a component of type ParametersSha256DigestComponent, so that isParametersSha256Digest() is true. More... | |
| static Component | fromParametersSha256Digest (const std::vector< uint8_t > &digest) |
| Create a component of type ParametersSha256DigestComponent, so that isParametersSha256Digest() is true. 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.
(To create an ImplicitSha256Digest component, use fromImplicitSha256Digest.) (To create a ParametersSha256Digest component, use fromParametersSha256Digest.)
| value | The value byte array, which is copied. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
|
inline |
Create a new Name::Component, copying the given value.
(To create an ImplicitSha256Digest component, use fromImplicitSha256Digest.) (To create a ParametersSha256Digest component, use fromParametersSha256Digest.)
| value | A pointer to the value byte array, which is copied. |
| valueLength | The length of value. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
|
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. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
|
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. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
|
inline |
Create a new Name::Component, taking another pointer to the Blob value.
(To create an ImplicitSha256Digest component, use fromImplicitSha256Digest.) (To create a ParametersSha256Digest component, use fromParametersSha256Digest.)
| value | A blob with a pointer to an immutable array. The pointer is copied. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
|
inline |
Create a new Name::Component, copying bytes from the NameLite::Component value and using its type.
| componentLite | A NameLite::Component with the values to copy. |
| 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 of type ImplicitSha256DigestComponent, so that isImplicitSha256Digest() is true.
| digest | The SHA-256 digest value. |
| runtime_error | If the digest length is not ndn_SHA256_DIGEST_SIZE bytes. |
|
inlinestatic |
Create a component of type ImplicitSha256DigestComponent, so that isImplicitSha256Digest() is true.
| digest | A pointer to the SHA-256 digest value. |
| digestLength | Length of digest, which must be ndn_SHA256_DIGEST_SIZE. |
| digest | The SHA-256 digest value. |
| runtime_error | If digestLength is not ndn_SHA256_DIGEST_SIZE bytes. |
|
inlinestatic |
Create a component of type ImplicitSha256DigestComponent, so that isImplicitSha256Digest() is true.
| digest | The SHA-256 digest value. |
| runtime_error | If the digest length is not ndn_SHA256_DIGEST_SIZE bytes. |
|
static |
Create a component whose value is the nonNegativeInteger encoding of the number.
| number | The number to be encoded. |
| type | (optional) The component type as an int from the ndn_NameComponentType enum. If the name component type is not a recognized ndn_NameComponentType enum value, then set this to ndn_NameComponentType_OTHER_CODE and use the otherTypeCode parameter. If omitted, use ndn_NameComponentType_GENERIC. |
| otherTypeCode | (optional) If type is ndn_NameComponentType_OTHER_CODE, then this is the packet's unrecognized content type code, which must be non-negative. |
|
static |
Create a GENERIC 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 GENERIC 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. |
|
static |
Create a component of type ParametersSha256DigestComponent, so that isParametersSha256Digest() is true.
| digest | The SHA-256 digest value. |
| runtime_error | If the digest length is not ndn_SHA256_DIGEST_SIZE bytes. |
|
inlinestatic |
Create a component of type ParametersSha256DigestComponent, so that isParametersSha256Digest() is true.
| digest | The SHA-256 digest value. |
| runtime_error | If the digest length is not ndn_SHA256_DIGEST_SIZE bytes. |
|
inlinestatic |
Create a component of type ParametersSha256DigestComponent, so that isParametersSha256Digest() is true.
| digest | The SHA-256 digest value. |
| runtime_error | If the digest length is not ndn_SHA256_DIGEST_SIZE bytes. |
|
inlinestatic |
Create a component with the encoded segment number according to NDN naming conventions for "Segment number" (marker 0x00).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| segment | The segment number. |
|
inlinestatic |
Create a component with the encoded segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| segmentOffset | The segment byte offset. |
|
inlinestatic |
Create a component with the encoded sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| sequenceNumber | The sequence number. |
|
inlinestatic |
Create a component with the encoded timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
| timestamp | The number of microseconds since the UNIX epoch (Thursday, 1 January 1970) not counting leap seconds. |
|
inlinestatic |
Create a component with the encoded version number according to NDN naming conventions for "Versioning" (marker 0xFD).
http://named-data.net/doc/tech-memos/naming-conventions.pdf Note that this encodes the exact value of version without converting from a time representation.
| version | The version number. |
| void ndn::Name::Component::get | ( | NameLite::Component & | componentLite | ) | const |
Set componentLite to point to this component, without copying any memory.
WARNING: The resulting pointer in componentLite is invalid after a further use of this object which could reallocate memory.
| componentLite | The NameLite::Component to receive the pointer. |
|
inlinestatic |
|
inlinestatic |
|
inline |
Get the component type code from the packet which is other than a recognized ndn_NameComponentType enum value.
This is only meaningful if getType() is ndn_NameComponentType_OTHER_CODE.
| Name::Component ndn::Name::Component::getSuccessor | ( | ) | const |
Get the successor of this component, as described in Name::getSuccessor.
|
inline |
Get the name component type.
|
inline |
Get the component value.
| 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 component is a generic component.
|
inline |
Check if this component is an ImplicitSha256Digest component.
|
inline |
Check if this component is a ParametersSha256Digest component.
|
inline |
Check if this component is a segment number according to NDN naming conventions for "Segment number" (marker 0x00) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
|
inline |
Check if this component is a segment byte offset according to NDN naming conventions for "Byte offset" (marker 0xFB) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
|
inline |
Check if this component is a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
|
inline |
Check if this component is a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
|
inline |
Check if this component is a version number according to NDN naming conventions for "Versioning" (marker 0xFD) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
|
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 |
| void ndn::Name::Component::toEscapedString | ( | std::ostringstream & | result | ) | const |
Write this component value to result, escaping characters according to the NDN URI Scheme.
This also adds "..." to a value with zero or more ".". This adds a type code prefix as needed, such as "sha256digest=".
| result | the string stream to write to. |
| std::string ndn::Name::Component::toEscapedString | ( | ) | const |
Convert this component value by escaping characters according to the NDN URI Scheme.
This also adds "..." to a value with zero or more ".". This adds a type code prefix as needed, such as "sha256digest=".
|
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.6