[osmium-tool] 34/44: Put handling of --generator and --output-header into with_osm_output class.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 21 20:15:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to tag v1.1.0
in repository osmium-tool.

commit 04005880743e00d27f2f374e7d4f6fba2fe80847
Author: Jochen Topf <jochen at topf.org>
Date:   Fri Jul 3 13:57:30 2015 +0200

    Put handling of --generator and --output-header into with_osm_output class.
---
 src/command_apply_changes.cpp |  4 ----
 src/command_cat.cpp           |  8 --------
 src/command_cat.hpp           |  1 -
 src/command_getid.cpp         |  4 ----
 src/command_merge_changes.cpp |  4 ----
 src/command_renumber.cpp      |  4 ----
 src/command_renumber.hpp      |  1 -
 src/command_time_filter.cpp   |  4 ----
 src/osmc.hpp                  | 15 +++++++++++----
 9 files changed, 11 insertions(+), 34 deletions(-)

diff --git a/src/command_apply_changes.cpp b/src/command_apply_changes.cpp
index f8f48b4..76d8ef9 100644
--- a/src/command_apply_changes.cpp
+++ b/src/command_apply_changes.cpp
@@ -75,10 +75,6 @@ bool CommandApplyChanges::setup(const std::vector<std::string>& arguments) {
         m_remove_deleted = true;
     }
 
-    if (vm.count("generator")) {
-        m_generator = vm["generator"].as<std::string>();
-    }
-
     if (vm.count("verbose")) {
         m_vout.verbose(true);
     }
diff --git a/src/command_cat.cpp b/src/command_cat.cpp
index 426d2b1..f960313 100644
--- a/src/command_cat.cpp
+++ b/src/command_cat.cpp
@@ -64,14 +64,6 @@ bool CommandCat::setup(const std::vector<std::string>& arguments) {
         m_vout.verbose(true);
     }
 
-    if (vm.count("generator")) {
-        m_generator = vm["generator"].as<std::string>();
-    }
-
-    if (vm.count("output-header")) {
-        m_output_headers = vm["output-header"].as<std::vector<std::string>>();
-    }
-
     if (vm.count("object-type")) {
         m_osm_entity_bits = osmium::osm_entity_bits::nothing;
         for (const auto& t : vm["object-type"].as<std::vector<std::string>>()) {
diff --git a/src/command_cat.hpp b/src/command_cat.hpp
index 9673c56..252256c 100644
--- a/src/command_cat.hpp
+++ b/src/command_cat.hpp
@@ -32,7 +32,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 class CommandCat : public Command, with_multiple_osm_inputs, with_osm_output {
 
-    std::vector<std::string> m_output_headers;
     osmium::osm_entity_bits::type m_osm_entity_bits = osmium::osm_entity_bits::all;
 
 public:
diff --git a/src/command_getid.cpp b/src/command_getid.cpp
index 27c6300..60d8fcc 100644
--- a/src/command_getid.cpp
+++ b/src/command_getid.cpp
@@ -95,10 +95,6 @@ bool CommandGetId::setup(const std::vector<std::string>& arguments) {
         throw argument_error("Need at least one id to look for...");
     }
 
-    if (vm.count("generator")) {
-        m_generator = vm["generator"].as<std::string>();
-    }
-
     if (vm.count("verbose")) {
         m_vout.verbose(true);
     }
diff --git a/src/command_merge_changes.cpp b/src/command_merge_changes.cpp
index 331b08d..13d4f38 100644
--- a/src/command_merge_changes.cpp
+++ b/src/command_merge_changes.cpp
@@ -65,10 +65,6 @@ bool CommandMergeChanges::setup(const std::vector<std::string>& arguments) {
         m_simplify_change = true;
     }
 
-    if (vm.count("generator")) {
-        m_generator = vm["generator"].as<std::string>();
-    }
-
     if (vm.count("verbose")) {
         m_vout.verbose(true);
     }
diff --git a/src/command_renumber.cpp b/src/command_renumber.cpp
index baa71dd..205cdf0 100644
--- a/src/command_renumber.cpp
+++ b/src/command_renumber.cpp
@@ -74,10 +74,6 @@ bool CommandRenumber::setup(const std::vector<std::string>& arguments) {
         m_vout.verbose(true);
     }
 
-    if (vm.count("generator")) {
-        m_generator = vm["generator"].as<std::string>();
-    }
-
     if (vm.count("output-header")) {
         m_output_headers = vm["output-header"].as<std::vector<std::string>>();
     }
diff --git a/src/command_renumber.hpp b/src/command_renumber.hpp
index 8527ec0..d7f0483 100644
--- a/src/command_renumber.hpp
+++ b/src/command_renumber.hpp
@@ -37,7 +37,6 @@ typedef std::map<osmium::unsigned_object_id_type, osmium::unsigned_object_id_typ
 
 class CommandRenumber : public Command, with_single_osm_input, with_osm_output {
 
-    std::vector<std::string> m_output_headers;
     std::string m_index_directory;
 
     remap_index_type m_id_index[3];
diff --git a/src/command_time_filter.cpp b/src/command_time_filter.cpp
index 59ec4cb..f3c6c1c 100644
--- a/src/command_time_filter.cpp
+++ b/src/command_time_filter.cpp
@@ -66,10 +66,6 @@ bool CommandTimeFilter::setup(const std::vector<std::string>& arguments) {
         m_vout.verbose(true);
     }
 
-    if (vm.count("generator")) {
-        m_generator = vm["generator"].as<std::string>();
-    }
-
     m_from = osmium::Timestamp(time(0));
     m_to = m_from;
 
diff --git a/src/osmc.hpp b/src/osmc.hpp
index 0b5ec2a..1547757 100644
--- a/src/osmc.hpp
+++ b/src/osmc.hpp
@@ -57,15 +57,12 @@ class Command {
 
 protected:
 
-    std::string m_generator;
     bool m_debug {false};
     osmium::util::VerboseOutput m_vout {false};
 
 public:
 
-    Command() :
-        m_generator("osmium/" OSMIUM_VERSION) {
-    }
+    Command() = default;
 
     virtual ~Command() {
     }
@@ -164,6 +161,8 @@ class with_osm_output {
 
 protected:
 
+    std::string m_generator { "osmium/" OSMIUM_VERSION };
+    std::vector<std::string> m_output_headers;
     std::string m_output_filename = "-"; // default: stdout
     std::string m_output_format;
     osmium::io::File m_output_file;
@@ -188,6 +187,14 @@ public:
             throw argument_error("When writing to STDOUT you need to use the --output-format,f option to declare the file format.");
         }
 
+        if (vm.count("generator")) {
+            m_generator = vm["generator"].as<std::string>();
+        }
+
+        if (vm.count("output-header")) {
+            m_output_headers = vm["output-header"].as<std::vector<std::string>>();
+        }
+
         m_output_file = osmium::io::File(m_output_filename, m_output_format);
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmium-tool.git



More information about the Pkg-grass-devel mailing list