aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brep/database1
-rw-r--r--brep/database-lock8
-rw-r--r--brep/database.cxx7
-rw-r--r--brep/diagnostics8
-rw-r--r--brep/diagnostics.cxx4
-rw-r--r--brep/mod-package-details1
-rw-r--r--brep/mod-package-details.cxx3
-rw-r--r--brep/mod-package-search1
-rw-r--r--brep/mod-package-search.cxx2
-rw-r--r--brep/mod-package-version-details1
-rw-r--r--brep/mod-package-version-details.cxx5
-rw-r--r--brep/mod-repository-details1
-rw-r--r--brep/mod-repository-details.cxx3
-rw-r--r--brep/mod-repository-root1
-rw-r--r--brep/mod-repository-root.cxx4
-rw-r--r--brep/module2
-rw-r--r--brep/module.cxx5
-rw-r--r--brep/options-types3
-rw-r--r--brep/package6
-rw-r--r--brep/package.cxx5
-rw-r--r--brep/page1
-rw-r--r--brep/page.cxx3
-rw-r--r--brep/services.cxx3
-rw-r--r--brep/types54
-rw-r--r--brep/types-parsers1
-rw-r--r--brep/types-parsers.cxx2
-rw-r--r--brep/utility20
-rw-r--r--load/load.cxx2
-rw-r--r--migrate/migrate.cxx4
29 files changed, 84 insertions, 77 deletions
diff --git a/brep/database b/brep/database
index a880e42..d29d4a5 100644
--- a/brep/database
+++ b/brep/database
@@ -8,6 +8,7 @@
#include <odb/forward.hxx> // database
#include <brep/types>
+#include <brep/utility>
#include <brep/options>
diff --git a/brep/database-lock b/brep/database-lock
index 72036a1..dc233c7 100644
--- a/brep/database-lock
+++ b/brep/database-lock
@@ -5,12 +5,12 @@
#ifndef BREP_DATABASE_LOCK
#define BREP_DATABASE_LOCK
-#include <memory> // unique_ptr
-#include <exception>
-
#include <odb/pgsql/forward.hxx> // database, transaction
#include <odb/pgsql/connection.hxx>
+#include <brep/types>
+#include <brep/utility>
+
namespace brep
{
struct database_locked: std::exception
@@ -36,7 +36,7 @@ namespace brep
private:
odb::pgsql::connection_ptr connection_;
- std::unique_ptr<odb::pgsql::transaction> transaction_;
+ unique_ptr<odb::pgsql::transaction> transaction_;
};
}
diff --git a/brep/database.cxx b/brep/database.cxx
index 4525796..9177b55 100644
--- a/brep/database.cxx
+++ b/brep/database.cxx
@@ -4,13 +4,8 @@
#include <brep/database>
-#include <stdexcept> // runtime_error
-
#include <odb/pgsql/database.hxx>
-#include <brep/types>
-#include <brep/utility>
-
namespace brep
{
shared_ptr<odb::database>
@@ -30,7 +25,7 @@ namespace brep
o.db_name () != d->db () ||
o.db_host () != d->host () ||
o.db_port () != d->port ())
- throw std::runtime_error ("shared database options mismatch");
+ throw runtime_error ("shared database options mismatch");
return d;
}
diff --git a/brep/diagnostics b/brep/diagnostics
index e08c455..b5b1b36 100644
--- a/brep/diagnostics
+++ b/brep/diagnostics
@@ -5,9 +5,7 @@
#ifndef BREP_DIAGNOSTICS
#define BREP_DIAGNOSTICS
-#include <utility> // forward()
#include <sstream>
-#include <functional>
#include <brep/types>
#include <brep/utility>
@@ -42,7 +40,7 @@ namespace brep
template <typename> struct diag_prologue;
template <typename> struct diag_mark;
- using diag_epilogue = std::function<void (diag_data&&)>;
+ using diag_epilogue = function<void (diag_data&&)>;
struct diag_record
{
@@ -130,7 +128,7 @@ namespace brep
template <typename... A>
diag_prologue (const diag_epilogue& e, A&&... a)
- : B (std::forward<A> (a)...), epilogue_ (e) {}
+ : B (forward<A> (a)...), epilogue_ (e) {}
template <typename T>
diag_record
@@ -163,7 +161,7 @@ namespace brep
diag_mark (): B () {}
template <typename... A>
- diag_mark (A&&... a): B (std::forward<A> (a)...) {}
+ diag_mark (A&&... a): B (forward<A> (a)...) {}
template <typename T>
diag_record
diff --git a/brep/diagnostics.cxx b/brep/diagnostics.cxx
index 0f1f490..b0d122f 100644
--- a/brep/diagnostics.cxx
+++ b/brep/diagnostics.cxx
@@ -4,10 +4,6 @@
#include <brep/diagnostics>
-#include <exception>
-
-#include <brep/utility>
-
using namespace std;
namespace brep
diff --git a/brep/mod-package-details b/brep/mod-package-details
index f2b4cab..a99d271 100644
--- a/brep/mod-package-details
+++ b/brep/mod-package-details
@@ -8,6 +8,7 @@
#include <odb/forward.hxx> // database
#include <brep/types>
+#include <brep/utility>
#include <brep/module>
#include <brep/options>
diff --git a/brep/mod-package-details.cxx b/brep/mod-package-details.cxx
index f2f8bd6..98b2135 100644
--- a/brep/mod-package-details.cxx
+++ b/brep/mod-package-details.cxx
@@ -14,9 +14,6 @@
#include <web/module>
#include <web/mime-url-encoding>
-#include <brep/types>
-#include <brep/utility>
-
#include <brep/page>
#include <brep/options>
#include <brep/package>
diff --git a/brep/mod-package-search b/brep/mod-package-search
index 6d732ae..7db976b 100644
--- a/brep/mod-package-search
+++ b/brep/mod-package-search
@@ -8,6 +8,7 @@
#include <odb/forward.hxx> // database
#include <brep/types>
+#include <brep/utility>
#include <brep/module>
#include <brep/options>
diff --git a/brep/mod-package-search.cxx b/brep/mod-package-search.cxx
index b283a5b..5725da0 100644
--- a/brep/mod-package-search.cxx
+++ b/brep/mod-package-search.cxx
@@ -15,8 +15,6 @@
#include <web/module>
#include <web/mime-url-encoding>
-#include <brep/types>
-#include <brep/utility>
#include <brep/version>
#include <brep/page>
diff --git a/brep/mod-package-version-details b/brep/mod-package-version-details
index 7b10ca0..d102fdf 100644
--- a/brep/mod-package-version-details
+++ b/brep/mod-package-version-details
@@ -8,6 +8,7 @@
#include <odb/forward.hxx> // database
#include <brep/types>
+#include <brep/utility>
#include <brep/module>
#include <brep/options>
diff --git a/brep/mod-package-version-details.cxx b/brep/mod-package-version-details.cxx
index 4f4e02d..5090a19 100644
--- a/brep/mod-package-version-details.cxx
+++ b/brep/mod-package-version-details.cxx
@@ -4,8 +4,6 @@
#include <brep/mod-package-version-details>
-#include <stdexcept> // invalid_argument
-
#include <xml/serializer>
#include <odb/session.hxx>
@@ -16,9 +14,6 @@
#include <web/module>
#include <web/mime-url-encoding>
-#include <brep/types>
-#include <brep/utility>
-
#include <brep/page>
#include <brep/options>
#include <brep/package>
diff --git a/brep/mod-repository-details b/brep/mod-repository-details
index 3eb5e99..5f1e93f 100644
--- a/brep/mod-repository-details
+++ b/brep/mod-repository-details
@@ -8,6 +8,7 @@
#include <odb/forward.hxx> // database
#include <brep/types>
+#include <brep/utility>
#include <brep/module>
#include <brep/options>
diff --git a/brep/mod-repository-details.cxx b/brep/mod-repository-details.cxx
index 27493c1..742bee9 100644
--- a/brep/mod-repository-details.cxx
+++ b/brep/mod-repository-details.cxx
@@ -20,9 +20,6 @@
#include <web/module>
#include <web/mime-url-encoding>
-#include <brep/types>
-#include <brep/utility>
-
#include <brep/page>
#include <brep/options>
#include <brep/package>
diff --git a/brep/mod-repository-root b/brep/mod-repository-root
index 6577ceb..254dfa3 100644
--- a/brep/mod-repository-root
+++ b/brep/mod-repository-root
@@ -6,6 +6,7 @@
#define BREP_MOD_REPOSITORY_ROOT
#include <brep/types>
+#include <brep/utility>
#include <brep/module>
#include <brep/options>
diff --git a/brep/mod-repository-root.cxx b/brep/mod-repository-root.cxx
index ecea87f..61aa71b 100644
--- a/brep/mod-repository-root.cxx
+++ b/brep/mod-repository-root.cxx
@@ -5,13 +5,9 @@
#include <brep/mod-repository-root>
#include <sstream>
-#include <exception>
-#include <stdexcept> // runtime_error
#include <web/module>
-#include <brep/types>
-#include <brep/utility>
#include <brep/version>
#include <brep/module>
diff --git a/brep/module b/brep/module
index f27eae0..f0479ef 100644
--- a/brep/module
+++ b/brep/module
@@ -183,7 +183,7 @@ namespace brep
private:
// Extract function name from a __PRETTY_FUNCTION__.
- // Throw std::invalid_argument if fail to parse.
+ // Throw invalid_argument if fail to parse.
//
static string
func_name (const char* pretty_name);
diff --git a/brep/module.cxx b/brep/module.cxx
index b451627..e8a824d 100644
--- a/brep/module.cxx
+++ b/brep/module.cxx
@@ -7,18 +7,13 @@
#include <httpd.h>
#include <http_log.h>
-#include <ostream>
#include <sstream>
#include <cstring> // strchr()
-#include <stdexcept>
#include <functional> // bind()
#include <web/module>
#include <web/apache/log>
-#include <brep/types>
-#include <brep/utility>
-
#include <brep/options>
using namespace std;
diff --git a/brep/options-types b/brep/options-types
index fa6cf7a..767423c 100644
--- a/brep/options-types
+++ b/brep/options-types
@@ -5,6 +5,9 @@
#ifndef BREP_OPTIONS_TYPES
#define BREP_OPTIONS_TYPES
+#include <brep/types>
+#include <brep/utility>
+
namespace brep
{
// brep types
diff --git a/brep/package b/brep/package
index 8aa88a1..fa129f3 100644
--- a/brep/package
+++ b/brep/package
@@ -8,8 +8,6 @@
#include <map>
#include <ratio>
#include <chrono>
-#include <iosfwd> // ostream
-#include <cassert>
#include <type_traits> // static_assert
#include <odb/core.hxx>
@@ -312,8 +310,8 @@ namespace brep
#pragma db member(constraint) column("")
};
- std::ostream&
- operator<< (std::ostream&, const dependency&);
+ ostream&
+ operator<< (ostream&, const dependency&);
bool
operator== (const dependency&, const dependency&);
diff --git a/brep/package.cxx b/brep/package.cxx
index 7bdc3c7..1f93a56 100644
--- a/brep/package.cxx
+++ b/brep/package.cxx
@@ -4,13 +4,8 @@
#include <brep/package>
-#include <ostream>
-
#include <odb/database.hxx>
-#include <brep/types>
-#include <brep/utility>
-
#include <brep/package-odb>
using namespace std;
diff --git a/brep/page b/brep/page
index 9e84e0f..5836ea6 100644
--- a/brep/page
+++ b/brep/page
@@ -8,6 +8,7 @@
#include <xml/forward>
#include <brep/types>
+#include <brep/utility>
#include <brep/package>
diff --git a/brep/page.cxx b/brep/page.cxx
index 4b13bcf..a6c7da2 100644
--- a/brep/page.cxx
+++ b/brep/page.cxx
@@ -15,9 +15,6 @@
#include <web/xhtml>
#include <web/mime-url-encoding>
-#include <brep/types>
-#include <brep/utility>
-
#include <brep/package>
#include <brep/package-odb>
diff --git a/brep/services.cxx b/brep/services.cxx
index 13c5110..94c7fc6 100644
--- a/brep/services.cxx
+++ b/brep/services.cxx
@@ -6,6 +6,9 @@
#include <web/apache/service>
+#include <brep/types>
+#include <brep/utility>
+
#include <brep/mod-repository-root>
static brep::repository_root mod;
diff --git a/brep/types b/brep/types
index 64d3733..9b5f423 100644
--- a/brep/types
+++ b/brep/types
@@ -7,9 +7,17 @@
#include <vector>
#include <string>
-#include <memory> // unique_ptr, weak_ptr, shared_ptr
-#include <cstddef> // size_t
-#include <cstdint> // uint{8,16,32,64}_t
+#include <memory> // unique_ptr, shared_ptr
+#include <utility> // pair
+#include <cstddef> // size_t, nullptr_t
+#include <cstdint> // uint{8,16,32,64}_t
+#include <istream>
+#include <ostream>
+#include <functional> // function, reference_wrapper
+
+#include <exception> // exception
+#include <stdexcept> // logic_error, invalid_argument, runtime_error
+#include <system_error>
#include <odb/lazy-ptr.hxx>
@@ -20,28 +28,48 @@
namespace brep
{
- // Commonly-used types
+ // Commonly-used types.
//
using std::uint8_t;
using std::uint16_t;
using std::uint32_t;
using std::uint64_t;
+
using std::size_t;
- using std::vector;
+ using std::nullptr_t;
+
+ using std::pair;
using std::string;
+ using std::function;
+ using std::reference_wrapper;
+
+ using std::unique_ptr;
+ using std::shared_ptr;
+ using std::weak_ptr;
+
+ using std::vector;
using strings = vector<string>;
+ using cstrings = vector<const char*>;
- using butl::optional;
- using butl::nullopt;
+ using std::istream;
+ using std::ostream;
- // Smart pointers
+ // Exceptions. While <exception> is included, there is no using for
+ // std::exception -- use qualified.
//
- using std::unique_ptr;
+ using std::logic_error;
+ using std::invalid_argument;
+ using std::runtime_error;
+ using std::system_error;
- using std::shared_ptr;
- using std::weak_ptr;
+ // <butl/optional>
+ //
+ using butl::optional;
+ using butl::nullopt;
+ // ODB smart pointers.
+ //
using odb::lazy_shared_ptr;
using odb::lazy_weak_ptr;
@@ -49,8 +77,12 @@ namespace brep
//
using butl::path;
using butl::dir_path;
+ using butl::basic_path;
using butl::invalid_path;
+ using paths = std::vector<path>;
+ using dir_paths = std::vector<dir_path>;
+
// <butl/timestamp>
//
using butl::timestamp;
diff --git a/brep/types-parsers b/brep/types-parsers
index 501cc21..8401237 100644
--- a/brep/types-parsers
+++ b/brep/types-parsers
@@ -9,6 +9,7 @@
#define BREP_TYPES_PARSERS
#include <brep/types>
+#include <brep/utility>
#include <brep/options-types>
diff --git a/brep/types-parsers.cxx b/brep/types-parsers.cxx
index 733cd55..d46ea18 100644
--- a/brep/types-parsers.cxx
+++ b/brep/types-parsers.cxx
@@ -4,8 +4,6 @@
#include <brep/types-parsers>
-#include <brep/types>
-
#include <brep/options>
using namespace std;
diff --git a/brep/utility b/brep/utility
index 2a41614..fcd30c5 100644
--- a/brep/utility
+++ b/brep/utility
@@ -5,16 +5,28 @@
#ifndef BREP_UTILITY
#define BREP_UTILITY
-#include <string> // to_string()
-#include <memory> // make_shared()
-#include <cassert>
-#include <utility> // move()
+#include <memory> // make_shared()
+#include <string> // to_string()
+#include <utility> // move(), forward(), declval(), make_pair()
+#include <cassert> // assert()
+#include <iterator> // make_move_iterator()
+
+#include <butl/utility> // reverse_iterate()
namespace brep
{
using std::move;
+ using std::forward;
+ using std::declval;
+
+ using std::make_pair;
using std::make_shared;
+ using std::make_move_iterator;
using std::to_string;
+
+ // <butl/utility>
+ //
+ using butl::reverse_iterate;
};
#endif // BREP_UTILITY
diff --git a/load/load.cxx b/load/load.cxx
index 993de7e..b4dcd11 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -4,9 +4,7 @@
#include <sstream>
#include <fstream>
-#include <ostream>
#include <iostream>
-#include <stdexcept> // runtime_error, invalid_argument
#include <algorithm> // find(), find_if()
#include <odb/session.hxx>
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 405770f..702eba0 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -4,12 +4,8 @@
#include <strings.h> // strcasecmp()
-#include <string>
-#include <cassert>
-#include <ostream>
#include <sstream>
#include <iostream>
-#include <stdexcept> // runtime_error, invalid_argument
#include <odb/database.hxx>
#include <odb/transaction.hxx>