name: remove deprecated functions
Change-Id: I776c34c5a81ade92354aa8d974f5f380ae2715c4
diff --git a/ndn-cxx/name-component.cpp b/ndn-cxx/name-component.cpp
index acd53d0..ece7cc0 100644
--- a/ndn-cxx/name-component.cpp
+++ b/ndn-cxx/name-component.cpp
@@ -88,42 +88,7 @@
return (to_underlying(g_conventionDecoding) & to_underlying(Convention::TYPED)) != 0;
}
-static bool
-wantAltUri(UriFormat format)
-{
- static const auto wantAltEnv = []() -> boost::tribool {
- const char* env = std::getenv("NDN_NAME_ALT_URI");
- if (env == nullptr)
- return boost::indeterminate;
- else if (env[0] == '0')
- return false;
- else if (env[0] == '1')
- return true;
- else
- return boost::indeterminate;
- }();
-
- if (format == UriFormat::ENV_OR_CANONICAL) {
- static const bool wantAlt = boost::indeterminate(wantAltEnv) ? false : bool(wantAltEnv);
- return wantAlt;
- }
- else if (format == UriFormat::ENV_OR_ALTERNATE) {
- static const bool wantAlt = boost::indeterminate(wantAltEnv) ? true : bool(wantAltEnv);
- return wantAlt;
- }
- else {
- return format == UriFormat::ALTERNATE;
- }
-}
-
-void
-Component::ensureValid() const
-{
- if (type() < tlv::NameComponentMin || type() > tlv::NameComponentMax) {
- NDN_THROW(Error("TLV-TYPE " + to_string(type()) + " is not a valid NameComponent"));
- }
- getComponentTypeTable().get(type()).check(*this);
-}
+////////////////////////////////////////////////////////////////////////////////
Component::Component(uint32_t type)
: Block(type)
@@ -159,6 +124,15 @@
{
}
+void
+Component::ensureValid() const
+{
+ if (type() < tlv::NameComponentMin || type() > tlv::NameComponentMax) {
+ NDN_THROW(Error("TLV-TYPE " + std::to_string(type()) + " is not a valid NameComponent"));
+ }
+ getComponentTypeTable().get(type()).check(*this);
+}
+
static Component
parseUriEscapedValue(uint32_t type, const char* input, size_t len)
{
@@ -185,7 +159,7 @@
auto typePrefix = input.substr(0, equalPos);
auto type = std::strtoul(typePrefix.data(), nullptr, 10);
if (type >= tlv::NameComponentMin && type <= tlv::NameComponentMax &&
- to_string(type) == typePrefix) {
+ std::to_string(type) == typePrefix) {
size_t valuePos = equalPos + 1;
return parseUriEscapedValue(static_cast<uint32_t>(type),
input.data() + valuePos, input.size() - valuePos);
@@ -198,6 +172,34 @@
return ct->parseAltUriValue(input.substr(equalPos + 1));
}
+static bool
+wantAltUri(UriFormat format)
+{
+ static const auto wantAltEnv = []() -> boost::tribool {
+ const char* env = std::getenv("NDN_NAME_ALT_URI");
+ if (env == nullptr)
+ return boost::indeterminate;
+ else if (env[0] == '0')
+ return false;
+ else if (env[0] == '1')
+ return true;
+ else
+ return boost::indeterminate;
+ }();
+
+ if (format == UriFormat::ENV_OR_CANONICAL) {
+ static const bool wantAlt = boost::indeterminate(wantAltEnv) ? false : bool(wantAltEnv);
+ return wantAlt;
+ }
+ else if (format == UriFormat::ENV_OR_ALTERNATE) {
+ static const bool wantAlt = boost::indeterminate(wantAltEnv) ? true : bool(wantAltEnv);
+ return wantAlt;
+ }
+ else {
+ return format == UriFormat::ALTERNATE;
+ }
+}
+
void
Component::toUri(std::ostream& os, UriFormat format) const
{
@@ -430,36 +432,12 @@
return type() == tlv::ImplicitSha256DigestComponent && value_size() == util::Sha256::DIGEST_SIZE;
}
-Component
-Component::fromImplicitSha256Digest(ConstBufferPtr digest)
-{
- return {tlv::ImplicitSha256DigestComponent, std::move(digest)};
-}
-
-Component
-Component::fromImplicitSha256Digest(span<const uint8_t> digest)
-{
- return {tlv::ImplicitSha256DigestComponent, digest};
-}
-
bool
Component::isParametersSha256Digest() const noexcept
{
return type() == tlv::ParametersSha256DigestComponent && value_size() == util::Sha256::DIGEST_SIZE;
}
-Component
-Component::fromParametersSha256Digest(ConstBufferPtr digest)
-{
- return {tlv::ParametersSha256DigestComponent, std::move(digest)};
-}
-
-Component
-Component::fromParametersSha256Digest(span<const uint8_t> digest)
-{
- return {tlv::ParametersSha256DigestComponent, digest};
-}
-
////////////////////////////////////////////////////////////////////////////////
bool
diff --git a/ndn-cxx/name-component.hpp b/ndn-cxx/name-component.hpp
index 9f196f2..2c2deeb 100644
--- a/ndn-cxx/name-component.hpp
+++ b/ndn-cxx/name-component.hpp
@@ -162,37 +162,16 @@
Component(uint32_t type, span<const uint8_t> value);
/**
- * @brief Construct a GenericNameComponent, copying the TLV-VALUE from @p buffer.
+ * @brief Construct a GenericNameComponent, copying the TLV-VALUE from @p value.
*/
explicit
- Component(span<const uint8_t> buffer)
- : Component(tlv::GenericNameComponent, buffer)
+ Component(span<const uint8_t> value)
+ : Component(tlv::GenericNameComponent, value)
{
}
/**
- * @brief Construct a NameComponent of TLV-TYPE @p type, copying @p count bytes at @p value as
- * TLV-VALUE.
- * @deprecated Use Component(uint32_t, span<const uint8_t>)
- */
- [[deprecated("use the constructor that takes a span<>")]]
- Component(uint32_t type, const uint8_t* value, size_t count)
- : Component(type, {value, count})
- {
- }
-
- /**
- * @brief Construct a GenericNameComponent, copying @p count bytes at @p value as TLV-VALUE.
- * @deprecated Use Component(span<const uint8_t>)
- */
- [[deprecated("use the constructor that takes a span<>")]]
- Component(const uint8_t* value, size_t count)
- : Component(tlv::GenericNameComponent, {value, count})
- {
- }
-
- /**
- * @brief Construct a NameComponent of TLV-TYPE @p type, copying TLV-VALUE from a range.
+ * @brief Construct a NameComponent of TLV-TYPE @p type, copying the TLV-VALUE from a range.
* @tparam Iterator an @c InputIterator dereferencing to a one-octet value type. More efficient
* implementation is available when it is a @c RandomAccessIterator.
* @param type the TLV-TYPE.
@@ -206,7 +185,7 @@
}
/**
- * @brief Construct a GenericNameComponent, copying TLV-VALUE from a range.
+ * @brief Construct a GenericNameComponent, copying the TLV-VALUE from a range.
*/
template<class Iterator>
Component(Iterator first, Iterator last)
@@ -215,7 +194,7 @@
}
/**
- * @brief Construct a GenericNameComponent, copying TLV-VALUE from a null-terminated string.
+ * @brief Construct a GenericNameComponent, copying the TLV-VALUE from a null-terminated string.
*
* Bytes from the string are copied as is, and not interpreted as URI component.
*/
@@ -223,7 +202,7 @@
Component(const char* str);
/**
- * @brief Construct a GenericNameComponent, copying TLV-VALUE from a string.
+ * @brief Construct a GenericNameComponent, copying the TLV-VALUE from a string.
*
* Bytes from the string are copied as is, and not interpreted as URI component.
*/
@@ -493,22 +472,6 @@
isImplicitSha256Digest() const noexcept;
/**
- * @brief Create ImplicitSha256DigestComponent component
- * @deprecated Use Component(uint32_t, ConstBufferPtr)
- */
- [[deprecated("use one of the name::Component constructors")]]
- static Component
- fromImplicitSha256Digest(ConstBufferPtr digest);
-
- /**
- * @brief Create ImplicitSha256DigestComponent component
- * @deprecated Use Component(uint32_t, span<const uint8_t>)
- */
- [[deprecated("use one of the name::Component constructors")]]
- static Component
- fromImplicitSha256Digest(span<const uint8_t> digest);
-
- /**
* @brief Check if the component is a ParametersSha256DigestComponent
* @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/NameComponentType
* @sa https://docs.named-data.net/NDN-packet-spec/0.3/name.html#parameters-digest-component
@@ -517,22 +480,6 @@
isParametersSha256Digest() const noexcept;
/**
- * @brief Create ParametersSha256DigestComponent component
- * @deprecated Use Component(uint32_t, ConstBufferPtr)
- */
- [[deprecated("use one of the name::Component constructors")]]
- static Component
- fromParametersSha256Digest(ConstBufferPtr digest);
-
- /**
- * @brief Create ParametersSha256DigestComponent component
- * @deprecated Use Component(uint32_t, span<const uint8_t>)
- */
- [[deprecated("use one of the name::Component constructors")]]
- static Component
- fromParametersSha256Digest(span<const uint8_t> digest);
-
- /**
* @brief Check if the component is a KeywordNameComponent
* @sa https://redmine.named-data.net/projects/ndn-tlv/wiki/NameComponentType
*/
diff --git a/ndn-cxx/name.hpp b/ndn-cxx/name.hpp
index 98ecb97..936cf5b 100644
--- a/ndn-cxx/name.hpp
+++ b/ndn-cxx/name.hpp
@@ -318,30 +318,6 @@
return append(Component(tlv::GenericNameComponent, value));
}
- /**
- * @brief Append a `NameComponent` of TLV-TYPE @p type, copying @p count bytes at @p value as TLV-VALUE.
- * @return A reference to this Name, to allow chaining.
- * @deprecated Use append(uint32_t, span<const uint8_t>)
- */
- [[deprecated("use the overload that takes a span<>")]]
- Name&
- append(uint32_t type, const uint8_t* value, size_t count)
- {
- return append(type, make_span(value, count));
- }
-
- /**
- * @brief Append a `GenericNameComponent`, copying @p count bytes at @p value as TLV-VALUE.
- * @return A reference to this Name, to allow chaining.
- * @deprecated Use append(span<const uint8_t>)
- */
- [[deprecated("use the overload that takes a span<>")]]
- Name&
- append(const uint8_t* value, size_t count)
- {
- return append(make_span(value, count));
- }
-
/** @brief Append a `NameComponent` of TLV-TYPE @p type, copying TLV-VALUE from a range.
* @tparam Iterator an @c InputIterator dereferencing to a one-octet value type. More efficient
* implementation is available when it is a @c RandomAccessIterator.
diff --git a/ndn-cxx/util/regex/regex-pseudo-matcher.cpp b/ndn-cxx/util/regex/regex-pseudo-matcher.cpp
index 9a432e4..b204f2f 100644
--- a/ndn-cxx/util/regex/regex-pseudo-matcher.cpp
+++ b/ndn-cxx/util/regex/regex-pseudo-matcher.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -33,7 +33,7 @@
void
RegexPseudoMatcher::setMatchResult(const std::string& str)
{
- m_matchResult.emplace_back(reinterpret_cast<const uint8_t*>(str.data()), str.size());
+ m_matchResult.emplace_back(str);
}
void