data: remove deprecated {get,set}FinalBlockId()
Change-Id: Id2baaddae26d4afe0cb35b43f44f1eba9a311da6
diff --git a/src/data.cpp b/src/data.cpp
index f72673f..e6104c9 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -309,20 +309,6 @@
return *this;
}
-name::Component
-Data::getFinalBlockId() const
-{
- return m_metaInfo.getFinalBlockId();
-}
-
-Data&
-Data::setFinalBlockId(const name::Component& finalBlockId)
-{
- resetWire();
- m_metaInfo.setFinalBlockId(finalBlockId);
- return *this;
-}
-
bool
operator==(const Data& lhs, const Data& rhs)
{
diff --git a/src/data.hpp b/src/data.hpp
index 9541d6b..554c056 100644
--- a/src/data.hpp
+++ b/src/data.hpp
@@ -227,20 +227,6 @@
Data&
setFinalBlock(optional<name::Component> finalBlockId);
- /** @deprecated Use @c getFinalBlock
- * @sa MetaInfo::getFinalBlockId
- */
- [[deprecated("use getFinalBlock")]]
- name::Component
- getFinalBlockId() const;
-
- /** @deprecated Use @c setFinalBlock
- * @sa MetaInfo::setFinalBlockId
- */
- [[deprecated("use setFinalBlock")]]
- Data&
- setFinalBlockId(const name::Component& finalBlockId);
-
protected:
/** @brief Clear wire encoding and cached FullName
* @note This does not clear the SignatureValue.
diff --git a/src/meta-info.cpp b/src/meta-info.cpp
index f46784c..0c4852c 100644
--- a/src/meta-info.cpp
+++ b/src/meta-info.cpp
@@ -70,15 +70,6 @@
return *this;
}
-MetaInfo&
-MetaInfo::setFinalBlockId(const name::Component& finalBlockId)
-{
- if (finalBlockId.isGeneric() && finalBlockId.empty()) {
- return setFinalBlock(nullopt);
- }
- return setFinalBlock(finalBlockId);
-}
-
const std::list<Block>&
MetaInfo::getAppMetaInfo() const
{
diff --git a/src/meta-info.hpp b/src/meta-info.hpp
index 53ff8b9..610d113 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -128,29 +128,6 @@
MetaInfo&
setFinalBlock(optional<name::Component> finalBlockId);
- /** @brief return FinalBlockId
- * @deprecated use @c getFinalBlock
- *
- * If FinalBlockId element is omitted, returns a default-constructed @c name::Component.
- * This is indistinguishable from having an empty GenericNameComponent as FinalBlockId.
- */
- [[deprecated("use getFinalBlock")]]
- name::Component
- getFinalBlockId() const
- {
- return getFinalBlock().value_or(name::Component());
- }
-
- /** @brief set FinalBlockId
- * @deprecated use @c setFinalBlock
- *
- * Passing a default-constructed @c name::Component removes FinalBlockId element.
- * This API does not support adding an empty GenericNameComponent as FinalBlockId.
- */
- [[deprecated("use setFinalBlock")]]
- MetaInfo&
- setFinalBlockId(const name::Component& finalBlockId);
-
public: // app-defined MetaInfo items
/**
* @brief Get all app-defined MetaInfo items
diff --git a/tests/unit-tests/meta-info.t.cpp b/tests/unit-tests/meta-info.t.cpp
index 57371c3..2a2dac3 100644
--- a/tests/unit-tests/meta-info.t.cpp
+++ b/tests/unit-tests/meta-info.t.cpp
@@ -37,7 +37,6 @@
BOOST_CHECK_EQUAL(a.getType(), tlv::ContentType_Blob);
BOOST_CHECK_EQUAL(a.getFreshnessPeriod(), 0_ms);
BOOST_CHECK(!a.getFinalBlock());
- BOOST_CHECK_EQUAL(a.getFinalBlockId(), name::Component());
BOOST_CHECK_EQUAL(a, a);
MetaInfo b;
@@ -54,12 +53,11 @@
BOOST_CHECK_EQUAL(a.getType(), tlv::ContentType_Link);
BOOST_CHECK_EQUAL(a.getFreshnessPeriod(), 26290_ms);
BOOST_CHECK_EQUAL(*a.getFinalBlock(), name::Component("A"));
- BOOST_CHECK_EQUAL(a.getFinalBlockId(), name::Component("A"));
BOOST_CHECK_NE(a, b);
b.setType(a.getType());
b.setFreshnessPeriod(a.getFreshnessPeriod());
- b.setFinalBlockId(a.getFinalBlockId());
+ b.setFinalBlock(a.getFinalBlock());
BOOST_CHECK_EQUAL(b.wireEncode(), wire2);
BOOST_CHECK_EQUAL(a, b);
@@ -73,7 +71,7 @@
b.setType(a.getType());
b.setFreshnessPeriod(a.getFreshnessPeriod());
- b.setFinalBlockId(a.getFinalBlockId());
+ b.setFinalBlock(a.getFinalBlock());
BOOST_CHECK_EQUAL(b.wireEncode(), wire3);
BOOST_CHECK_EQUAL(a, b);
}
@@ -89,7 +87,7 @@
std::string ss[5] = {"h", "hello", "hello, world", "hello, world, alex",
"hello, world, alex, I am Xiaoke Jiang"};
- for (int i = 0; i < 5; i++) {
+ for (size_t i = 0; i < 5; i++) {
uint32_t type = 128 + i * 10;
info1.addAppMetaInfo(makeNonNegativeIntegerBlock(type, ints[i]));
type += 5;
@@ -116,7 +114,6 @@
// for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
// printf("0x%02x, ", *it);
// }
-
const uint8_t METAINFO[] = {0x14, 0x77, 0x18, 0x01, 0xc4, 0x19, 0x02, 0x0e, 0x10, 0x1a, 0x0c,
0x08, 0x0a, 0x2f, 0x61, 0x74, 0x74, 0x2f, 0x66, 0x69, 0x6e, 0x61,
0x6c, 0x80, 0x01, 0x80, 0x85, 0x01, 0x68, 0x8a, 0x01, 0x81, 0x8f,
@@ -135,18 +132,17 @@
MetaInfo info2;
info2.wireDecode(Block(METAINFO, sizeof(METAINFO)));
- for (int i = 0; i < 5; i++) {
+ for (size_t i = 0; i < 5; i++) {
uint32_t tlvType = 128 + i * 10;
const Block* block = info2.findAppMetaInfo(tlvType);
- BOOST_REQUIRE(block != 0);
+ BOOST_REQUIRE(block != nullptr);
BOOST_CHECK_EQUAL(readNonNegativeInteger(*block), ints[i]);
tlvType += 5;
block = info2.findAppMetaInfo(tlvType);
- BOOST_REQUIRE(block != 0);
+ BOOST_REQUIRE(block != nullptr);
- std::string s3 = std::string(reinterpret_cast<const char*>(block->value()),
- block->value_size());
+ std::string s3(reinterpret_cast<const char*>(block->value()), block->value_size());
BOOST_CHECK_EQUAL(s3, ss[i]);
}
}