ndn::name::Component Class Reference

Component holds a read-only name component value. More...

#include <name-component.hpp>

Inheritance diagram for ndn::name::Component:
[legend]
Collaboration diagram for ndn::name::Component:
[legend]

Data Structures

class  Error
 Error that can be thrown from name::Component. More...
 

Public Types

typedef std::vector< Blockelement_container
 
typedef element_container::iterator element_iterator
 
typedef element_container::const_iterator element_const_iterator
 

Public Member Functions

 Component ()
 Create a new name::Component with an empty value. More...
 
 Component (const Block &wire)
 Create name::Component from a wire block. More...
 
 Component (const ConstBufferPtr &buffer)
 Create a new name::Component from the buffer pointer (buffer pointer will be copied) More...
 
 Component (const Buffer &buffer)
 Create a new name::Component from the buffer (data from buffer will be copied) More...
 
 Component (const uint8_t *buffer, size_t bufferSize)
 Create a new name::Component from the buffer (data from buffer will be copied) More...
 
template<class Iterator >
 Component (Iterator first, Iterator last)
 Create a new name::Component frome the range [first, last) of bytes. More...
 
 Component (const char *str)
 Create a new name::Component from the C string (data from string will be copied) More...
 
 Component (const std::string &str)
 Create a new name::Component from the STL string (data from string will be copied) More...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 Fast encoding or block size estimation. More...
 
const BlockwireEncode () const
 Encode to a wire format. More...
 
void wireDecode (const Block &wire)
 Decode from the wire format. More...
 
void toEscapedString (std::ostream &os) const
 Write *this to the output stream, escaping characters according to the NDN URI Scheme. More...
 
std::string toEscapedString () const
 Convert *this by escaping characters according to the NDN URI Scheme. More...
 
void toUri (std::ostream &os) const
 Write *this to the output stream, escaping characters according to the NDN URI Scheme. More...
 
std::string toUri () const
 Convert *this by escaping characters according to the NDN URI Scheme. More...
 
bool isNumber () const
 Check if the component is nonNegativeInteger. More...
 
bool isNumberWithMarker (uint8_t marker) const
 Check if the component is NameComponentWithMarker per NDN naming conventions. More...
 
bool isVersion () const
 Check if the component is version per NDN naming conventions. More...
 
bool isSegment () const
 Check if the component is segment number per NDN naming conventions. More...
 
bool isSegmentOffset () const
 Check if the component is segment offset per NDN naming conventions. More...
 
bool isTimestamp () const
 Check if the component is timestamp per NDN naming conventions. More...
 
bool isSequenceNumber () const
 Check if the component is sequence number per NDN naming conventions. More...
 
uint64_t toNumber () const
 Interpret this name component as nonNegativeInteger. More...
 
uint64_t toNumberWithMarker (uint8_t marker) const
 Interpret this name component as NameComponentWithMarker. More...
 
uint64_t toVersion () const
 Interpret as version component using NDN naming conventions. More...
 
uint64_t toSegment () const
 Interpret as segment number component using NDN naming conventions. More...
 
uint64_t toSegmentOffset () const
 Interpret as segment offset component using NDN naming conventions. More...
 
time::system_clock::TimePoint toTimestamp () const
 Interpret as timestamp component using NDN naming conventions. More...
 
uint64_t toSequenceNumber () const
 Interpret as sequence number component using NDN naming conventions. More...
 
bool isGeneric () const
 Check if the component is GenericComponent. More...
 
bool isImplicitSha256Digest () const
 Check if the component is ImplicitSha256DigestComponent. More...
 
bool empty () const
 
bool equals (const Component &other) const
 Check if this is 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
 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...
 
bool operator<= (const Component &other) const
 Check if the *this is less than or equal to the other in NDN canonical ordering. More...
 
bool operator< (const Component &other) const
 Check if the *this is less than the other in NDN canonical ordering. More...
 
bool operator>= (const Component &other) const
 Check if the *this is greater or equal than the other in NDN canonical ordering. More...
 
bool operator> (const Component &other) const
 Check if the *this is greater than the other in NDN canonical ordering. More...
 
Component getSuccessor () const
 
bool hasWire () const
 Check if the Block has fully encoded wire. More...
 
void reset ()
 Reset wire buffer of the element. More...
 
void resetWire ()
 Reset wire buffer but keep sub elements (if any) More...
 
Buffer::const_iterator begin () const
 
Buffer::const_iterator end () const
 
const uint8_t * wire () const
 
size_t size () const
 
uint32_t type () const
 
bool hasValue () const
 Check if the Block has value block (no type and length are encoded) More...
 
Buffer::const_iterator value_begin () const
 
Buffer::const_iterator value_end () const
 
const uint8_t * value () const
 
size_t value_size () const
 
void parse () const
 Parse wire buffer into subblocks. More...
 
void encode ()
 Encode subblocks into wire buffer. More...
 
const Blockget (uint32_t type) const
 Get the first subelement of the requested type. More...
 
element_const_iterator find (uint32_t type) const
 
void remove (uint32_t type)
 remove all subelements of type More...
 
element_iterator erase (element_const_iterator position)
 
element_iterator erase (element_const_iterator first, element_const_iterator last)
 
void push_back (const Block &element)
 
element_iterator insert (element_const_iterator pos, const Block &element)
 insert Insert a new element in a specific position More...
 
const element_containerelements () const
 Get all subelements. More...
 
element_const_iterator elements_begin () const
 
element_const_iterator elements_end () const
 
size_t elements_size () const
 
Block blockFromValue () const
 
shared_ptr< const BuffergetBuffer () const
 Get underlying buffer. More...
 
bool operator== (const Block &other) const
 
bool operator!= (const Block &other) const
 
 operator boost::asio::const_buffer () const
 

Static Public Member Functions

static Component fromEscapedString (const char *escapedString, size_t beginOffset, size_t endOffset)
 Create name::Component by decoding the escapedString between beginOffset and endOffset according to the NDN URI Scheme. More...
 
static Component fromEscapedString (const char *escapedString)
 Create name::Component by decoding the escapedString according to the NDN URI Scheme. More...
 
static Component fromEscapedString (const std::string &escapedString)
 Create name::Component by decoding the escapedString according to the NDN URI Scheme. More...
 
static Component fromNumber (uint64_t number)
 Create a component encoded as nonNegativeInteger. More...
 
static Component fromNumberWithMarker (uint8_t marker, uint64_t number)
 Create a component encoded as NameComponentWithMarker. More...
 
static Component fromVersion (uint64_t version)
 Create version component using NDN naming conventions. More...
 
static Component fromSegment (uint64_t segmentNo)
 Create segment number component using NDN naming conventions. More...
 
static Component fromSegmentOffset (uint64_t offset)
 Create segment offset component using NDN naming conventions. More...
 
static Component fromTimestamp (const time::system_clock::TimePoint &timePoint)
 Create sequence number component using NDN naming conventions. More...
 
static Component fromSequenceNumber (uint64_t seqNo)
 Create sequence number component using NDN naming conventions. More...
 
static Component fromImplicitSha256Digest (const ConstBufferPtr &digest)
 Create ImplicitSha256DigestComponent component. More...
 
static Component fromImplicitSha256Digest (const uint8_t *digest, size_t digestSize)
 Create ImplicitSha256DigestComponent component. More...
 
static Block fromStream (std::istream &is)
 Create a Block from an input stream. More...
 
static std::tuple< bool, BlockfromBuffer (ConstBufferPtr buffer, size_t offset)
 Try to construct block from Buffer. More...
 
static std::tuple< bool, BlockfromBuffer (const uint8_t *buffer, size_t maxSize)
 Try to construct block from raw buffer. More...
 

Protected Attributes

shared_ptr< const Bufferm_buffer
 
uint32_t m_type
 
Buffer::const_iterator m_begin
 
Buffer::const_iterator m_end
 
uint32_t m_size
 
Buffer::const_iterator m_value_begin
 
Buffer::const_iterator m_value_end
 
element_container m_subBlocks
 

Detailed Description

Component holds a read-only name component value.

Definition at line 47 of file name-component.hpp.

Member Typedef Documentation

typedef element_container::const_iterator ndn::Block::element_const_iterator
inherited

Definition at line 48 of file block.hpp.

typedef std::vector<Block> ndn::Block::element_container
inherited

Definition at line 46 of file block.hpp.

typedef element_container::iterator ndn::Block::element_iterator
inherited

Definition at line 47 of file block.hpp.

Constructor & Destructor Documentation

ndn::name::Component::Component ( )

Create a new name::Component with an empty value.

Definition at line 52 of file name-component.cpp.

ndn::name::Component::Component ( const Block wire)

Create name::Component from a wire block.

Parameters
wiretlv::NameComponent Block from which to create name::Component
Exceptions
Errorif wire.type() is not tlv::NameComponent

Any block can be implicitly converted to name::Component

Definition at line 57 of file name-component.cpp.

ndn::name::Component::Component ( const ConstBufferPtr buffer)
explicit

Create a new name::Component from the buffer pointer (buffer pointer will be copied)

Parameters
bufferA pointer to an immutable buffer

This constructor will create a new tlv::NameComponent Block with buffer as a payload. Note that this method will not allocate new memory for and copy the payload until toWire() method is called.

Definition at line 65 of file name-component.cpp.

ndn::name::Component::Component ( const Buffer buffer)
explicit

Create a new name::Component from the buffer (data from buffer will be copied)

Parameters
bufferA reference to the buffer

This constructor will create a new tlv::NameComponent Block with buffer as a payload. Note that this method will allocate new memory for and copy the payload.

Definition at line 70 of file name-component.cpp.

ndn::name::Component::Component ( const uint8_t *  buffer,
size_t  bufferSize 
)

Create a new name::Component from the buffer (data from buffer will be copied)

Parameters
bufferA pointer to the first byte of the buffer
bufferSizeSize of the buffer

This constructor will create a new tlv::NameComponent Block with buffer as a payload. Note that this method will allocate new memory for and copy the payload.

Definition at line 75 of file name-component.cpp.

template<class Iterator >
ndn::name::Component::Component ( Iterator  first,
Iterator  last 
)
inline

Create a new name::Component frome the range [first, last) of bytes.

Parameters
firstIterator pointing to the beginning of the buffer
lastIterator pointing to the ending of the buffer
Template Parameters
Iteratoriterator type satisfying at least InputIterator concept. Implementation is more optimal when the iterator type satisfies RandomAccessIterator concept. It is required that sizeof(std::iterator_traits<Iterator>::value_type) == 1.

This constructor will create a new tlv::NameComponent Block with buffer as a payload. Note that this method will allocate new memory for and copy the payload.

Definition at line 611 of file name-component.hpp.

ndn::name::Component::Component ( const char *  str)
explicit

Create a new name::Component from the C string (data from string will be copied)

Parameters
strZero-ended string. Note that this string will be interpreted as is (i.e., it will not be interpreted as URI)

This constructor will create a new tlv::NameComponent Block with buffer as a payload. Note that this method will allocate new memory for and copy the payload.

Definition at line 80 of file name-component.cpp.

ndn::name::Component::Component ( const std::string &  str)
explicit

Create a new name::Component from the STL string (data from string will be copied)

Parameters
strConst reference to STL string. Note that this string will be interpreted as is (i.e., it will not be interpreted as URI)

This constructor will create a new tlv::NameComponent Block with buffer as a payload. Note that this method will allocate new memory for and copy the payload.

Definition at line 85 of file name-component.cpp.

Member Function Documentation

Buffer::const_iterator ndn::Block::begin ( ) const
inherited

Definition at line 477 of file block.cpp.

Block ndn::Block::blockFromValue ( ) const
inherited

Definition at line 437 of file block.cpp.

int ndn::name::Component::compare ( const Component other) const

Compare this to the other Component using NDN canonical ordering.

Parameters
otherThe other Component to compare with.
Return values
negativethis comes before other in canonical ordering
zerothis equals other
positivethis comes after other in canonical ordering
See also
http://named-data.net/doc/ndn-tlv/name.html#canonical-order

Definition at line 395 of file name-component.cpp.

const Block::element_container & ndn::Block::elements ( ) const
inlineinherited

Get all subelements.

Definition at line 342 of file block.hpp.

Block::element_const_iterator ndn::Block::elements_begin ( ) const
inherited

Definition at line 589 of file block.cpp.

Block::element_const_iterator ndn::Block::elements_end ( ) const
inherited

Definition at line 595 of file block.cpp.

size_t ndn::Block::elements_size ( ) const
inherited

Definition at line 601 of file block.cpp.

bool ndn::name::Component::empty ( ) const
inline

Definition at line 495 of file name-component.hpp.

void ndn::Block::encode ( )
inherited

Encode subblocks into wire buffer.

Definition at line 355 of file block.cpp.

Buffer::const_iterator ndn::Block::end ( ) const
inherited

Definition at line 486 of file block.cpp.

bool ndn::name::Component::equals ( const Component other) const

Check if this is the same component as other.

Parameters
otherThe other Component to compare with
Returns
true if the components are equal, otherwise false.

Definition at line 386 of file name-component.cpp.

Block::element_iterator ndn::Block::erase ( Block::element_const_iterator  position)
inherited

Definition at line 538 of file block.cpp.

Block::element_iterator ndn::Block::erase ( Block::element_const_iterator  first,
Block::element_const_iterator  last 
)
inherited

Definition at line 552 of file block.cpp.

Block::element_const_iterator ndn::Block::find ( uint32_t  type) const
inherited

Definition at line 420 of file block.cpp.

std::tuple< bool, Block > ndn::Block::fromBuffer ( ConstBufferPtr  buffer,
size_t  offset 
)
staticinherited

Try to construct block from Buffer.

Parameters
bufferthe buffer to construct block from
Note
buffer is passed by value because the constructed block takes shared ownership of the buffer
Parameters
offsetoffset from beginning of buffer to construct Block from

This method does not throw upon decoding error. This method does not copy the bytes.

Returns
true and the Block, if Block is successfully created; otherwise false

Definition at line 253 of file block.cpp.

std::tuple< bool, Block > ndn::Block::fromBuffer ( const uint8_t *  buffer,
size_t  maxSize 
)
staticinherited

Try to construct block from raw buffer.

Parameters
bufferthe raw buffer to copy bytes from
maxSizethe maximum size of constructed block; buffer must have a size of at least maxSize

This method does not throw upon decoding error. This method copies the bytes into a new Buffer.

Returns
true and the Block, if Block is successfully created; otherwise false

Definition at line 276 of file block.cpp.

Component ndn::name::Component::fromEscapedString ( const char *  escapedString,
size_t  beginOffset,
size_t  endOffset 
)
static

Create name::Component by decoding the escapedString between beginOffset and endOffset according to the NDN URI Scheme.

If the escaped string is "", "." or ".." then return an empty name::Component. Note that an empty name::Component should not be added to Name and if attempted, an exception will be thrown.

Parameters
escapedStringString containing NDN URI-encoded name component. [escapedString+beginOffset, beginOffset+endOffset) must be a valid memory buffer.
beginOffsetThe offset in escapedString of the beginning of the portion to decode.
endOffsetThe offset in escapedString of the end of the portion to decode.

Definition at line 92 of file name-component.cpp.

static Component ndn::name::Component::fromEscapedString ( const char *  escapedString)
inlinestatic

Create name::Component by decoding the escapedString according to the NDN URI Scheme.

This overload is a convenience wrapper for fromEscapedString(char*,size_t,size)

Definition at line 190 of file name-component.hpp.

static Component ndn::name::Component::fromEscapedString ( const std::string &  escapedString)
inlinestatic

Create name::Component by decoding the escapedString according to the NDN URI Scheme.

This overload is a convenience wrapper for fromEscapedString(char*,size_t,size)

Definition at line 201 of file name-component.hpp.

Component ndn::name::Component::fromImplicitSha256Digest ( const ConstBufferPtr digest)
static

Create ImplicitSha256DigestComponent component.

Definition at line 364 of file name-component.cpp.

Component ndn::name::Component::fromImplicitSha256Digest ( const uint8_t *  digest,
size_t  digestSize 
)
static

Create ImplicitSha256DigestComponent component.

Definition at line 374 of file name-component.cpp.

Component ndn::name::Component::fromNumber ( uint64_t  number)
static

Create a component encoded as nonNegativeInteger.

See also
http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding
Parameters
numberThe non-negative number
Returns
The component value.

Definition at line 291 of file name-component.cpp.

Component ndn::name::Component::fromNumberWithMarker ( uint8_t  marker,
uint64_t  number 
)
static

Create a component encoded as NameComponentWithMarker.

NameComponentWithMarker is defined as:

NameComponentWithMarker ::= NAME-COMPONENT-TYPE TLV-LEGTH
                              Marker
                              includedNonNegativeInteger
Marker ::= BYTE
includedNonNegativeInteger ::= BYTE{1,2,4,8}
NDN-TLV := TLV-TYPE TLV-LENGTH TLV-VALUE?
TLV-TYPE := VAR-NUMBER
TLV-LENGTH := VAR-NUMBER
TLV-VALUE := BYTE+
See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Parameters
marker1-byte marker octet
numberThe non-negative number
Returns
The component value.

Definition at line 297 of file name-component.cpp.

Component ndn::name::Component::fromSegment ( uint64_t  segmentNo)
static

Create segment number component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 323 of file name-component.cpp.

Component ndn::name::Component::fromSegmentOffset ( uint64_t  offset)
static

Create segment offset component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 329 of file name-component.cpp.

Component ndn::name::Component::fromSequenceNumber ( uint64_t  seqNo)
static

Create sequence number component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 343 of file name-component.cpp.

Block ndn::Block::fromStream ( std::istream &  is)
staticinherited

Create a Block from an input stream.

Definition at line 223 of file block.cpp.

Component ndn::name::Component::fromTimestamp ( const time::system_clock::TimePoint timePoint)
static

Create sequence number component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 335 of file name-component.cpp.

Component ndn::name::Component::fromVersion ( uint64_t  version)
static

Create version component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 317 of file name-component.cpp.

const Block & ndn::Block::get ( uint32_t  type) const
inherited

Get the first subelement of the requested type.

Definition at line 409 of file block.cpp.

shared_ptr< const Buffer > ndn::Block::getBuffer ( ) const
inlineinherited

Get underlying buffer.

Definition at line 318 of file block.hpp.

Component ndn::name::Component::getSuccessor ( ) const

Definition at line 420 of file name-component.cpp.

bool ndn::Block::hasValue ( ) const
inherited

Check if the Block has value block (no type and length are encoded)

Definition at line 514 of file block.cpp.

bool ndn::Block::hasWire ( ) const
inherited

Check if the Block has fully encoded wire.

Definition at line 471 of file block.cpp.

Block::element_iterator ndn::Block::insert ( Block::element_const_iterator  pos,
const Block element 
)
inherited

insert Insert a new element in a specific position

Parameters
posPosition to insert the new element
elementElement to be inserted
Returns
An iterator that points to the first of the newly inserted elements.

Definition at line 575 of file block.cpp.

bool ndn::name::Component::isGeneric ( ) const

Check if the component is GenericComponent.

Definition at line 351 of file name-component.cpp.

bool ndn::name::Component::isImplicitSha256Digest ( ) const

Check if the component is ImplicitSha256DigestComponent.

Definition at line 357 of file name-component.cpp.

bool ndn::name::Component::isNumber ( ) const

Check if the component is nonNegativeInteger.

See also
http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding

Definition at line 191 of file name-component.cpp.

bool ndn::name::Component::isNumberWithMarker ( uint8_t  marker) const

Check if the component is NameComponentWithMarker per NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 198 of file name-component.cpp.

bool ndn::name::Component::isSegment ( ) const

Check if the component is segment number per NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 212 of file name-component.cpp.

bool ndn::name::Component::isSegmentOffset ( ) const

Check if the component is segment offset per NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 218 of file name-component.cpp.

bool ndn::name::Component::isSequenceNumber ( ) const

Check if the component is sequence number per NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 230 of file name-component.cpp.

bool ndn::name::Component::isTimestamp ( ) const

Check if the component is timestamp per NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 224 of file name-component.cpp.

bool ndn::name::Component::isVersion ( ) const

Check if the component is version per NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf

Definition at line 206 of file name-component.cpp.

ndn::Block::operator boost::asio::const_buffer ( ) const
inherited

Definition at line 459 of file block.cpp.

bool ndn::Block::operator!= ( const Block other) const
inherited

Definition at line 607 of file block.cpp.

bool ndn::name::Component::operator!= ( const Component other) const
inline

Check if this is not the same component as other.

Parameters
otherThe other Component to compare with
Returns
true if the components are not equal, otherwise false

Definition at line 540 of file name-component.hpp.

bool ndn::name::Component::operator< ( const Component other) const
inline

Check if the *this is less than the other in NDN canonical ordering.

Parameters
otherThe other Component to compare with
See also
http://named-data.net/doc/ndn-tlv/name.html#canonical-order

Definition at line 564 of file name-component.hpp.

bool ndn::name::Component::operator<= ( const Component other) const
inline

Check if the *this is less than or equal to the other in NDN canonical ordering.

Parameters
otherThe other Component to compare with
See also
http://named-data.net/doc/ndn-tlv/name.html#canonical-order

Definition at line 552 of file name-component.hpp.

bool ndn::Block::operator== ( const Block other) const
inherited

Definition at line 613 of file block.cpp.

bool ndn::name::Component::operator== ( const Component other) const
inline

Check if this is the same component as other.

Parameters
otherThe other Component to compare with.
Returns
true if the components are equal, otherwise false.

Definition at line 529 of file name-component.hpp.

bool ndn::name::Component::operator> ( const Component other) const
inline

Check if the *this is greater than the other in NDN canonical ordering.

Parameters
otherThe other Component to compare with
See also
http://named-data.net/doc/ndn-tlv/name.html#canonical-order

Definition at line 588 of file name-component.hpp.

bool ndn::name::Component::operator>= ( const Component other) const
inline

Check if the *this is greater or equal than the other in NDN canonical ordering.

Parameters
otherThe other Component to compare with
See also
http://named-data.net/doc/ndn-tlv/name.html#canonical-order

Definition at line 576 of file name-component.hpp.

void ndn::Block::parse ( ) const
inherited

Parse wire buffer into subblocks.

This method is not really const, but it does not modify any data. It simply parses contents of the buffer into subblocks

Definition at line 322 of file block.cpp.

void ndn::Block::push_back ( const Block element)
inherited

Definition at line 568 of file block.cpp.

void ndn::Block::remove ( uint32_t  type)
inherited

remove all subelements of type

Parameters
typeTLV-TYPE of subelements to remove
Precondition
parse() has been invoked

Definition at line 427 of file block.cpp.

void ndn::Block::reset ( )
inherited

Reset wire buffer of the element.

Definition at line 302 of file block.cpp.

void ndn::Block::resetWire ( )
inherited

Reset wire buffer but keep sub elements (if any)

Definition at line 312 of file block.cpp.

size_t ndn::Block::size ( ) const
inherited

Definition at line 504 of file block.cpp.

void ndn::name::Component::toEscapedString ( std::ostream &  os) const
inline

Write *this to the output stream, escaping characters according to the NDN URI Scheme.

Deprecated:
Use toUri(std::ostream&) instead

This also adds "..." to a value with zero or more "."

Parameters
osThe output stream to where write the URI escaped version *this

Definition at line 217 of file name-component.hpp.

std::string ndn::name::Component::toEscapedString ( ) const
inline

Convert *this by escaping characters according to the NDN URI Scheme.

Deprecated:
Use toUri() instead

This also adds "..." to a value with zero or more "."

Returns
The escaped string

Definition at line 233 of file name-component.hpp.

uint64_t ndn::name::Component::toNumber ( ) const

Interpret this name component as nonNegativeInteger.

See also
http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding
Returns
The integer number.

Definition at line 238 of file name-component.cpp.

uint64_t ndn::name::Component::toNumberWithMarker ( uint8_t  marker) const

Interpret this name component as NameComponentWithMarker.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Parameters
marker1-byte octet of the marker
Returns
The integer number.
Exceptions
Errorif name component does not have the specified marker. tlv::Error if format does not follow NameComponentWithMarker specification.

Definition at line 247 of file name-component.cpp.

uint64_t ndn::name::Component::toSegment ( ) const

Interpret as segment number component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Exceptions
Errorif name component does not have the specified marker. tlv::Error if format does not follow NameComponentWithMarker specification.

Definition at line 264 of file name-component.cpp.

uint64_t ndn::name::Component::toSegmentOffset ( ) const

Interpret as segment offset component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Exceptions
Errorif name component does not have the specified marker. tlv::Error if format does not follow NameComponentWithMarker specification.

Definition at line 270 of file name-component.cpp.

uint64_t ndn::name::Component::toSequenceNumber ( ) const

Interpret as sequence number component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Exceptions
Errorif name component does not have the specified marker. tlv::Error if format does not follow NameComponentWithMarker specification.

Definition at line 283 of file name-component.cpp.

time::system_clock::TimePoint ndn::name::Component::toTimestamp ( ) const

Interpret as timestamp component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Exceptions
Errorif name component does not have the specified marker. tlv::Error if format does not follow NameComponentWithMarker specification.

Definition at line 276 of file name-component.cpp.

void ndn::name::Component::toUri ( std::ostream &  os) const

Write *this to the output stream, escaping characters according to the NDN URI Scheme.

This also adds "..." to a value with zero or more "."

Parameters
osThe output stream to where write the URI escaped version *this

Definition at line 131 of file name-component.cpp.

std::string ndn::name::Component::toUri ( ) const

Convert *this by escaping characters according to the NDN URI Scheme.

This also adds "..." to a value with zero or more "."

Returns
The escaped string

Definition at line 181 of file name-component.cpp.

uint64_t ndn::name::Component::toVersion ( ) const

Interpret as version component using NDN naming conventions.

See also
http://named-data.net/doc/tech-memos/naming-conventions.pdf
Exceptions
Errorif name component does not have the specified marker. tlv::Error if format does not follow NameComponentWithMarker specification.

Definition at line 258 of file name-component.cpp.

uint32_t ndn::Block::type ( ) const
inlineinherited

Definition at line 324 of file block.hpp.

const uint8_t * ndn::Block::value ( ) const
inherited

Definition at line 520 of file block.cpp.

Buffer::const_iterator ndn::Block::value_begin ( ) const
inlineinherited

Definition at line 330 of file block.hpp.

Buffer::const_iterator ndn::Block::value_end ( ) const
inlineinherited

Definition at line 336 of file block.hpp.

size_t ndn::Block::value_size ( ) const
inherited

Definition at line 529 of file block.cpp.

const uint8_t * ndn::Block::wire ( ) const
inherited

Definition at line 495 of file block.cpp.

void ndn::name::Component::wireDecode ( const Block wire)

Decode from the wire format.

Definition at line 483 of file name-component.cpp.

template<encoding::Tag TAG>
size_t ndn::name::Component::wireEncode ( EncodingImpl< TAG > &  encoder) const

Fast encoding or block size estimation.

Definition at line 450 of file name-component.cpp.

const Block & ndn::name::Component::wireEncode ( ) const

Encode to a wire format.

Definition at line 467 of file name-component.cpp.

Field Documentation

Buffer::const_iterator ndn::Block::m_begin
protectedinherited

Definition at line 303 of file block.hpp.

shared_ptr<const Buffer> ndn::Block::m_buffer
protectedinherited

Definition at line 299 of file block.hpp.

Buffer::const_iterator ndn::Block::m_end
protectedinherited

Definition at line 304 of file block.hpp.

uint32_t ndn::Block::m_size
protectedinherited

Definition at line 305 of file block.hpp.

element_container ndn::Block::m_subBlocks
mutableprotectedinherited

Definition at line 310 of file block.hpp.

uint32_t ndn::Block::m_type
protectedinherited

Definition at line 301 of file block.hpp.

Buffer::const_iterator ndn::Block::m_value_begin
protectedinherited

Definition at line 307 of file block.hpp.

Buffer::const_iterator ndn::Block::m_value_end
protectedinherited

Definition at line 308 of file block.hpp.