Migrate to C++17 and misc code cleanups
Change-Id: I6b63385c92361a7ef5803d2bfd00f39c77e88d34
diff --git a/src/storage/repo-storage.hpp b/src/storage/repo-storage.hpp
index fe355ad..62d8fa4 100644
--- a/src/storage/repo-storage.hpp
+++ b/src/storage/repo-storage.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -25,8 +25,6 @@
#include <ndn-cxx/util/signal.hpp>
-#include <queue>
-
namespace repo {
/**
@@ -39,14 +37,9 @@
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
-public:
explicit
RepoStorage(Storage& store);
@@ -96,7 +89,7 @@
private:
Storage& m_storage;
- const int NOTFOUND = -1;
+ static constexpr int NOTFOUND = -1;
};
} // namespace repo
diff --git a/src/storage/sqlite-storage.hpp b/src/storage/sqlite-storage.hpp
index 217f9d0..6c6006d 100644
--- a/src/storage/sqlite-storage.hpp
+++ b/src/storage/sqlite-storage.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -22,33 +22,17 @@
#include "storage.hpp"
-#include <algorithm>
-#include <iostream>
-#include <queue>
-#include <stdlib.h>
-#include <string>
#include <sqlite3.h>
-#include <vector>
namespace repo {
class SqliteStorage : public Storage
{
public:
- class Error : public std::runtime_error
- {
- public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
- };
-
explicit
SqliteStorage(const std::string& dbPath);
- ~SqliteStorage();
+ ~SqliteStorage() override;
/**
* @brief put the data into database
@@ -92,7 +76,6 @@
std::string m_dbPath;
};
-
} // namespace repo
#endif // REPO_STORAGE_SQLITE_STORAGE_HPP
diff --git a/src/storage/storage.hpp b/src/storage/storage.hpp
index d724eb1..abda77c 100644
--- a/src/storage/storage.hpp
+++ b/src/storage/storage.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -21,26 +21,19 @@
#define REPO_STORAGE_STORAGE_HPP
#include "../common.hpp"
-#include <string>
-#include <iostream>
-#include <stdlib.h>
namespace repo {
/**
- * @brief Storage is a virtual abstract class which will be called by SqliteStorage
- */
+ * @brief Storage is a virtual abstract class which will be called by SqliteStorage
+ */
class Storage : noncopyable
{
public:
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
public: