From 1509b4a549a01b7baf19837e96e3412af2ff584c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 27 Aug 2012 12:34:11 +0200 Subject: [PATCH] Implement attachment_target_c::dump_info() --- src/propedit/attachment_target.cpp | 24 ++++++++++++++++++++---- src/propedit/attachment_target.h | 12 ++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/propedit/attachment_target.cpp b/src/propedit/attachment_target.cpp index 355e7a8a8..558398ccc 100644 --- a/src/propedit/attachment_target.cpp +++ b/src/propedit/attachment_target.cpp @@ -61,11 +61,27 @@ attachment_target_c::validate() { void attachment_target_c::dump_info() const { - // TODO: dump_info() - assert(false); mxinfo(boost::format(" attachment target:\n" - " file_name: %1%\n") - % m_file_name); + " file_name: %1%\n" + " command: %2% (%3%)\n" + " options: %4%\n" + " selector_type: %5% (%6%)\n" + " selector_num_arg: %7%\n" + " selector_string_arg: %8%\n") + % m_file_name + % m_command + % ( ac_add == m_command ? "add" + : ac_delete == m_command ? "delete" + : ac_replace == m_command ? "replace" + : "unknown") + % m_options + % m_selector_type + % ( st_id == m_selector_type ? "ID" + : st_uid == m_selector_type ? "UID" + : st_name == m_selector_type ? "name" + : st_mime_type == m_selector_type ? "MIME type" + : "unknown") + % m_selector_num_arg % m_selector_string_arg); } bool diff --git a/src/propedit/attachment_target.h b/src/propedit/attachment_target.h index 07afe70cd..cf42cf5fc 100644 --- a/src/propedit/attachment_target.h +++ b/src/propedit/attachment_target.h @@ -100,4 +100,16 @@ operator ==(attachment_target_c::options_t const &a, && (a.m_mime_type == b.m_mime_type); } +inline std::ostream & +operator <<(std::ostream &out, + attachment_target_c::options_t const &opt) { + auto format = [](std::string const &name, std::pair const &value) -> std::string { + return value.second ? name + ":yes(" + value.first + ")" : name + ":no"; + }; + + out << "{" << format("name", opt.m_name) << " " << format("description", opt.m_description) << " " << format("MIME type", opt.m_mime_type) << "}"; + + return out; +} + #endif // MTX_PROPEDIT_ATTACHMENT_TARGET_H