namespace: try to resolve ndn and std conflicts

Change-Id: I141ead4b8f30ce75bae73974e47e6e5acd75a296
diff --git a/src/browse-contact-dialog.cpp b/src/browse-contact-dialog.cpp
index 5cf2ba9..50ca82d 100644
--- a/src/browse-contact-dialog.cpp
+++ b/src/browse-contact-dialog.cpp
@@ -16,7 +16,6 @@
 #include "profile.h"
 #endif
 
-using namespace std;
 using namespace ndn;
 using namespace chronos;
 
diff --git a/src/chat-dialog.cpp b/src/chat-dialog.cpp
index ba2cda5..74b75c3 100644
--- a/src/chat-dialog.cpp
+++ b/src/chat-dialog.cpp
@@ -28,8 +28,8 @@
 #include "logging.h"
 #endif
 
-using namespace std;
 using namespace ndn;
+using ndn::shared_ptr;
 using namespace chronos;
 
 INIT_LOGGER("ChatDialog");
@@ -47,7 +47,7 @@
                        const IdentityCertificate& myCertificate,
                        const Name& chatroomPrefix,
 		       const Name& localPrefix,
-                       const string& nick,
+                       const std::string& nick,
                        bool withSecurity,
 		       QWidget* parent) 
   : QDialog(parent)
@@ -176,7 +176,7 @@
 }
 
 void
-ChatDialog::processTreeUpdateWrapper(const vector<Sync::MissingDataInfo>& v, Sync::SyncSocket *sock)
+ChatDialog::processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>& v, Sync::SyncSocket *sock)
 {
   emit processTreeUpdate(v);
   _LOG_DEBUG("<<< Tree update signal emitted");
@@ -196,7 +196,7 @@
 }
 
 void
-ChatDialog::processRemoveWrapper(string prefix)
+ChatDialog::processRemoveWrapper(std::string prefix)
 {
   _LOG_DEBUG("Sync REMOVE signal received for prefix: " << prefix);
 }
@@ -402,7 +402,7 @@
 
 void
 ChatDialog::onReplyValidationFailed(const shared_ptr<const Data>& data,
-                                    const string& failureInfo)
+                                    const std::string& failureInfo)
 {
   _LOG_DEBUG("Invitation reply cannot be validated: " + failureInfo + " ==> " + data->getName().toUri());
 }
@@ -473,7 +473,7 @@
 }
 
 void
-ChatDialog::onIntroCertListTimeout(const Interest& interest, int retry, const string& msg)
+ChatDialog::onIntroCertListTimeout(const Interest& interest, int retry, const std::string& msg)
 {
   if(retry > 0)
     m_face->expressInterest(interest,
@@ -498,13 +498,13 @@
 void
 ChatDialog::onCertListInterest(const Name& prefix, const ndn::Interest& interest)
 {
-  vector<Name> certNameList;
+  std::vector<Name> certNameList;
   m_sock->getIntroCertNames(certNameList);
 
   Chronos::IntroCertListMsg msg;
 
-  vector<Name>::const_iterator it  = certNameList.begin();
-  vector<Name>::const_iterator end = certNameList.end();
+  std::vector<Name>::const_iterator it  = certNameList.begin();
+  std::vector<Name>::const_iterator end = certNameList.end();
   for(; it != end; it++)
     {
       Name certName;
@@ -522,7 +522,7 @@
 }
 
 void
-ChatDialog::onCertListRegisterFailed(const Name& prefix, const string& msg)
+ChatDialog::onCertListRegisterFailed(const Name& prefix, const std::string& msg)
 {
   _LOG_DEBUG("ChatDialog::onCertListRegisterFailed failed: " + msg);
 }
@@ -546,7 +546,7 @@
 }
 
 void
-ChatDialog::onCertSingleRegisterFailed(const Name& prefix, const string& msg)
+ChatDialog::onCertSingleRegisterFailed(const Name& prefix, const std::string& msg)
 {
   _LOG_DEBUG("ChatDialog::onCertListRegisterFailed failed: " + msg);
 }
@@ -757,11 +757,11 @@
   timeCell.firstCursorPosition().insertText(formatTime(timestamp));
 }
 
-string
+std::string
 ChatDialog::getRandomString()
 {
   uint32_t r = random::generateWord32();
-  stringstream ss;
+  std::stringstream ss;
   {
     using namespace CryptoPP;
     StringSource(reinterpret_cast<uint8_t*>(&r), 4, true,
@@ -797,13 +797,13 @@
 ChatDialog::summonReaper()
 {
   Sync::SyncLogic &logic = m_sock->getLogic ();
-  map<string, bool> branches = logic.getBranchPrefixes();
+  std::map<std::string, bool> branches = logic.getBranchPrefixes();
   QMap<QString, DisplayUserPtr> roster = m_scene->getRosterFull();
 
   m_zombieList.clear();
 
   QMapIterator<QString, DisplayUserPtr> it(roster);
-  map<string, bool>::iterator mapIt;
+  std::map<std::string, bool>::iterator mapIt;
   while(it.hasNext())
   {
     it.next();
@@ -836,15 +836,15 @@
 void
 ChatDialog::getTree(TrustTreeNodeList& nodeList)
 {
-  typedef map<Name, shared_ptr<TrustTreeNode> > NodeMap;
+  typedef std::map<Name, shared_ptr<TrustTreeNode> > NodeMap;
 
-  vector<Name> certNameList;
+  std::vector<Name> certNameList;
   NodeMap nodeMap;
 
   m_sock->getIntroCertNames(certNameList);
 
-  vector<Name>::const_iterator it  = certNameList.begin();
-  vector<Name>::const_iterator end = certNameList.end();
+  std::vector<Name>::const_iterator it  = certNameList.begin();
+  std::vector<Name>::const_iterator end = certNameList.end();
   for(; it != end; it++)
     {
       Name introducerCertName;
@@ -877,7 +877,7 @@
     }
   
   nodeList.clear();
-  queue<shared_ptr<TrustTreeNode> > nodeQueue;
+  std::queue<shared_ptr<TrustTreeNode> > nodeQueue;
 
   NodeMap::iterator nodeIt = nodeMap.find(m_identity);
   if(nodeIt == nodeMap.end())
@@ -1101,7 +1101,7 @@
 }
 
 void
-ChatDialog::onProcessTreeUpdate(const vector<Sync::MissingDataInfo>& v)
+ChatDialog::onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>& v)
 {
   _LOG_DEBUG("<<< processing Tree Update");
 
@@ -1239,7 +1239,7 @@
 {
   if (m_zombieIndex < m_zombieList.size())
   {
-    string prefix = m_zombieList.at(m_zombieIndex).toStdString();
+    std::string prefix = m_zombieList.at(m_zombieIndex).toStdString();
     m_sock->remove(prefix);
     _LOG_DEBUG("Reaped: prefix = " << prefix);
     m_zombieIndex++;
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 36a0705..f89e023 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -32,13 +32,14 @@
 #endif
 
 using namespace ndn;
-using namespace std;
 namespace fs = boost::filesystem;
 
 INIT_LOGGER("chronos.ContactManager");
 
 namespace chronos{
 
+using ndn::shared_ptr;
+
 static const uint8_t DNS_RP_SEPARATOR[2] = {0xF0, 0x2E}; // %F0.
 
 ContactManager::ContactManager(shared_ptr<Face> face,
@@ -181,7 +182,7 @@
   Profile::const_iterator pIt  = profile.begin();
   Profile::const_iterator pEnd = profile.end();
 
-  map<string, int> endorseCount;
+  std::map<std::string, int> endorseCount;
   for(; pIt != pEnd; pIt++)
     {
       // _LOG_DEBUG("prepareEndorseInfo: profile[" << pIt->first << "]: " << pIt->second);
@@ -190,8 +191,8 @@
 
   int endorseCertCount = 0;
 
-  vector<shared_ptr<EndorseCertificate> >::const_iterator cIt  = m_bufferedContacts[identity].m_endorseCertList.begin();
-  vector<shared_ptr<EndorseCertificate> >::const_iterator cEnd = m_bufferedContacts[identity].m_endorseCertList.end();
+  std::vector<shared_ptr<EndorseCertificate> >::const_iterator cIt  = m_bufferedContacts[identity].m_endorseCertList.begin();
+  std::vector<shared_ptr<EndorseCertificate> >::const_iterator cEnd = m_bufferedContacts[identity].m_endorseCertList.end();
 
   for(; cIt != cEnd; cIt++, endorseCertCount++)
     {
@@ -210,8 +211,8 @@
       if(tmpProfile != profile)
         continue;
 
-      const vector<string>& endorseList = (*cIt)->getEndorseList();
-      vector<string>::const_iterator eIt = endorseList.begin();
+      const std::vector<std::string>& endorseList = (*cIt)->getEndorseList();
+      std::vector<std::string>::const_iterator eIt = endorseList.begin();
       for(; eIt != endorseList.end(); eIt++)
         endorseCount[*eIt] += 1;
     }
@@ -223,7 +224,7 @@
       EndorseInfo::Endorsement* endorsement = endorseInfo->add_endorsement();
       endorsement->set_type(pIt->first);
       endorsement->set_value(pIt->second);
-      stringstream ss;
+      std::stringstream ss;
       ss << endorseCount[pIt->first] << "/" << endorseCertCount;
       endorsement->set_endorse(ss.str());
     }
@@ -264,7 +265,7 @@
 
 void
 ContactManager::onDnsSelfEndorseCertValidationFailed(const shared_ptr<const Data>& data, 
-                                                     const string& failInfo,
+                                                     const std::string& failInfo,
                                                      const Name& identity)
 {
   // If we cannot validate the Self-Endorse-Certificate, we may retry or fetch id-cert,
@@ -297,7 +298,7 @@
 
 void
 ContactManager::onDnsCollectEndorseValidationFailed(const shared_ptr<const Data>& data, 
-                                                    const string& failInfo,
+                                                    const std::string& failInfo,
                                                     const Name& identity)
 {
   prepareEndorseInfo(identity);
@@ -316,9 +317,9 @@
                                              Data& data, 
                                              const Name& identity, 
                                              int certIndex,
-                                             string hash)
+                                             std::string hash)
 {
-  stringstream ss;
+  std::stringstream ss;
   {  
     using namespace CryptoPP;
 
@@ -384,7 +385,7 @@
 }
 
 void
-ContactManager::onDnsEndorseeValidationFailed(const shared_ptr<const Data>& data, const string& failInfo)
+ContactManager::onDnsEndorseeValidationFailed(const shared_ptr<const Data>& data, const std::string& failInfo)
 {
   decreaseCollectStatus();
 }
@@ -440,7 +441,7 @@
 }
 
 void
-ContactManager::onIdentityCertValidationFailed(const shared_ptr<const Data>& data, const string& failInfo)
+ContactManager::onIdentityCertValidationFailed(const shared_ptr<const Data>& data, const std::string& failInfo)
 {
   _LOG_DEBUG("ContactManager::onIdentityCertValidationFailed " << data->getName());
   decreaseIdCertCount();
@@ -489,7 +490,7 @@
 
   shared_ptr<IdentityCertificate> signingCert = m_keyChain.getCertificate(certificateName);
 
-  vector<string> endorseList;
+  std::vector<std::string> endorseList;
   Profile::const_iterator it = profile.begin();
   for(; it != profile.end(); it++)
     endorseList.push_back(it->first);
@@ -528,7 +529,7 @@
 
   Name signerKeyName = m_keyChain.getDefaultKeyNameForIdentity(m_identity);
 
-  vector<string> endorseList;
+  std::vector<std::string> endorseList;
   m_contactStorage->getEndorseList(identity, endorseList);
 
   shared_ptr<EndorseCertificate> cert = 
@@ -630,7 +631,7 @@
 }
   
 void
-ContactManager::onDnsRegisterFailed(const Name& prefix, const string& failInfo)
+ContactManager::onDnsRegisterFailed(const Name& prefix, const std::string& failInfo)
 {
   emit warning(QString(failInfo.c_str()));
 }
@@ -752,7 +753,7 @@
       request_stream << "Host: ndncert.named-data.net\r\n\r\n";
       request_stream.flush();
 
-      string line1;
+      std::string line1;
       std::getline(request_stream,line1);
       if (!request_stream)
         {
@@ -778,7 +779,7 @@
           emit warning(QString::fromStdString("Fail to fetch certificate directory! #4"));
           return;
         }
-      vector<string> headers;
+      std::vector<std::string> headers;
       std::string header;
       while (std::getline(request_stream, header) && header != "\r")
         headers.push_back(header);
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index 4c1fe04..d5aeee8 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -17,16 +17,16 @@
 #include <cryptopp/files.h>
 #include "logging.h"
 
-using namespace std;
 using namespace ndn;
 namespace fs = boost::filesystem;
 
-
 INIT_LOGGER ("chronos.ContactStorage");
 
 namespace chronos{
 
-const string INIT_SP_TABLE = "\
+using ndn::shared_ptr;
+
+const std::string INIT_SP_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   SelfProfile(                                                       \n \
       profile_type      BLOB NOT NULL,                               \n \
@@ -38,7 +38,7 @@
 CREATE INDEX sp_index ON SelfProfile(profile_type);                  \n \
 "; // user's own profile;
 
-const string INIT_SE_TABLE = "\
+const std::string INIT_SE_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   SelfEndorse(                                                       \n \
       identity          BLOB NOT NULL UNIQUE,                        \n \
@@ -49,7 +49,7 @@
 CREATE INDEX se_index ON SelfEndorse(identity);                      \n \
 "; // user's self endorse cert;
 
-const string INIT_CONTACT_TABLE = "\
+const std::string INIT_CONTACT_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   Contact(                                                           \n \
       contact_namespace BLOB NOT NULL,                               \n \
@@ -66,7 +66,7 @@
 CREATE INDEX contact_index ON Contact(contact_namespace);            \n \
 "; // contact's basic info
 
-const string INIT_TS_TABLE = "\
+const std::string INIT_TS_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   TrustScope(                                                        \n \
       id                INTEGER PRIMARY KEY AUTOINCREMENT,           \n \
@@ -77,7 +77,7 @@
 CREATE INDEX ts_index ON TrustScope(contact_namespace);              \n \
 "; // contact's trust scope;
 
-const string INIT_CP_TABLE = "\
+const std::string INIT_CP_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   ContactProfile(                                                    \n \
       profile_identity  BLOB NOT NULL,                               \n \
@@ -91,7 +91,7 @@
 CREATE INDEX cp_index ON ContactProfile(profile_identity);           \n \
 "; // contact's profile
 
-const string INIT_PE_TABLE = "\
+const std::string INIT_PE_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   ProfileEndorse(                                                    \n \
       identity          BLOB NOT NULL UNIQUE,                        \n \
@@ -103,7 +103,7 @@
 CREATE INDEX pe_index ON ProfileEndorse(identity);                   \n \
 "; // user's endorsement on contacts
 
-const string INIT_CE_TABLE = "\
+const std::string INIT_CE_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   CollectEndorse(                                                    \n \
       endorser          BLOB NOT NULL,                               \n \
@@ -114,7 +114,7 @@
   );                                                                 \n \
 "; // contact's endorsements on the user
 
-const string INIT_DD_TABLE = "\
+const std::string INIT_DD_TABLE = "\
 CREATE TABLE IF NOT EXISTS                                           \n \
   DnsData(                                                           \n \
       dns_name      BLOB NOT NULL,                                   \n \
@@ -149,12 +149,12 @@
 
 }
 
-string
+std::string
 ContactStorage::getDBName()
 {
-  string dbName("chronos-");
+  std::string dbName("chronos-");
 
-  stringstream ss;
+  std::stringstream ss;
   {
     using namespace CryptoPP;
 
@@ -168,7 +168,7 @@
 }
 
 void
-ContactStorage::initializeTable(const string& tableName, const string& sqlCreateStmt)
+ContactStorage::initializeTable(const std::string& tableName, const std::string& sqlCreateStmt)
 {
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT name FROM sqlite_master WHERE type='table' And name=?", -1, &stmt, 0);
@@ -198,8 +198,8 @@
 
   while( sqlite3_step (stmt) == SQLITE_ROW)
     {
-      string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
-      string profileValue(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
+      std::string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      std::string profileValue(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
       (*profile)[profileType] = profileValue;
     }
 
@@ -261,8 +261,8 @@
 
   while(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      string certName(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 1));
-      stringstream ss;
+      std::string certName(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 1));
+      std::stringstream ss;
       {
         using namespace CryptoPP;
         SHA256 hash;
@@ -279,7 +279,7 @@
 }
 
 void
-ContactStorage::getEndorseList(const Name& identity, vector<string>& endorseList)
+ContactStorage::getEndorseList(const Name& identity, std::vector<std::string>& endorseList)
 {
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT profile_type FROM ContactProfile WHERE profile_identity=? AND endorse=1 ORDER BY profile_type", -1, &stmt, 0);
@@ -287,7 +287,7 @@
 
   while( sqlite3_step (stmt) == SQLITE_ROW)
     {
-      string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      std::string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
       endorseList.push_back(profileType);      
     }
   sqlite3_finalize (stmt);  
@@ -297,7 +297,7 @@
 void 
 ContactStorage::removeContact(const Name& identityName)
 {
-  string identity = identityName.toUri();
+  std::string identity = identityName.toUri();
   
   sqlite3_stmt *stmt;  
   sqlite3_prepare_v2 (m_db, "DELETE FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
@@ -322,7 +322,7 @@
   if(doesContactExist(contact.getNameSpace()))
     throw Error("Normal Contact has already existed");
 
-  string identity = contact.getNameSpace().toUri();
+  std::string identity = contact.getNameSpace().toUri();
   bool isIntroducer = contact.isIntroducer();
 
   sqlite3_stmt *stmt;  
@@ -397,8 +397,8 @@
 
   if(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      string alias(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
-      string keyName(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
+      std::string alias(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      std::string keyName(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
       PublicKey key(sqlite3_column_text(stmt, 2), sqlite3_column_bytes (stmt, 2));
       time::system_clock::TimePoint notBefore = time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 3)));
       time::system_clock::TimePoint notAfter = time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 4)));
@@ -413,8 +413,8 @@
   
   while(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      string type(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
-      string value(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
+      std::string type(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
+      std::string value(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
       profile[type] = value;
     }
   sqlite3_finalize (stmt);
@@ -427,7 +427,7 @@
 
       while(sqlite3_step (stmt) == SQLITE_ROW)
         {
-          Name scope(string(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
+          Name scope(std::string(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
           contact->addTrustScope(scope);
         }
       sqlite3_finalize (stmt);
@@ -450,7 +450,7 @@
 }
 
 void 
-ContactStorage::updateAlias(const Name& identity, string alias)
+ContactStorage::updateAlias(const Name& identity, std::string alias)
 {
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "UPDATE Contact SET contact_alias=? WHERE contact_namespace=?", -1, &stmt, 0);
@@ -483,22 +483,22 @@
 }
 
 void
-ContactStorage::getAllContacts(vector<shared_ptr<Contact> >& contacts) const
+ContactStorage::getAllContacts(std::vector<shared_ptr<Contact> >& contacts) const
 {
-  vector<Name> contactNames;
+  std::vector<Name> contactNames;
 
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "SELECT contact_namespace FROM Contact", -1, &stmt, 0);
   
   while(sqlite3_step (stmt) == SQLITE_ROW)
     {
-      string identity(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 0));
+      std::string identity(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 0));
       contactNames.push_back(Name(identity));
     }
   sqlite3_finalize (stmt);
 
-  vector<Name>::iterator it  = contactNames.begin();
-  vector<Name>::iterator end = contactNames.end();
+  std::vector<Name>::iterator it  = contactNames.begin();
+  std::vector<Name>::iterator end = contactNames.end();
   for(; it != end; it++)
     {
       shared_ptr<Contact> contact = getContact(*it);
@@ -509,9 +509,9 @@
 
 void
 ContactStorage::updateDnsData(const Block& data, 
-                              const string& name, 
-                              const string& type, 
-                              const string& dataName)
+                              const std::string& name, 
+                              const std::string& type, 
+                              const std::string& dataName)
 {  
   sqlite3_stmt *stmt;
   sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO DnsData (dns_name, dns_type, dns_value, data_name) VALUES (?, ?, ?, ?)", -1, &stmt, 0);
@@ -545,7 +545,7 @@
 }
 
 shared_ptr<Data>
-ContactStorage::getDnsData(const string& name, const string& type)
+ContactStorage::getDnsData(const std::string& name, const std::string& type)
 {
   shared_ptr<Data> data;
 
diff --git a/src/controller.cpp b/src/controller.cpp
index 4d80604..171dfc7 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -39,6 +39,8 @@
 
 namespace chronos {
 
+using ndn::shared_ptr;
+
 static const uint8_t ROUTING_PREFIX_SEPARATOR[2] = {0xF0, 0x2E};
 
 // constructor & destructor
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index 3aef18e..b5c94ad 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -12,7 +12,7 @@
 #include "endorse-extension.pb.h"
 #include <boost/iostreams/stream.hpp>
 
-using namespace std;
+
 using namespace ndn;
 
 namespace chronos{
@@ -23,9 +23,9 @@
 const std::vector<std::string> EndorseCertificate::DEFAULT_ENDORSE_LIST = std::vector<std::string>();
 
 Chronos::EndorseExtensionMsg&
-operator << (Chronos::EndorseExtensionMsg& endorseExtension, const vector<string>& endorseList)
+operator << (Chronos::EndorseExtensionMsg& endorseExtension, const std::vector<std::string>& endorseList)
 { 
-  vector<string>::const_iterator it = endorseList.begin();
+  std::vector<std::string>::const_iterator it = endorseList.begin();
   for(; it != endorseList.end(); it++)
     endorseExtension.add_endorseentry()->set_name(*it);
 
@@ -33,7 +33,7 @@
 }
 
 Chronos::EndorseExtensionMsg&
-operator >> (Chronos::EndorseExtensionMsg& endorseExtension, vector<string>& endorseList)
+operator >> (Chronos::EndorseExtensionMsg& endorseExtension, std::vector<std::string>& endorseList)
 {
   for(int i = 0; i < endorseExtension.endorseentry_size(); i ++)
     endorseList.push_back(endorseExtension.endorseentry(i).name());
@@ -43,7 +43,7 @@
 
 EndorseCertificate::EndorseCertificate(const IdentityCertificate& kskCertificate,
                                        const Profile& profile,
-                                       const vector<string>& endorseList)
+                                       const std::vector<std::string>& endorseList)
   : Certificate()
   , m_profile(profile)
   , m_endorseList(endorseList)
@@ -75,7 +75,7 @@
 
 EndorseCertificate::EndorseCertificate(const EndorseCertificate& endorseCertificate,
                                        const Name& signer,
-                                       const vector<string>& endorseList)
+                                       const std::vector<std::string>& endorseList)
   : Certificate()
   , m_keyName(endorseCertificate.m_keyName)
   , m_signer(signer)
@@ -110,7 +110,7 @@
                                        const time::system_clock::TimePoint& notAfter,
                                        const Name& signer,
                                        const Profile& profile,
-                                       const vector<string>& endorseList)
+                                       const std::vector<std::string>& endorseList)
   : Certificate()
   , m_keyName(keyName)
   , m_signer(signer)
diff --git a/src/invitation-dialog.cpp b/src/invitation-dialog.cpp
index d14715b..1da8f00 100644
--- a/src/invitation-dialog.cpp
+++ b/src/invitation-dialog.cpp
@@ -12,7 +12,6 @@
 #include "invitation-dialog.h"
 #include "ui_invitation-dialog.h"
 
-using namespace std;
 using namespace ndn;
 
 InvitationDialog::InvitationDialog(QWidget *parent) 
@@ -33,11 +32,11 @@
 }
 
 void
-InvitationDialog::setInvitation(const string& alias,
-                                const string& chatroom,
+InvitationDialog::setInvitation(const std::string& alias,
+                                const std::string& chatroom,
                                 const Name& interestName)
 {
-  string msg = alias;
+  std::string msg = alias;
   m_invitationInterest = interestName;
   msg.append(" invites you to: ").append(chatroom);
   ui->msgLabel->setText(QString::fromStdString(msg));
diff --git a/src/invitation.cpp b/src/invitation.cpp
index 851010b..cc5ba40 100644
--- a/src/invitation.cpp
+++ b/src/invitation.cpp
@@ -15,7 +15,6 @@
 
 #include "logging.h"
 
-using namespace std;
 using namespace ndn;
 
 INIT_LOGGER("Invitation");
@@ -52,7 +51,7 @@
 }
 
 Invitation::Invitation(const Name& inviteeNameSpace,
-                       const string& chatroom,
+                       const std::string& chatroom,
                        const Name& inviterRoutingPrefix,
                        const IdentityCertificate& inviterCertificate)
   : m_inviteeNameSpace(inviteeNameSpace)
diff --git a/src/invite-list-dialog.cpp b/src/invite-list-dialog.cpp
index c46036f..bfc4040 100644
--- a/src/invite-list-dialog.cpp
+++ b/src/invite-list-dialog.cpp
@@ -11,8 +11,6 @@
 #include "invite-list-dialog.h"
 #include "ui_invite-list-dialog.h"
 
-using namespace std;
-
 InviteListDialog::InviteListDialog(QWidget *parent) 
   :QDialog(parent)
   , ui(new Ui::InviteListDialog)
@@ -35,9 +33,9 @@
 }
 
 void
-InviteListDialog::setInviteLabel(string label)
+InviteListDialog::setInviteLabel(std::string label)
 { 
-  string msg("invite to chatroom:\n");
+  std::string msg("invite to chatroom:\n");
   msg += label;
   ui->inviteLabel->setText(QString::fromStdString(msg));
 }
diff --git a/src/main.cpp b/src/main.cpp
index 009f761..a1ed56c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,6 +19,7 @@
 INIT_LOGGER("MAIN");
 
 using namespace ndn;
+using ndn::shared_ptr;
 
 class NewApp : public QApplication
 {
diff --git a/src/profile-editor.cpp b/src/profile-editor.cpp
index ac5dcbf..457ecfd 100644
--- a/src/profile-editor.cpp
+++ b/src/profile-editor.cpp
@@ -20,8 +20,6 @@
 
 INIT_LOGGER("ProfileEditor")
 
-using namespace std;
-
 ProfileEditor::ProfileEditor(QWidget *parent) 
   : QDialog(parent)
   , ui(new Ui::ProfileEditor)
diff --git a/src/profile.cpp b/src/profile.cpp
index 40a7aee..7bf7293 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -11,32 +11,31 @@
 #include "profile.h"
 #include "logging.h"
 
-using namespace std;
 using namespace ndn;
 
 INIT_LOGGER("Profile");
 
 namespace chronos{
 
-const string Profile::OID_NAME("2.5.4.41");
-const string Profile::OID_ORG("2.5.4.11");
-const string Profile::OID_GROUP("2.5.4.1");
-const string Profile::OID_HOMEPAGE("2.5.4.3");
-const string Profile::OID_ADVISOR("2.5.4.80");
-const string Profile::OID_EMAIL("1.2.840.113549.1.9.1");
+const std::string Profile::OID_NAME("2.5.4.41");
+const std::string Profile::OID_ORG("2.5.4.11");
+const std::string Profile::OID_GROUP("2.5.4.1");
+const std::string Profile::OID_HOMEPAGE("2.5.4.3");
+const std::string Profile::OID_ADVISOR("2.5.4.80");
+const std::string Profile::OID_EMAIL("1.2.840.113549.1.9.1");
 
 Profile::Profile(const IdentityCertificate& identityCertificate)
 {
   Name keyName = IdentityCertificate::certificateNameToPublicKeyName(identityCertificate.getName());
 
-  m_entries[string("IDENTITY")] = keyName.getPrefix(-1).toUri();
+  m_entries[std::string("IDENTITY")] = keyName.getPrefix(-1).toUri();
   
-  const vector<CertificateSubjectDescription>& subList = identityCertificate.getSubjectDescriptionList();
-  vector<CertificateSubjectDescription>::const_iterator it = subList.begin();
+  const std::vector<CertificateSubjectDescription>& subList = identityCertificate.getSubjectDescriptionList();
+  std::vector<CertificateSubjectDescription>::const_iterator it = subList.begin();
   for(; it != subList.end(); it++)
     {
-      const string oidStr = it->getOidString();
-      string valueStr = it->getValue();
+      const std::string oidStr = it->getOidString();
+      std::string valueStr = it->getValue();
       if(oidStr == OID_NAME)
         m_entries["name"] = valueStr;
       else if(oidStr == OID_ORG)
@@ -60,8 +59,8 @@
 }
 
 Profile::Profile(const Name& identityName,
-		 const string& name,
-		 const string& institution)
+		 const std::string& name,
+		 const std::string& institution)
 {
   m_entries["IDENTITY"] = identityName.toUri();
   m_entries["name"] = name;
@@ -73,7 +72,7 @@
 {}
 
 void
-Profile::encode(ostream& os) const
+Profile::encode(std::ostream& os) const
 {
   Chronos::ProfileMsg profileMsg;
   profileMsg << (*this);
@@ -81,7 +80,7 @@
 }
 
 void
-Profile::decode(istream& is)
+Profile::decode(std::istream& is)
 {
   Chronos::ProfileMsg profileMsg;    
   profileMsg.ParseFromIstream(&is);
@@ -91,7 +90,7 @@
 Chronos::ProfileMsg&
 operator << (Chronos::ProfileMsg& profileMsg, const Profile& profile)
 {
-  map<string, string>::const_iterator it = profile.begin();
+  std::map<std::string, std::string>::const_iterator it = profile.begin();
   for(; it != profile.end(); it++)
     {
       Chronos::ProfileMsg::ProfileEntry* profileEntry = profileMsg.add_entry();
diff --git a/src/set-alias-dialog.cpp b/src/set-alias-dialog.cpp
index 7327c1b..24fb6a8 100644
--- a/src/set-alias-dialog.cpp
+++ b/src/set-alias-dialog.cpp
@@ -12,9 +12,6 @@
 #include "ui_set-alias-dialog.h"
 
 
-using namespace ndn;
-using namespace std;
-
 SetAliasDialog::SetAliasDialog(QWidget *parent) 
   : QDialog(parent)
   , ui(new Ui::SetAliasDialog)
diff --git a/src/start-chat-dialog.cpp b/src/start-chat-dialog.cpp
index e9ac1f8..c508c1e 100644
--- a/src/start-chat-dialog.cpp
+++ b/src/start-chat-dialog.cpp
@@ -11,8 +11,6 @@
 #include "start-chat-dialog.h"
 #include "ui_start-chat-dialog.h"
 
-using namespace std;
-
 StartChatDialog::StartChatDialog(QWidget *parent) 
   : QDialog(parent)
   , ui(new Ui::StartChatDialog)
@@ -31,7 +29,7 @@
 }
 
 void
-StartChatDialog::setChatroom(const string& chatroom)
+StartChatDialog::setChatroom(const std::string& chatroom)
 { 
   ui->chatroomInput->setText(QString::fromStdString(chatroom)); 
 }
diff --git a/src/validator-invitation.cpp b/src/validator-invitation.cpp
index 1c38860..a95f898 100644
--- a/src/validator-invitation.cpp
+++ b/src/validator-invitation.cpp
@@ -13,13 +13,14 @@
 
 #include "logging.h"
 
-using namespace std;
 using namespace ndn;
 
 INIT_LOGGER("ValidatorInvitation");
 
 namespace chronos{
 
+using ndn::shared_ptr;
+
 const shared_ptr<CertificateCache> ValidatorInvitation::DefaultCertificateCache = shared_ptr<CertificateCache>();
 
 ValidatorInvitation::ValidatorInvitation()
@@ -37,7 +38,7 @@
                                   int stepCount, 
                                   const OnDataValidated& onValidated, 
                                   const OnDataValidationFailed& onValidationFailed,
-                                  vector<shared_ptr<ValidationRequest> >& nextSteps)
+                                  std::vector<shared_ptr<ValidationRequest> >& nextSteps)
 {
   try
     {
@@ -72,7 +73,7 @@
                                   int stepCount, 
                                   const OnInterestValidated& onValidated, 
                                   const OnInterestValidationFailed& onValidationFailed,
-                                  vector<shared_ptr<ValidationRequest> >& nextSteps)
+                                  std::vector<shared_ptr<ValidationRequest> >& nextSteps)
 {
   try
     {
diff --git a/src/validator-panel.cpp b/src/validator-panel.cpp
index 8de4bb6..2197d66 100644
--- a/src/validator-panel.cpp
+++ b/src/validator-panel.cpp
@@ -14,12 +14,13 @@
 
 using namespace std;
 using namespace ndn;
-using namespace ndn::ptr_lib;
 
 INIT_LOGGER("ValidatorPanel");
 
 namespace chronos{
 
+using ndn::shared_ptr;
+
 const shared_ptr<CertificateCache> ValidatorPanel::DEFAULT_CERT_CACHE = shared_ptr<CertificateCache>();
 
 ValidatorPanel::ValidatorPanel(int stepLimit /* = 10 */,
@@ -39,7 +40,7 @@
                              int stepCount, 
                              const OnDataValidated& onValidated, 
                              const OnDataValidationFailed& onValidationFailed,
-                             vector<shared_ptr<ValidationRequest> >& nextSteps)
+                             std::vector<shared_ptr<ValidationRequest> >& nextSteps)
 {
   if(m_stepLimit == stepCount)
     {