data: do not encode a Content element if not set

Add Data::hasContent() and Data::unsetContent().
Change the behavior of Interest::setApplicationParameters(Block{}) for
consistency with the corresponding getter and with Data::setContent().

Change-Id: I4cc9058912510db0dfe3da614adee727db149415
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index b675503..2887c99 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -897,12 +897,11 @@
   BOOST_CHECK(!i.hasApplicationParameters());
 
   // Block overload
-  i.setApplicationParameters(Block{});
-  BOOST_CHECK_EQUAL(i.getApplicationParameters(), "2400"_block);
   i.setApplicationParameters("2401C0"_block);
   BOOST_CHECK_EQUAL(i.getApplicationParameters(), "2401C0"_block);
   i.setApplicationParameters("8001C1"_block);
   BOOST_CHECK_EQUAL(i.getApplicationParameters(), "24038001C1"_block);
+  BOOST_CHECK_THROW(i.setApplicationParameters(Block{}), std::invalid_argument);
 
   // raw buffer+size overload
   i.setApplicationParameters(PARAMETERS1, sizeof(PARAMETERS1));
@@ -1159,7 +1158,7 @@
   });
 
   // Test failure with missing InterestSignatureInfo
-  i3.setApplicationParameters(Block());
+  i3.setApplicationParameters(nullptr, 0);
   BOOST_CHECK_EXCEPTION(i3.extractSignedRanges(), tlv::Error, [] (const auto& e) {
     return e.what() == "Interest missing InterestSignatureInfo"s;
   });