Declare rules regarding a NameComponent type. More...
#include <name-component-types.hpp>
Public Types | |
using | Error = Component::Error |
Public Member Functions | |
virtual | ~ComponentType ()=default |
virtual void | check (const Component &comp) const |
Throw Component::Error if comp is invalid. More... | |
virtual std::pair< bool, Component > | getSuccessor (const Component &comp) const |
Calculate the successor of comp . More... | |
virtual const std::vector< uint8_t > & | getMinValue () const |
Return the minimum allowable TLV-VALUE of this component type. More... | |
virtual const char * | getAltUriPrefix () const |
Return the prefix of the alternate URI representation. More... | |
virtual Component | parseAltUriValue (const std::string &input) const |
Parse component from alternate URI representation. More... | |
virtual void | writeUri (std::ostream &os, const Component &comp) const |
Write URI representation of comp to os . More... | |
Protected Member Functions | |
std::pair< bool, Block > | getSuccessorImpl (const Component &comp) const |
Calculate the successor of comp , extending TLV-LENGTH if value overflows. More... | |
void | writeUriEscapedValue (std::ostream &os, const Component &comp) const |
Write TLV-VALUE as <escaped-value> of NDN URI syntax. More... | |
Declare rules regarding a NameComponent type.
Definition at line 38 of file name-component-types.hpp.
Definition at line 41 of file name-component-types.hpp.
|
virtualdefault |
|
inlinevirtual |
Throw Component::Error if comp
is invalid.
Reimplemented in ndn::name::detail::Sha256ComponentType.
Definition at line 49 of file name-component-types.hpp.
|
inlinevirtual |
Calculate the successor of comp
.
If comp
is the maximum possible value of this component type, return true to indicate that the successor should have a greater TLV-TYPE.
Reimplemented in ndn::name::detail::Sha256ComponentType.
Definition at line 59 of file name-component-types.hpp.
References getSuccessorImpl().
Referenced by ndn::name::Component::getSuccessor().
|
inlinevirtual |
Return the minimum allowable TLV-VALUE of this component type.
Reimplemented in ndn::name::detail::Sha256ComponentType.
Definition at line 67 of file name-component-types.hpp.
Referenced by ndn::name::Component::getSuccessor().
|
inlinevirtual |
Return the prefix of the alternate URI representation.
NDN URI specification allows a name component type to declare an alternate URI representation in the form of <prefix>=<value>
, in addition to the plain <type-number>=<escaped-value>
syntax.
<prefix>
portion of the alternate URI representation. nullptr | this component does not have an alternate URI representation. |
Reimplemented in ndn::name::detail::Sha256ComponentType.
Definition at line 83 of file name-component-types.hpp.
|
inlinevirtual |
Parse component from alternate URI representation.
input | the <value> portion of the alternate URI representation. |
Component::Error |
Reimplemented in ndn::name::detail::Sha256ComponentType.
Definition at line 94 of file name-component-types.hpp.
|
inlinevirtual |
Write URI representation of comp
to os
.
This base class implementation encodes the component in the plain <type-number>=<escaped-value>
syntax.
Reimplemented in ndn::name::detail::Sha256ComponentType, and ndn::name::detail::GenericNameComponentType.
Definition at line 106 of file name-component-types.hpp.
References ndn::Block::type(), and writeUriEscapedValue().
Referenced by ndn::name::Component::toUri().
|
inlineprotected |
Calculate the successor of comp
, extending TLV-LENGTH if value overflows.
Definition at line 117 of file name-component-types.hpp.
References ndn::Block::size(), ndn::Block::type(), ndn::Block::value(), and ndn::Block::value_size().
Referenced by getSuccessor(), and ndn::name::detail::Sha256ComponentType::getSuccessor().
|
inlineprotected |
Write TLV-VALUE as <escaped-value>
of NDN URI syntax.
Definition at line 144 of file name-component-types.hpp.
References ndn::escape(), ndn::Block::value(), ndn::Block::value_begin(), ndn::Block::value_end(), and ndn::Block::value_size().
Referenced by writeUri(), and ndn::name::detail::GenericNameComponentType::writeUri().