src: Improving consistency and correcting code style

As of this commit, all data structures can be directly constructed from
wire format.

This commit excludes full correction of code style in security/ and
tools/ndnsec*, which will be part of a different commit.

Change-Id: I121ac1f81948bc7468990df52cdefeb2988d91a1
Refs: #1403
diff --git a/src/security/sec-public-info-memory.hpp b/src/security/sec-public-info-memory.hpp
index 16001c8..58d8529 100644
--- a/src/security/sec-public-info-memory.hpp
+++ b/src/security/sec-public-info-memory.hpp
@@ -18,7 +18,15 @@
  */
 class SecPublicInfoMemory : public SecPublicInfo {
 public:
-  struct Error : public SecPublicInfo::Error { Error(const std::string &what) : SecPublicInfo::Error(what) {} };
+  class Error : public SecPublicInfo::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : SecPublicInfo::Error(what)
+    {
+    }
+  };
 
   virtual
   ~SecPublicInfoMemory();
@@ -32,10 +40,10 @@
   virtual bool
   revokeIdentity();
 
-  virtual bool 
+  virtual bool
   doesPublicKeyExist(const Name& keyName);
 
-  virtual void 
+  virtual void
   addPublicKey(const Name& keyName, KeyType keyType, const PublicKey& publicKeyDer);
 
   virtual ptr_lib::shared_ptr<PublicKey>
@@ -44,74 +52,74 @@
   virtual bool
   doesCertificateExist(const Name& certificateName);
 
-  virtual void 
+  virtual void
   addCertificate(const IdentityCertificate& certificate);
 
-  virtual ptr_lib::shared_ptr<IdentityCertificate> 
-  getCertificate(const Name &certificateName);
+  virtual ptr_lib::shared_ptr<IdentityCertificate>
+  getCertificate(const Name& certificateName);
 
 
-  virtual Name 
+  virtual Name
   getDefaultIdentity();
 
-  virtual Name 
+  virtual Name
   getDefaultKeyNameForIdentity(const Name& identityName);
 
-  virtual Name 
+  virtual Name
   getDefaultCertificateNameForKey(const Name& keyName);
 
   virtual void
-  getAllIdentities(std::vector<Name> &nameList, bool isDefault);
+  getAllIdentities(std::vector<Name>& nameList, bool isDefault);
 
   virtual void
-  getAllKeyNames(std::vector<Name> &nameList, bool isDefault);
+  getAllKeyNames(std::vector<Name>& nameList, bool isDefault);
 
   virtual void
-  getAllKeyNamesOfIdentity(const Name& identity, std::vector<Name> &nameList, bool isDefault);
-    
-  virtual void
-  getAllCertificateNames(std::vector<Name> &nameList, bool isDefault);
+  getAllKeyNamesOfIdentity(const Name& identity, std::vector<Name>& nameList, bool isDefault);
 
   virtual void
-  getAllCertificateNamesOfKey(const Name& keyName, std::vector<Name> &nameList, bool isDefault);
+  getAllCertificateNames(std::vector<Name>& nameList, bool isDefault);
+
+  virtual void
+  getAllCertificateNamesOfKey(const Name& keyName, std::vector<Name>& nameList, bool isDefault);
 
 protected:
-  virtual void 
+  virtual void
   setDefaultIdentityInternal(const Name& identityName);
 
-  virtual void 
+  virtual void
   setDefaultKeyNameForIdentityInternal(const Name& keyName);
 
-  virtual void 
-  setDefaultCertificateNameForKeyInternal(const Name& certificateName);  
+  virtual void
+  setDefaultCertificateNameForKeyInternal(const Name& certificateName);
 
   virtual void
-  deleteCertificateInfo(const Name &certificateName);
+  deleteCertificateInfo(const Name& certificateName);
 
   virtual void
-  deletePublicKeyInfo(const Name &keyName);
+  deletePublicKeyInfo(const Name& keyName);
 
   virtual void
-  deleteIdentityInfo(const Name &identity);
+  deleteIdentityInfo(const Name& identity);
 
-  
+
 private:
   class KeyRecord {
   public:
-    KeyRecord(KeyType keyType, const PublicKey &key)
+    KeyRecord(KeyType keyType, const PublicKey& key)
     : keyType_(keyType), key_(key)
     {
     }
-    
+
     const KeyType getKeyType() const { return keyType_; }
-    
+
     const PublicKey& getKey() { return key_; }
-    
+
   private:
     KeyType   keyType_;
     PublicKey key_;
   };
-  
+
   std::vector<std::string> identityStore_; /**< A list of name URI. */
   std::string defaultIdentity_;            /**< The default identity in identityStore_, or "" if not defined. */
   Name defaultKeyName_;
@@ -119,9 +127,9 @@
 
   typedef std::map< std::string, ptr_lib::shared_ptr<KeyRecord> > KeyStore; /**< The map key is the keyName.toUri() */
   typedef std::map< std::string, ptr_lib::shared_ptr<IdentityCertificate> > CertificateStore; /**< The map key is the certificateName.toUri() */
-  
-  KeyStore keyStore_; 
-  CertificateStore certificateStore_;                    
+
+  KeyStore keyStore_;
+  CertificateStore certificateStore_;
 };
 
 } // namespace ndn