22 #ifndef NDN_NAME_COMPONENT_HPP 23 #define NDN_NAME_COMPONENT_HPP 108 Component(
const uint8_t* buffer,
size_t bufferSize);
121 template<
class Iterator>
122 Component(Iterator first, Iterator last);
151 template<encoding::Tag TAG>
182 fromEscapedString(
const char* escapedString,
size_t beginOffset,
size_t endOffset);
192 return fromEscapedString(escapedString, 0, std::char_traits<char>::length(escapedString));
217 toEscapedString(std::ostream& os)
const)
233 toEscapedString()
const)
246 toUri(std::ostream& os)
const;
619 template<
class Iterator>
629 #endif // NDN_NAME_COMPONENT_HPP static Component fromNumber(uint64_t number)
Create a component encoded as nonNegativeInteger.
static Component fromSequenceNumber(uint64_t seqNo)
Create sequence number component using NDN naming conventions.
Copyright (c) 2011-2015 Regents of the University of California.
std::string toUri() const
Convert *this by escaping characters according to the NDN URI Scheme.
bool isSequenceNumber() const
Check if the component is sequence number per NDN naming conventions.
uint64_t toSequenceNumber() const
Interpret as sequence number component using NDN naming conventions.
bool operator<=(const Component &other) const
Check if the *this is less than or equal to the other in NDN canonical ordering.
static Component fromNumberWithMarker(uint8_t marker, uint64_t number)
Create a component encoded as NameComponentWithMarker.
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 t...
std::ostream & operator<<(std::ostream &os, const Component &component)
bool operator>=(const Component &other) const
Check if the *this is greater or equal than the other in NDN canonical ordering.
bool operator==(const Component &other) const
Check if this is the same component as other.
size_t value_size() const
bool isNumberWithMarker(uint8_t marker) const
Check if the component is NameComponentWithMarker per NDN naming conventions.
static Component fromTimestamp(const time::system_clock::TimePoint &timePoint)
Create sequence number component using NDN naming conventions.
const uint8_t * wire() const
Class representing a wire element of NDN-TLV packet format.
DEPRECATED(void toEscapedString(std::ostream &os) const)
Write *this to the output stream, escaping characters according to the NDN URI Scheme.
int compare(const Component &other) const
Compare this to the other Component using NDN canonical ordering.
Copyright (c) 2013-2015 Regents of the University of California.
static Component fromSegmentOffset(uint64_t offset)
Create segment offset component using NDN naming conventions.
static const uint8_t SEGMENT_OFFSET_MARKER
Segment offset marker for NDN naming conventions.
bool operator>(const Component &other) const
Check if the *this is greater than the other in NDN canonical ordering.
bool isNumber() const
Check if the component is nonNegativeInteger.
Buffer::const_iterator value_begin() const
bool isSegmentOffset() const
Check if the component is segment offset per NDN naming conventions.
static Component fromSegment(uint64_t segmentNo)
Create segment number component using NDN naming conventions.
Component getSuccessor() const
static Component fromEscapedString(const char *escapedString)
Create name::Component by decoding the escapedString according to the NDN URI Scheme.
static Component fromEscapedString(const std::string &escapedString)
Create name::Component by decoding the escapedString according to the NDN URI Scheme.
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block type type with value from a buffer value of size length.
bool isSegment() const
Check if the component is segment number per NDN naming conventions.
Component()
Create a new name::Component with an empty value.
bool operator!=(const Component &other) const
Check if this is not the same component as other.
void toUri(std::ostream &os) const
Write *this to the output stream, escaping characters according to the NDN URI Scheme.
Buffer::const_iterator value_end() const
uint64_t toSegmentOffset() const
Interpret as segment offset component using NDN naming conventions.
bool isImplicitSha256Digest() const
Check if the component is ImplicitSha256DigestComponent.
bool equals(const Component &other) const
Check if this is the same component as other.
const Block & wireEncode() const
Encode to a wire format.
uint64_t toNumber() const
Interpret this name component as nonNegativeInteger.
static const uint8_t VERSION_MARKER
Version marker for NDN naming conventions.
Component holds a read-only name component value.
static Component fromImplicitSha256Digest(const ConstBufferPtr &digest)
Create ImplicitSha256DigestComponent component.
void wireDecode(const Block &wire)
Decode from the wire format.
uint64_t toVersion() const
Interpret as version component using NDN naming conventions.
uint64_t toSegment() const
Interpret as segment number component using NDN naming conventions.
static const uint8_t SEGMENT_MARKER
Segment marker for NDN naming conventions.
bool isTimestamp() const
Check if the component is timestamp per NDN naming conventions.
static Component fromVersion(uint64_t version)
Create version component using NDN naming conventions.
bool operator<(const Component &other) const
Check if the *this is less than the other in NDN canonical ordering.
static const uint8_t SEQUENCE_NUMBER_MARKER
Sequence number marker for NDN naming conventions.
uint64_t toNumberWithMarker(uint8_t marker) const
Interpret this name component as NameComponentWithMarker.
bool isGeneric() const
Check if the component is GenericComponent.
bool isVersion() const
Check if the component is version per NDN naming conventions.
bool hasValue() const
Check if the Block has value block (no type and length are encoded)
shared_ptr< const Buffer > ConstBufferPtr
DEPRECATED(std::string toEscapedString() const)
Convert *this by escaping characters according to the NDN URI Scheme.
time::system_clock::TimePoint toTimestamp() const
Interpret as timestamp component using NDN naming conventions.
static const uint8_t TIMESTAMP_MARKER
Timestamp marker for NDN naming conventions.
Class representing a general-use automatically managed/resized buffer.
Error that can be thrown from name::Component.
Error(const std::string &what)