Merge branch 'issue/1091-const-CertificateSubjectDescription-getOidString'. Refs #1091.
http://redmine.named-data.net/issues/1091
diff --git a/include/ndn-cpp/encoding/oid.hpp b/include/ndn-cpp/encoding/oid.hpp
index bc0dd25..f217889 100644
--- a/include/ndn-cpp/encoding/oid.hpp
+++ b/include/ndn-cpp/encoding/oid.hpp
@@ -39,20 +39,20 @@
}
std::string
- toString();
+ toString() const;
- bool operator == (const OID& oid)
+ bool operator == (const OID& oid) const
{
return equal(oid);
}
- bool operator != (const OID& oid)
+ bool operator != (const OID& oid) const
{
return !equal(oid);
}
private:
- bool equal(const OID& oid);
+ bool equal(const OID& oid) const;
std::vector<int> oid_;
};
diff --git a/include/ndn-cpp/security/certificate/certificate-extension.hpp b/include/ndn-cpp/security/certificate/certificate-extension.hpp
index c67434d..b47b880 100644
--- a/include/ndn-cpp/security/certificate/certificate-extension.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-extension.hpp
@@ -56,10 +56,10 @@
* @return the encoded DER syntax tree
*/
ptr_lib::shared_ptr<der::DerNode>
- toDer();
+ toDer() const;
Blob
- toDerBlob();
+ toDerBlob() const;
inline const OID&
getOid() const { return extensionId_; }
diff --git a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
index 90ff7fe..30af6bf 100644
--- a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
+++ b/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
@@ -46,10 +46,10 @@
* @return The encoded DER syntax tree.
*/
ptr_lib::shared_ptr<der::DerNode>
- toDer();
+ toDer() const;
std::string
- getOidString()
+ getOidString() const
{
return oid_.toString();
}
diff --git a/src/encoding/oid.cpp b/src/encoding/oid.cpp
index db1fbc3..633d1cf 100644
--- a/src/encoding/oid.cpp
+++ b/src/encoding/oid.cpp
@@ -34,11 +34,11 @@
}
}
-string OID::toString()
+string OID::toString() const
{
ostringstream convert;
- vector<int>::iterator it = oid_.begin();
+ vector<int>::const_iterator it = oid_.begin();
for(; it < oid_.end(); it++){
if(it != oid_.begin())
convert << ".";
@@ -48,7 +48,7 @@
return convert.str();
}
-bool OID::equal(const OID& oid)
+bool OID::equal(const OID& oid) const
{
vector<int>::const_iterator i = oid_.begin();
vector<int>::const_iterator j = oid.oid_.begin();
diff --git a/src/security/certificate/certificate-extension.cpp b/src/security/certificate/certificate-extension.cpp
index f081f2a..d9297a9 100644
--- a/src/security/certificate/certificate-extension.cpp
+++ b/src/security/certificate/certificate-extension.cpp
@@ -15,7 +15,7 @@
namespace ndn {
ptr_lib::shared_ptr<der::DerNode>
-CertificateExtension::toDer()
+CertificateExtension::toDer() const
{
ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence);
@@ -33,7 +33,7 @@
}
Blob
-CertificateExtension::toDerBlob()
+CertificateExtension::toDerBlob() const
{
blob_stream blobStream;
der::OutputIterator& start = reinterpret_cast<der::OutputIterator&>(blobStream);
diff --git a/src/security/certificate/certificate-subject-description.cpp b/src/security/certificate/certificate-subject-description.cpp
index 9aa511f..3571f7f 100644
--- a/src/security/certificate/certificate-subject-description.cpp
+++ b/src/security/certificate/certificate-subject-description.cpp
@@ -14,7 +14,7 @@
namespace ndn {
ptr_lib::shared_ptr<der::DerNode>
-CertificateSubjectDescription::toDer()
+CertificateSubjectDescription::toDer() const
{
ptr_lib::shared_ptr<der::DerSequence> root(new der::DerSequence());