name: alternative URI syntax for component types used in naming conventions
Refs: #4777
Change-Id: I4647fee54dffe104ca3cc31d67b0ad44fcf0de76
diff --git a/ndn-cxx/name-component.cpp b/ndn-cxx/name-component.cpp
index b7b9333..f41fda0 100644
--- a/ndn-cxx/name-component.cpp
+++ b/ndn-cxx/name-component.cpp
@@ -163,7 +163,7 @@
auto ct = detail::getComponentTypeTable().findByUriPrefix(typePrefix);
if (ct == nullptr) {
- NDN_THROW(Error("Incorrect TLV-TYPE '" + typePrefix + "' in NameComponent URI"));
+ NDN_THROW(Error("Unknown TLV-TYPE '" + typePrefix + "' in NameComponent URI"));
}
return ct->parseAltUriValue(input.substr(equalPos + 1));
}
@@ -187,16 +187,15 @@
bool
Component::isNumber() const
{
- return (value_size() == 1 || value_size() == 2 ||
- value_size() == 4 || value_size() == 8);
+ return value_size() == 1 || value_size() == 2 ||
+ value_size() == 4 || value_size() == 8;
}
bool
Component::isNumberWithMarker(uint8_t marker) const
{
- return (!empty() && value()[0] == marker &&
- (value_size() == 2 || value_size() == 3 ||
- value_size() == 5 || value_size() == 9));
+ return (value_size() == 2 || value_size() == 3 ||
+ value_size() == 5 || value_size() == 9) && value()[0] == marker;
}
bool