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/encoding/cryptopp/asn_ext.cpp b/src/encoding/cryptopp/asn_ext.cpp
index 7741314..052226a 100644
--- a/src/encoding/cryptopp/asn_ext.cpp
+++ b/src/encoding/cryptopp/asn_ext.cpp
@@ -17,7 +17,8 @@
 namespace ndn {
 
 size_t
-DEREncodeGeneralTime(CryptoPP::BufferedTransformation &bt, const time::system_clock::TimePoint& time)
+DEREncodeGeneralTime(CryptoPP::BufferedTransformation& bt,
+                     const time::system_clock::TimePoint& time)
 {
   std::string str = time::toIsoString(time);
   // For example, 20131226T232254
@@ -32,7 +33,8 @@
 }
 
 void
-BERDecodeTime(CryptoPP::BufferedTransformation &bt, time::system_clock::TimePoint& time)
+BERDecodeTime(CryptoPP::BufferedTransformation& bt,
+              time::system_clock::TimePoint& time)
 {
   byte b;
   if (!bt.Get(b) || (b != GENERALIZED_TIME && b != UTC_TIME))
@@ -48,14 +50,14 @@
 
   std::string str;
   str.assign (time_str.begin(), time_str.end());
-  
+
   if (b == UTC_TIME) {
     if (boost::lexical_cast<int>(str.substr(0,2)) < 50)
       str = "20" + str;
     else
       str = "19" + str;
   }
- 
+
   time = time::fromIsoString(str.substr(0, 8) + "T" + str.substr(8, 6));
 }
 
diff --git a/src/encoding/cryptopp/asn_ext.hpp b/src/encoding/cryptopp/asn_ext.hpp
index 9140ed9..5d726dc 100644
--- a/src/encoding/cryptopp/asn_ext.hpp
+++ b/src/encoding/cryptopp/asn_ext.hpp
@@ -15,17 +15,28 @@
 
 namespace ndn {
 
-namespace Asn {
-struct Error : public std::runtime_error { Error(const std::string& what) : std::runtime_error(what) {} };
-}
+namespace asn {
+
+class Error : public std::runtime_error
+{
+public:
+  explicit
+  Error(const std::string& what)
+    : std::runtime_error(what)
+  {
+  }
+};
+
+} // namespace asn
 
 size_t
-DEREncodeGeneralTime(CryptoPP::BufferedTransformation& bt, const time::system_clock::TimePoint& time);
+DEREncodeGeneralTime(CryptoPP::BufferedTransformation& bt,
+                     const time::system_clock::TimePoint& time);
 
 void
-BERDecodeTime(CryptoPP::BufferedTransformation& bt, time::system_clock::TimePoint& time);
+BERDecodeTime(CryptoPP::BufferedTransformation& bt,
+              time::system_clock::TimePoint& time);
 
 } // namespace ndn
 
 #endif // NDN_ASN_EXT_HPP
-