DER encoding: Make the Any stub a class with stub constructors.
diff --git a/ndn-cpp/encoding/der/visitor/simple-visitor.cpp b/ndn-cpp/encoding/der/visitor/simple-visitor.cpp
index f71ad56..5845e22 100644
--- a/ndn-cpp/encoding/der/visitor/simple-visitor.cpp
+++ b/ndn-cpp/encoding/der/visitor/simple-visitor.cpp
@@ -28,7 +28,6 @@
return Any(result);
}
-#if 0
Any
SimpleVisitor::visit(DerInteger& derInteger)
{
@@ -38,7 +37,7 @@
Any
SimpleVisitor::visit(DerPrintableString& derPStr)
{
- return Any(string(derPStr.getPayload().buf(), derPStr.getPayload().size()));
+ return Any(string((const char*)&derPStr.getPayload()[0], derPStr.getPayload().size()));
}
Any
@@ -56,7 +55,7 @@
Any
SimpleVisitor::visit(DerOctetString& derOStr)
{
- Ptr<Blob> result = Ptr<Blob>(new Blob(derOStr.getPayload().buf(), derOStr.getPayload().size()));
+ vector<uint8_t> result(derOStr.getPayload());
return Any(result);
}
@@ -66,7 +65,7 @@
vector<int> intList;
int offset = 0;
- Blob & blob = derOid.getPayload();
+ vector<uint8_t>& blob = derOid.getPayload();
int first = blob[offset];
@@ -88,10 +87,11 @@
return Any();
}
+#if 0 // TODO: Implmenent alternative to boost::posix_time::from_iso_string.
Any
SimpleVisitor::visit(DerGtime& derGtime)
{
- string str(derGtime.getPayload().buf() , derGtime.getPayload().size());
+ string str((const char*)&derGtime.getPayload()[0], derGtime.getPayload().size());
return Any(boost::posix_time::from_iso_string(str.substr(0, 8) + "T" + str.substr(8, 6)));
}
#endif
diff --git a/ndn-cpp/encoding/der/visitor/visitor.hpp b/ndn-cpp/encoding/der/visitor/visitor.hpp
index a251701..6d04703 100644
--- a/ndn-cpp/encoding/der/visitor/visitor.hpp
+++ b/ndn-cpp/encoding/der/visitor/visitor.hpp
@@ -13,9 +13,14 @@
namespace der {
-// TODO: We want to implement an any type, but avoid boost::any which is not in the C++ standard library.
-typedef void *Any;
-
+// TODO: This is a stub. We want to implement an any type, but avoid boost::any which is not in the C++ standard library.
+class Any {
+public:
+ Any() {}
+
+ template<class T> Any(const T& value) {}
+};
+
class DerBool;
class DerInteger;
class DerPrintableString;