From b250ead8e7237813e9bbd91cb3a9382592bf4abc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Feb 2016 16:52:43 +0200 Subject: / scheme cleanup --- brep/database | 1 + brep/database-lock | 8 +++--- brep/database.cxx | 7 +---- brep/diagnostics | 8 ++---- brep/diagnostics.cxx | 4 --- brep/mod-package-details | 1 + brep/mod-package-details.cxx | 3 -- brep/mod-package-search | 1 + brep/mod-package-search.cxx | 2 -- brep/mod-package-version-details | 1 + brep/mod-package-version-details.cxx | 5 ---- brep/mod-repository-details | 1 + brep/mod-repository-details.cxx | 3 -- brep/mod-repository-root | 1 + brep/mod-repository-root.cxx | 4 --- brep/module | 2 +- brep/module.cxx | 5 ---- brep/options-types | 3 ++ brep/package | 6 ++-- brep/package.cxx | 5 ---- brep/page | 1 + brep/page.cxx | 3 -- brep/services.cxx | 3 ++ brep/types | 54 ++++++++++++++++++++++++++++-------- brep/types-parsers | 1 + brep/types-parsers.cxx | 2 -- brep/utility | 20 ++++++++++--- 27 files changed, 84 insertions(+), 71 deletions(-) (limited to 'brep') diff --git a/brep/database b/brep/database index a880e42..d29d4a5 100644 --- a/brep/database +++ b/brep/database @@ -8,6 +8,7 @@ #include // database #include +#include #include 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 // unique_ptr -#include - #include // database, transaction #include +#include +#include + namespace brep { struct database_locked: std::exception @@ -36,7 +36,7 @@ namespace brep private: odb::pgsql::connection_ptr connection_; - std::unique_ptr transaction_; + unique_ptr 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 -#include // runtime_error - #include -#include -#include - namespace brep { shared_ptr @@ -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 // forward() #include -#include #include #include @@ -42,7 +40,7 @@ namespace brep template struct diag_prologue; template struct diag_mark; - using diag_epilogue = std::function; + using diag_epilogue = function; struct diag_record { @@ -130,7 +128,7 @@ namespace brep template diag_prologue (const diag_epilogue& e, A&&... a) - : B (std::forward (a)...), epilogue_ (e) {} + : B (forward (a)...), epilogue_ (e) {} template diag_record @@ -163,7 +161,7 @@ namespace brep diag_mark (): B () {} template - diag_mark (A&&... a): B (std::forward (a)...) {} + diag_mark (A&&... a): B (forward (a)...) {} template 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 -#include - -#include - 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 // database #include +#include #include #include 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 #include -#include -#include - #include #include #include 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 // database #include +#include #include #include 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 #include -#include -#include #include #include 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 // database #include +#include #include #include 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 -#include // invalid_argument - #include #include @@ -16,9 +14,6 @@ #include #include -#include -#include - #include #include #include 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 // database #include +#include #include #include 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 #include -#include -#include - #include #include #include 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 +#include #include #include 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 #include -#include -#include // runtime_error #include -#include -#include #include #include 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 #include -#include #include #include // strchr() -#include #include // bind() #include #include -#include -#include - #include 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 +#include + 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 #include #include -#include // ostream -#include #include // static_assert #include @@ -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 -#include - #include -#include -#include - #include 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 #include +#include #include 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 #include -#include -#include - #include #include 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 +#include +#include + #include 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 #include -#include // unique_ptr, weak_ptr, shared_ptr -#include // size_t -#include // uint{8,16,32,64}_t +#include // unique_ptr, shared_ptr +#include // pair +#include // size_t, nullptr_t +#include // uint{8,16,32,64}_t +#include +#include +#include // function, reference_wrapper + +#include // exception +#include // logic_error, invalid_argument, runtime_error +#include #include @@ -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; + using cstrings = vector; - using butl::optional; - using butl::nullopt; + using std::istream; + using std::ostream; - // Smart pointers + // Exceptions. While 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; + // + // + 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; + using dir_paths = std::vector; + // // 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 +#include #include 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 -#include - #include 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 // to_string() -#include // make_shared() -#include -#include // move() +#include // make_shared() +#include // to_string() +#include // move(), forward(), declval(), make_pair() +#include // assert() +#include // make_move_iterator() + +#include // 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; + + // + // + using butl::reverse_iterate; }; #endif // BREP_UTILITY -- cgit v1.1