22 #ifndef NDN_NAME_COMPONENT_HPP 23 #define NDN_NAME_COMPONENT_HPP 153 :
Component(type, buffer.data(), buffer.size())
170 Component(uint32_t type,
const uint8_t* value,
size_t count);
188 template<
class Iterator>
197 template<
class Iterator>
223 template<encoding::Tag TAG>
237 wireDecode(
const Block& wire);
249 return fromEscapedString(std::string(input + beginOffset, input + endOffset));
259 return fromEscapedString(std::string(input));
267 fromEscapedString(
const std::string& input);
297 isNumberWithMarker(uint8_t marker)
const;
318 isByteOffset()
const;
332 isSequenceNumber()
const;
356 toNumberWithMarker(uint8_t marker)
const;
386 toByteOffset()
const;
406 toSequenceNumber()
const;
437 fromNumberWithMarker(uint8_t marker, uint64_t number);
445 fromVersion(uint64_t version);
453 fromSegment(uint64_t segmentNo);
461 fromByteOffset(uint64_t offset);
477 fromSequenceNumber(uint64_t seqNo);
490 isImplicitSha256Digest()
const;
502 fromImplicitSha256Digest(
const uint8_t* digest,
size_t digestSize);
508 isParametersSha256Digest()
const;
520 fromParametersSha256Digest(
const uint8_t* digest,
size_t digestSize);
526 return value_size() == 0;
577 getSuccessor()
const;
648 #endif // NDN_NAME_COMPONENT_HPP void setConventionDecoding(Convention convention)
Set which Naming Conventions style(s) to accept while decoding.
Same as UriFormat::CANONICAL, unless NDN_NAME_ALT_URI environment variable is set to '1'...
UriFormat
Format used for the URI representation of a name.
Component(uint32_t type, Iterator first, Iterator last)
Construct a NameComponent of TLV-TYPE type, copying TLV-VALUE from a range.
std::ostream & operator<<(std::ostream &os, const Data &data)
Same as UriFormat::ALTERNATE, unless NDN_NAME_ALT_URI environment variable is set to '0'...
void setConventionEncoding(Convention convention)
Set which Naming Conventions style to use while encoding.
Represents a TLV element of the NDN packet format.
int compare(const Component &other) const
Compare this to the other Component using NDN canonical ordering.
static Component fromEscapedString(const char *input)
Decode NameComponent from a URI component.
#define NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
Component(uint32_t type, const Buffer &buffer)
Construct a NameComponent of TLV-TYPE type, copying TLV-VALUE from buffer.
Typed name components (revision 2)
Use the library's default format; currently equivalent to UriFormat::ENV_OR_ALTERNATE.
Convention getConventionDecoding()
Return which Naming Conventions style(s) to accept while decoding.
friend bool operator>=(const Component &lhs, const Component &rhs)
friend bool operator>(const Component &lhs, const Component &rhs)
static Component fromEscapedString(const char *input, size_t beginOffset, size_t endOffset)
Decode NameComponent from a URI component.
Block makeBinaryBlock(uint32_t type, const uint8_t *value, size_t length)
Create a TLV block copying TLV-VALUE from raw buffer.
#define NDN_CXX_NODISCARD
Common includes and macros used throughout the library.
Component(const Buffer &buffer)
Construct a GenericNameComponent, copying TLV-VALUE from buffer.
bool equals(const Component &other) const
Check if this is the same component as other.
friend bool operator!=(const Component &lhs, const Component &rhs)
Always prefer the alternate format when available.
Component(ConstBufferPtr buffer)
Construct a GenericNameComponent, using TLV-VALUE from buffer.
Represents a name component.
Component(Iterator first, Iterator last)
Construct a GenericNameComponent, copying TLV-VALUE from a range.
Always use <type-number>=<percent-encoded-value> format.
Component(const uint8_t *value, size_t count)
Construct a GenericNameComponent, copying count bytes at value as TLV-VALUE.
Component markers (revision 1)
Convention getConventionEncoding()
Return which Naming Conventions style to use while encoding.
Convention
Identify a style of NDN Naming Conventions.
General-purpose automatically managed/resized buffer.
friend bool operator==(const Component &lhs, const Component &rhs)
void toUri(std::ostream &os, UriFormat format=UriFormat::DEFAULT) const
Write *this to the output stream, escaping characters according to the NDN URI format.
Error(const char *expectedType, uint32_t actualType)
shared_ptr< const Buffer > ConstBufferPtr