name: Introducing new name::Component::is* methods
These methods allow checking if the name component follows the specific
naming convention without relying on exception handling.
Change-Id: I9799c860ad203f777d7ad6671c9a13506388c1c7
Refs: #2088
diff --git a/src/name-component.hpp b/src/name-component.hpp
index 7213f9a..ea68084 100644
--- a/src/name-component.hpp
+++ b/src/name-component.hpp
@@ -255,6 +255,59 @@
std::string
toUri() const;
+ ////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @brief Check if the component is nonNegativeInteger
+ * @see http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding
+ */
+ bool
+ isNumber() const;
+
+ /**
+ * @brief Check if the component is NameComponentWithMarker per NDN naming conventions
+ * @see http://named-data.net/doc/tech-memos/naming-conventions.pdf
+ */
+ bool
+ isNumberWithMarker(uint8_t marker) const;
+
+ /**
+ * @brief Check if the component is version per NDN naming conventions
+ * @see http://named-data.net/doc/tech-memos/naming-conventions.pdf
+ */
+ bool
+ isVersion() const;
+
+ /**
+ * @brief Check if the component is segment number per NDN naming conventions
+ * @see http://named-data.net/doc/tech-memos/naming-conventions.pdf
+ */
+ bool
+ isSegment() const;
+
+ /**
+ * @brief Check if the component is segment offset per NDN naming conventions
+ * @see http://named-data.net/doc/tech-memos/naming-conventions.pdf
+ */
+ bool
+ isSegmentOffset() const;
+
+ /**
+ * @brief Check if the component is timestamp per NDN naming conventions
+ * @see http://named-data.net/doc/tech-memos/naming-conventions.pdf
+ */
+ bool
+ isTimestamp() const;
+
+ /**
+ * @brief Check if the component is sequence number per NDN naming conventions
+ * @see http://named-data.net/doc/tech-memos/naming-conventions.pdf
+ */
+ bool
+ isSequenceNumber() const;
+
+ ////////////////////////////////////////////////////////////////////////////////
+
/**
* @brief Interpret this name component as nonNegativeInteger
*
@@ -333,6 +386,8 @@
uint64_t
toSequenceNumber() const;
+ ////////////////////////////////////////////////////////////////////////////////
+
/**
* @brief Create a component encoded as nonNegativeInteger
*