name: remove deprecated functions
Change-Id: I776c34c5a81ade92354aa8d974f5f380ae2715c4
This commit is contained in:
1 parent
0910343957
commit
23483c76d5
4 files changed
+48
-147
No files matched your search
+39
-61
@@ -88,42 +88,7 @@ canDecodeTypedConvention() noexcept
|
||||
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 @@ Component::Component(const std::string& str)
|
||||
{
|
||||
}
|
||||
|
||||
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 @@ Component::fromEscapedString(const std::string& input)
|
||||
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 @@ Component::fromEscapedString(const std::string& input)
|
||||
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 @@ Component::isImplicitSha256Digest() const noexcept
|
||||
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
|
||||
|
||||
@@ -162,37 +162,16 @@ public: // constructors
|
||||
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 @@ public: // constructors
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 @@ public: // constructors
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 @@ public: // constructors
|
||||
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.
|
||||
*/
|
||||
@@ -492,22 +471,6 @@ public: // commonly used TLV-TYPEs
|
||||
bool
|
||||
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
|
||||
@@ -516,22 +479,6 @@ public: // commonly used TLV-TYPEs
|
||||
bool
|
||||
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
|
||||
|
||||
@@ -318,30 +318,6 @@ public: // modifiers
|
||||
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.
|
||||
|
||||
@@ -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 @@ RegexPseudoMatcher::RegexPseudoMatcher()
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user