diff options
author | 2012-12-04 18:43:47 -0800 | |
---|---|---|
committer | 2012-12-05 18:57:15 +0000 | |
commit | cb1b7137a7ce1de0df29d8427dfb0525b7a89c7e (patch) | |
tree | faed5bbdc597e22a15e80dde4109887ce8ec9d6e | |
parent | 65caf381182ed6dd28cc3674ccb0efc008ba0698 (diff) | |
download | paludis-cb1b7137a7ce1de0df29d8427dfb0525b7a89c7e.tar.gz paludis-cb1b7137a7ce1de0df29d8427dfb0525b7a89c7e.tar.xz |
stripper: refactor the action description strings
The action description strings are used by the subclasses of the stripper.
Rather than duplicating them, move them into the base class.
Reorder the functions to match ordering and annotate virtual and overrides.
-rw-r--r-- | paludis/repositories/e/e_stripper.cc | 29 | ||||
-rw-r--r-- | paludis/repositories/e/e_stripper.hh | 5 | ||||
-rw-r--r-- | paludis/repositories/unpackaged/unpackaged_stripper.cc | 29 | ||||
-rw-r--r-- | paludis/repositories/unpackaged/unpackaged_stripper.hh | 5 | ||||
-rw-r--r-- | paludis/stripper.cc | 18 | ||||
-rw-r--r-- | paludis/stripper.hh | 4 |
6 files changed, 62 insertions, 28 deletions
diff --git a/paludis/repositories/e/e_stripper.cc b/paludis/repositories/e/e_stripper.cc index 2354284eb..878d5458f 100644 --- a/paludis/repositories/e/e_stripper.cc +++ b/paludis/repositories/e/e_stripper.cc @@ -57,40 +57,45 @@ EStripper::~EStripper() } void -EStripper::on_strip(const FSPath & f) +EStripper::on_enter_dir(const FSPath &) { - _imp->options.output_manager()->stdout_stream() << "str " << f.strip_leading(_imp->options.image_dir()) << std::endl; } void -EStripper::on_split(const FSPath & f, const FSPath & g) +EStripper::on_leave_dir(const FSPath &) { - _imp->options.output_manager()->stdout_stream() - << ((_imp->options.compress_splits()) ? "spz " : "spl ") - << f.strip_leading(_imp->options.image_dir()) - << " -> " << g.strip_leading(_imp->options.image_dir()) << std::endl; } void -EStripper::on_unknown(const FSPath & f) +EStripper::on_strip(const FSPath & f) { - _imp->options.output_manager()->stdout_stream() << "--- " << f.strip_leading(_imp->options.image_dir()) << std::endl; + _imp->options.output_manager()->stdout_stream() + << strip_action_desc() << " " + << f.strip_leading(_imp->options.image_dir()) << std::endl; } void -EStripper::on_enter_dir(const FSPath &) +EStripper::on_split(const FSPath & f, const FSPath & g) { + _imp->options.output_manager()->stdout_stream() + << split_action_desc() << " " + << f.strip_leading(_imp->options.image_dir()) + << " -> " << g.strip_leading(_imp->options.image_dir()) << std::endl; } void -EStripper::on_leave_dir(const FSPath &) +EStripper::on_unknown(const FSPath & f) { + _imp->options.output_manager()->stdout_stream() + << unknown_action_desc() << " " + << f.strip_leading(_imp->options.image_dir()) << std::endl; } void EStripper::strip() { - _imp->options.output_manager()->stdout_stream() << ">>> Stripping inside " << _imp->options.image_dir() << std::endl; + _imp->options.output_manager()->stdout_stream() + << ">>> Stripping inside " << _imp->options.image_dir() << std::endl; Stripper::strip(); } diff --git a/paludis/repositories/e/e_stripper.hh b/paludis/repositories/e/e_stripper.hh index e9f11217e..80c9e78bc 100644 --- a/paludis/repositories/e/e_stripper.hh +++ b/paludis/repositories/e/e_stripper.hh @@ -58,10 +58,11 @@ namespace paludis Pimp<EStripper> _imp; protected: - virtual void on_strip(const FSPath &); - virtual void on_split(const FSPath &, const FSPath &); virtual void on_enter_dir(const FSPath &); virtual void on_leave_dir(const FSPath &); + + virtual void on_strip(const FSPath &); + virtual void on_split(const FSPath &, const FSPath &); virtual void on_unknown(const FSPath &); public: diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.cc b/paludis/repositories/unpackaged/unpackaged_stripper.cc index 8cc76d89a..e671fd813 100644 --- a/paludis/repositories/unpackaged/unpackaged_stripper.cc +++ b/paludis/repositories/unpackaged/unpackaged_stripper.cc @@ -57,40 +57,45 @@ UnpackagedStripper::~UnpackagedStripper() } void -UnpackagedStripper::on_strip(const FSPath & f) +UnpackagedStripper::on_enter_dir(const FSPath &) { - _imp->options.output_manager()->stdout_stream() << "str " << f.strip_leading(_imp->options.image_dir()) << std::endl; } void -UnpackagedStripper::on_split(const FSPath & f, const FSPath & g) +UnpackagedStripper::on_leave_dir(const FSPath &) { - _imp->options.output_manager()->stdout_stream() - << ((_imp->options.compress_splits()) ? "spz " : "spl ") - << f.strip_leading(_imp->options.image_dir()) - << " -> " << g.strip_leading(_imp->options.image_dir()) << std::endl; } void -UnpackagedStripper::on_unknown(const FSPath & f) +UnpackagedStripper::on_strip(const FSPath & f) { - _imp->options.output_manager()->stdout_stream() << "--- " << f.strip_leading(_imp->options.image_dir()) << std::endl; + _imp->options.output_manager()->stdout_stream() + << strip_action_desc() << " " + << f.strip_leading(_imp->options.image_dir()) << std::endl; } void -UnpackagedStripper::on_enter_dir(const FSPath &) +UnpackagedStripper::on_split(const FSPath & f, const FSPath & g) { + _imp->options.output_manager()->stdout_stream() + << split_action_desc() << " " + << f.strip_leading(_imp->options.image_dir()) + << " -> " << g.strip_leading(_imp->options.image_dir()) << std::endl; } void -UnpackagedStripper::on_leave_dir(const FSPath &) +UnpackagedStripper::on_unknown(const FSPath & f) { + _imp->options.output_manager()->stdout_stream() + << unknown_action_desc() << " " + << f.strip_leading(_imp->options.image_dir()) << std::endl; } void UnpackagedStripper::strip() { - _imp->options.output_manager()->stdout_stream() << ">>> Stripping inside " << _imp->options.image_dir() << std::endl; + _imp->options.output_manager()->stdout_stream() + << ">>> Stripping inside " << _imp->options.image_dir() << std::endl; Stripper::strip(); } diff --git a/paludis/repositories/unpackaged/unpackaged_stripper.hh b/paludis/repositories/unpackaged/unpackaged_stripper.hh index 9f1599cbe..cc136228c 100644 --- a/paludis/repositories/unpackaged/unpackaged_stripper.hh +++ b/paludis/repositories/unpackaged/unpackaged_stripper.hh @@ -58,10 +58,11 @@ namespace paludis Pimp<UnpackagedStripper> _imp; protected: - virtual void on_strip(const FSPath &); - virtual void on_split(const FSPath &, const FSPath &); virtual void on_enter_dir(const FSPath &); virtual void on_leave_dir(const FSPath &); + + virtual void on_strip(const FSPath &); + virtual void on_split(const FSPath &, const FSPath &); virtual void on_unknown(const FSPath &); public: diff --git a/paludis/stripper.cc b/paludis/stripper.cc index 49e5805ef..bc3a8c36b 100644 --- a/paludis/stripper.cc +++ b/paludis/stripper.cc @@ -282,3 +282,21 @@ Stripper::do_split(const FSPath & f, const FSPath & g) g.chmod(g.stat().permissions() & ~(S_IXGRP | S_IXUSR | S_IXOTH | S_IWOTH)); } +std::string +Stripper::strip_action_desc() const +{ + return "str"; +} + +std::string +Stripper::split_action_desc() const +{ + return (_imp->options.compress_splits() ? "spz" : "spl"); +} + +std::string +Stripper::unknown_action_desc() const +{ + return "---"; +} + diff --git a/paludis/stripper.hh b/paludis/stripper.hh index f768e8b04..d4af5c209 100644 --- a/paludis/stripper.hh +++ b/paludis/stripper.hh @@ -75,6 +75,10 @@ namespace paludis virtual void do_split(const FSPath &, const FSPath &); virtual void do_strip(const FSPath &, const std::string &); + virtual std::string strip_action_desc() const; + virtual std::string split_action_desc() const; + virtual std::string unknown_action_desc() const; + public: ///\name Basic operations ///\{ |