Use const where possible.
diff --git a/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp b/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
index ad562ff..8c39cf1 100644
--- a/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
+++ b/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
@@ -37,8 +37,8 @@
return gotElementEnd();
}
- unsigned int getOffset() { return base_.offset; }
- bool gotElementEnd() { return base_.gotElementEnd != 0; }
+ unsigned int getOffset() const { return base_.offset; }
+ bool gotElementEnd() const { return base_.gotElementEnd != 0; }
private:
struct ndn_BinaryXMLStructureDecoder base_;
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
index a92237e..2cb6de6 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
@@ -17,7 +17,7 @@
BinaryXMLWireFormat BinaryXMLWireFormat::instance_;
-void BinaryXMLWireFormat::encodeName(Name &name, vector<unsigned char> &output)
+void BinaryXMLWireFormat::encodeName(const Name &name, vector<unsigned char> &output)
{
struct ndn_Name nameStruct;
struct ndn_NameComponent components[100];
@@ -46,7 +46,7 @@
name.set(nameStruct);
}
-void BinaryXMLWireFormat::encodeInterest(Interest &interest, vector<unsigned char> &output)
+void BinaryXMLWireFormat::encodeInterest(const Interest &interest, vector<unsigned char> &output)
{
struct ndn_Interest interestStruct;
struct ndn_NameComponent components[100];
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
index 5b3d065..ad3a88c 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
@@ -12,10 +12,10 @@
class BinaryXMLWireFormat : public WireFormat {
public:
- virtual void encodeName(Name &name, std::vector<unsigned char> &output);
+ virtual void encodeName(const Name &name, std::vector<unsigned char> &output);
virtual void decodeName(Name &name, const unsigned char *input, unsigned int inputLength);
- virtual void encodeInterest(Interest &interest, std::vector<unsigned char> &output);
+ virtual void encodeInterest(const Interest &interest, std::vector<unsigned char> &output);
virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
static BinaryXMLWireFormat &instance() { return instance_; }
diff --git a/ndn-cpp/encoding/WireFormat.cpp b/ndn-cpp/encoding/WireFormat.cpp
index f3906fd..3217fe1 100644
--- a/ndn-cpp/encoding/WireFormat.cpp
+++ b/ndn-cpp/encoding/WireFormat.cpp
@@ -10,7 +10,7 @@
namespace ndn {
-void WireFormat::encodeName(Name &name, vector<unsigned char> &output)
+void WireFormat::encodeName(const Name &name, vector<unsigned char> &output)
{
throw logic_error("unimplemented");
}
@@ -19,7 +19,7 @@
throw logic_error("unimplemented");
}
-void WireFormat::encodeInterest(Interest &interest, vector<unsigned char> &output)
+void WireFormat::encodeInterest(const Interest &interest, vector<unsigned char> &output)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/encoding/WireFormat.hpp b/ndn-cpp/encoding/WireFormat.hpp
index d9811cd..f09ae22 100644
--- a/ndn-cpp/encoding/WireFormat.hpp
+++ b/ndn-cpp/encoding/WireFormat.hpp
@@ -15,10 +15,10 @@
class WireFormat {
public:
- virtual void encodeName(Name &name, std::vector<unsigned char> &output);
+ virtual void encodeName(const Name &name, std::vector<unsigned char> &output);
virtual void decodeName(Name &name, const unsigned char *input, unsigned int inputLength);
- virtual void encodeInterest(Interest &interest, std::vector<unsigned char> &output);
+ virtual void encodeInterest(const Interest &interest, std::vector<unsigned char> &output);
virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
// etc. for each type of object.