fmt conversion: convert mkvpropedit's files

This commit is contained in:
Moritz Bunkus 2018-11-19 21:31:42 +01:00
parent ac533b84ba
commit aaccc71d36
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
9 changed files with 132 additions and 133 deletions

View File

@ -63,35 +63,35 @@ attachment_target_c::validate() {
try {
m_file_content = mm_file_io_c::slurp(m_file_name);
} catch (mtx::mm_io::exception &ex) {
mxerror(boost::format(Y("The file '%1%' could not be opened for reading: %2%.\n")) % m_file_name % ex.what());
mxerror(fmt::format(Y("The file '{0}' could not be opened for reading: {1}.\n"), m_file_name, ex.what()));
}
}
void
attachment_target_c::dump_info()
const {
mxinfo(boost::format(" attachment target:\n"
" 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"
: ac_update == m_command ? "update"
: "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);
mxinfo(fmt::format(" attachment target:\n"
" file_name: {0}\n"
" command: {1} ({2})\n"
" options: {3}\n"
" selector_type: {4} ({5})\n"
" selector_num_arg: {6}\n"
" selector_string_arg: {7}\n",
m_file_name,
m_command,
ac_add == m_command ? "add"
: ac_delete == m_command ? "delete"
: ac_replace == m_command ? "replace"
: ac_update == m_command ? "update"
: "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
@ -201,7 +201,7 @@ attachment_target_c::execute_delete() {
bool deleted_something = st_id == m_selector_type ? delete_by_id() : delete_by_uid_name_mime_type();
if (!deleted_something)
mxwarn(boost::format(Y("No attachment matched the spec '%1%'.\n")) % m_spec);
mxwarn(fmt::format(Y("No attachment matched the spec '{0}'.\n"), m_spec));
else
m_attachments_modified = true;
@ -212,7 +212,7 @@ attachment_target_c::execute_replace() {
bool replaced_something = st_id == m_selector_type ? replace_by_id() : replace_by_uid_name_mime_type();
if (!replaced_something)
mxwarn(boost::format(Y("No attachment matched the spec '%1%'.\n")) % m_spec);
mxwarn(fmt::format(Y("No attachment matched the spec '{0}'.\n"), m_spec));
else
m_attachments_modified = true;

View File

@ -50,7 +50,7 @@ change_c::change_c(change_c::change_type_e type,
void
change_c::validate() {
if (m_property.m_name.empty())
mxerror(boost::format(Y("The name '%1%' is not a valid property name for the current edit specification in '%2%'.\n")) % m_name % get_spec());
mxerror(fmt::format(Y("The name '{0}' is not a valid property name for the current edit specification in '{1}'.\n"), m_name, get_spec()));
if (change_c::ct_delete == m_type)
validate_deletion_of_mandatory();
@ -60,21 +60,21 @@ change_c::validate() {
std::string
change_c::get_spec() {
return change_c::ct_delete == m_type ? (boost::format("--delete %1%") % m_name ).str()
: (boost::format("--%1% %2%=%3%") % (change_c::ct_add == m_type ? "add" : "set") % m_name % m_value).str();
return change_c::ct_delete == m_type ? fmt::format("--delete {0}", m_name )
: fmt::format("--{0} {1}={2}", change_c::ct_add == m_type ? "add" : "set", m_name, m_value);
}
void
change_c::dump_info()
const
{
mxinfo(boost::format(" change:\n"
" type: %1%\n"
" name: %2%\n"
" value: %3%\n")
% static_cast<int>(m_type)
% m_name
% m_value);
mxinfo(fmt::format(" change:\n"
" type: {0}\n"
" name: {1}\n"
" value: {2}\n",
static_cast<int>(m_type),
m_name,
m_value));
}
bool
@ -108,7 +108,7 @@ change_c::parse_ascii_string() {
size_t i;
for (i = 0; m_value.length() > i; ++i)
if (127 < static_cast<unsigned char>(m_value[i]))
mxerror(boost::format(Y("The property value contains non-ASCII characters, but the property is not a Unicode string in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("The property value contains non-ASCII characters, but the property is not a Unicode string in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
m_s_value = m_value;
}
@ -121,13 +121,13 @@ change_c::parse_unicode_string() {
void
change_c::parse_unsigned_integer() {
if (!parse_number(m_value, m_ui_value))
mxerror(boost::format(Y("The property value is not a valid unsigned integer in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("The property value is not a valid unsigned integer in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
}
void
change_c::parse_signed_integer() {
if (!parse_number(m_value, m_si_value))
mxerror(boost::format(Y("The property value is not a valid signed integer in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("The property value is not a valid signed integer in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
}
void
@ -135,14 +135,14 @@ change_c::parse_boolean() {
try {
m_b_value = parse_bool(m_value);
} catch (...) {
mxerror(boost::format(Y("The property value is not a valid boolean in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("The property value is not a valid boolean in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
}
}
void
change_c::parse_floating_point_number() {
if (!parse_number(m_value, m_fp_value))
mxerror(boost::format(Y("The property value is not a valid floating point number in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("The property value is not a valid floating point number in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
}
void
@ -151,8 +151,8 @@ change_c::parse_binary() {
m_x_value = mtx::bits::value_c(m_value, m_property.m_bit_length);
} catch (...) {
if (m_property.m_bit_length)
mxerror(boost::format(Y("The property value is not a valid binary spec or it is not exactly %3% bits long in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED % m_property.m_bit_length);
mxerror(boost::format(Y("The property value is not a valid binary spec in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("The property value is not a valid binary spec or it is not exactly {2} bits long in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED, m_property.m_bit_length));
mxerror(fmt::format(Y("The property value is not a valid binary spec in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
}
}
@ -215,11 +215,11 @@ change_c::parse_date_time() {
}
}
mxerror(boost::format("%1% %2% %3% %4%\n")
% (boost::format(Y("The property value is not a valid date & time string in '%1%'.")) % get_spec()).str()
% Y("The recognized format is 'YYYY-mm-ddTHH:MM:SS+zz:zz': the year, month, day, letter 'T', hours, minutes, seconds and the time zone's offset from UTC; example: 2017-03-28T17:28-02:00.")
% Y("The letter 'Z' can be used instead of the time zone's offset from UTC to indicate UTC aka Zulu time.")
% FILE_NOT_MODIFIED);
mxerror(fmt::format("{0} {1} {2} {3}\n",
fmt::format(Y("The property value is not a valid date & time string in '{0}'."), get_spec()),
Y("The recognized format is 'YYYY-mm-ddTHH:MM:SS+zz:zz': the year, month, day, letter 'T', hours, minutes, seconds and the time zone's offset from UTC; example: 2017-03-28T17:28-02:00."),
Y("The letter 'Z' can be used instead of the time zone's offset from UTC to indicate UTC aka Zulu time."),
FILE_NOT_MODIFIED));
}
void
@ -253,7 +253,7 @@ change_c::execute_delete() {
}
if (1 < verbose)
mxinfo(boost::format(Y("Change for '%1%' executed. Number of entries deleted: %2%\n")) % get_spec() % num_deleted);
mxinfo(fmt::format(Y("Change for '{0}' executed. Number of entries deleted: {1}\n"), get_spec(), num_deleted));
}
void
@ -273,24 +273,24 @@ change_c::execute_add_or_set() {
if (0 == num_found) {
do_add_element();
if (1 < verbose)
mxinfo(boost::format(Y("Change for '%1%' executed. No property of this type found. One entry added.\n")) % get_spec());
mxinfo(fmt::format(Y("Change for '{0}' executed. No property of this type found. One entry added.\n"), get_spec()));
return;
}
if (change_c::ct_set == m_type) {
if (1 < verbose)
mxinfo(boost::format(Y("Change for '%1%' executed. Number of entries set: %2%.\n")) % get_spec() % num_found);
mxinfo(fmt::format(Y("Change for '{0}' executed. Number of entries set: {1}.\n"), get_spec(), num_found));
return;
}
const EbmlSemantic *semantic = get_semantic();
if (semantic && semantic->Unique)
mxerror(boost::format(Y("This property is unique. More instances cannot be added in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("This property is unique. More instances cannot be added in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
do_add_element();
if (1 < verbose)
mxinfo(boost::format(Y("Change for '%1%' executed. One entry added.\n")) % get_spec());
mxinfo(fmt::format(Y("Change for '{0}' executed. One entry added.\n"), get_spec()));
}
void
@ -329,7 +329,7 @@ change_c::validate_deletion_of_mandatory() {
std::unique_ptr<EbmlElement> elt(&semantic->Create());
if (!elt->DefaultISset())
mxerror(boost::format(Y("This property is mandatory and cannot be deleted in '%1%'. %2%\n")) % get_spec() % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("This property is mandatory and cannot be deleted in '{0}'. {1}\n"), get_spec(), FILE_NOT_MODIFIED));
}
const EbmlSemantic *
@ -360,7 +360,7 @@ change_c::parse_spec(change_c::change_type_e type,
&& (name == "language")) {
auto idx = map_to_iso639_2_code(value);
if (-1 == idx)
throw std::runtime_error{(boost::format(("invalid ISO 639-2 language code '%1%'")) % value).str()};
throw std::runtime_error{fmt::format(("invalid ISO 639-2 language code '{0}'"), value)};
value = g_iso639_languages[idx].iso639_2_code;
}

View File

@ -41,9 +41,9 @@ chapter_target_c::validate() {
void
chapter_target_c::dump_info()
const {
mxinfo(boost::format(" chapter target:\n"
" file_name: %1%\n")
% m_file_name);
mxinfo(fmt::format(" chapter target:\n"
" file_name: {0}\n",
m_file_name));
}
bool
@ -66,7 +66,7 @@ chapter_target_c::execute() {
fix_mandatory_elements(m_level1_element);
if (!m_level1_element->CheckMandatory())
mxerror(boost::format(Y("Error parsing the chapters in '%1%': some mandatory elements are missing.\n")) % m_file_name);
mxerror(fmt::format(Y("Error parsing the chapters in '{0}': some mandatory elements are missing.\n"), m_file_name));
if (m_analyzer->is_webm())
mtx::chapters::remove_elements_unsupported_by_webm(*m_level1_element);

View File

@ -127,7 +127,7 @@ options_c::add_delete_track_statistics_tags(tag_target_c::tag_operation_mode_e o
void
options_c::set_file_name(const std::string &file_name) {
if (!m_file_name.empty())
mxerror(boost::format(Y("More than one file name has been given ('%1%' and '%2%').\n")) % m_file_name % file_name);
mxerror(fmt::format(Y("More than one file name has been given ('{0}' and '{1}').\n"), m_file_name, file_name));
m_file_name = file_name;
}
@ -148,13 +148,13 @@ void
options_c::dump_info()
const
{
mxinfo(boost::format("options:\n"
" file_name: %1%\n"
" show_progress: %2%\n"
" parse_mode: %3%\n")
% m_file_name
% m_show_progress
% static_cast<int>(m_parse_mode));
mxinfo(fmt::format("options:\n"
" file_name: {0}\n"
" show_progress: {1}\n"
" parse_mode: {2}\n",
m_file_name,
m_show_progress,
static_cast<int>(m_parse_mode)));
for (auto &target : m_targets)
target->dump_info();
@ -183,7 +183,7 @@ read_element(kax_analyzer_c *analyzer,
e = analyzer->read_element(index);
if (require_existance && (!e || !dynamic_cast<T *>(e.get())))
mxerror(boost::format(Y("Modification of properties in the section '%1%' was requested, but no corresponding level 1 element was found in the file. %2%\n")) % category % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("Modification of properties in the section '{0}' was requested, but no corresponding level 1 element was found in the file. {1}\n"), category, FILE_NOT_MODIFIED));
return e;
}
@ -263,8 +263,8 @@ options_c::merge_targets() {
existing_target_it->second->merge_changes(*track_target);
mxwarn(boost::format(Y("The edit specifications '%1%' and '%2%' resolve to the same track with the UID %3%.\n"))
% existing_target_it->second->get_spec() % track_target->get_spec() % track_uid);
mxwarn(fmt::format(Y("The edit specifications '{0}' and '{1}' resolve to the same track with the UID {2}.\n"),
existing_target_it->second->get_spec(), track_target->get_spec(), track_uid));
}
m_targets.swap(targets_to_keep);

View File

@ -30,7 +30,7 @@ std::unique_ptr<mtx::doc_type_version_handler_c> g_doc_type_version_handler;
static void
display_update_element_result(const EbmlCallbacks &callbacks,
kax_analyzer_c::update_element_result_e result) {
std::string message((boost::format(Y("Updating the '%1%' element failed. Reason:")) % callbacks.DebugName).str());
std::string message(fmt::format(Y("Updating the '{0}' element failed. Reason:"), callbacks.DebugName));
message += " ";
switch (result) {
@ -47,24 +47,24 @@ display_update_element_result(const EbmlCallbacks &callbacks,
break;
case kax_analyzer_c::uer_error_opening_for_reading:
message += (boost::format("%1% %2%")
% Y("The file could not be opened for reading.")
% Y("Possible reasons are: the file is not a Matroska file; the file is write-protected; the file is locked by another process; you do not have permission to access the file.")).str();
message += fmt::format("{0} {1}",
Y("The file could not be opened for reading."),
Y("Possible reasons are: the file is not a Matroska file; the file is write-protected; the file is locked by another process; you do not have permission to access the file."));
break;
case kax_analyzer_c::uer_error_opening_for_writing:
message += (boost::format("%1% %2%")
% Y("The file could not be opened for writing.")
% Y("Possible reasons are: the file is not a Matroska file; the file is write-protected; the file is locked by another process; you do not have permission to access the file.")).str();
message += fmt::format("{0} {1}",
Y("The file could not be opened for writing."),
Y("Possible reasons are: the file is not a Matroska file; the file is write-protected; the file is locked by another process; you do not have permission to access the file."));
break;
case kax_analyzer_c::uer_error_fixing_last_element_unknown_size_failed:
message += (boost::format("%1% %2% %3% %4% %5%")
% Y("The Matroska file's last element is set to an unknown size.")
% Y("Due to the particular structure of the file this situation cannot be fixed automatically.")
% Y("The file can be fixed by multiplexing it with mkvmerge again.")
% Y("The process will be aborted.")
% Y("The file has not been modified.")).str();
message += fmt::format("{0} {1} {2} {3} {4}",
Y("The Matroska file's last element is set to an unknown size."),
Y("Due to the particular structure of the file this situation cannot be fixed automatically."),
Y("The file can be fixed by multiplexing it with mkvmerge again."),
Y("The process will be aborted."),
Y("The file has not been modified."));
break;
default:
@ -99,7 +99,7 @@ write_changes(options_cptr &options,
if (id_to_write != l1_element.Generic().GlobalId)
continue;
mxverb(2, boost::format(Y("Element %1% is written.\n")) % l1_element.Generic().DebugName);
mxverb(2, fmt::format(Y("Element {0} is written.\n"), l1_element.Generic().DebugName));
auto result = l1_element.ListSize() ? analyzer->update_element(&l1_element, target->write_elements_set_to_default_value(), target->add_mandatory_elements_if_missing())
: analyzer->remove_elements(EbmlId(l1_element));
@ -121,7 +121,7 @@ update_ebml_head(mm_io_c &file) {
: mtx::doc_type_version_handler_c::update_result_e::err_not_enough_space == result ? Y("There's not enough space at the beginning of the file to fit the updated 'EBML head' element in.")
: Y("A generic read or write failure occurred.");
mxwarn(boost::format("%1% %2%\n") % Y("Updating the 'document type version' or 'document type read version' header fields failed.") % details);
mxwarn(fmt::format("{0} {1}\n", Y("Updating the 'document type version' or 'document type read version' header fields failed."), details));
}
static void
@ -132,14 +132,14 @@ run(options_cptr &options) {
try {
if (!kax_analyzer_c::probe(options->m_file_name))
mxerror(boost::format("The file '%1%' is not a Matroska file or it could not be found.\n") % options->m_file_name);
mxerror(fmt::format(Y("The file '{0}' is not a Matroska file or it could not be found.\n"), options->m_file_name));
analyzer = console_kax_analyzer_cptr(new console_kax_analyzer_c(options->m_file_name));
} catch (mtx::mm_io::exception &ex) {
mxerror(boost::format("The file '%1%' could not be opened for reading and writing: %1.\n") % options->m_file_name % ex);
mxerror(fmt::format(Y("The file '{0}' could not be opened for reading and writing: {1}.\n"), options->m_file_name, ex));
}
mxinfo(boost::format("%1%\n") % Y("The file is being analyzed."));
mxinfo(fmt::format("{0}\n", Y("The file is being analyzed.")));
analyzer->set_show_progress(options->m_show_progress);
@ -152,7 +152,7 @@ run(options_cptr &options) {
.set_doc_type_version_handler(g_doc_type_version_handler.get())
.process();
} catch (mtx::exception &ex) {
mxerror(boost::format(Y("The file '%1%' could not be opened for reading and writing, or a read/write operation on it failed: %2%.\n")) % options->m_file_name % ex);
mxerror(fmt::format(Y("The file '{0}' could not be opened for reading and writing, or a read/write operation on it failed: {1}.\n"), options->m_file_name, ex));
} catch (...) {
}

View File

@ -31,7 +31,7 @@ propedit_cli_parser_c::set_parse_mode() {
try {
m_options->set_parse_mode(m_next_arg);
} catch (...) {
mxerror(boost::format(Y("Unknown parse mode in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Unknown parse mode in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -40,7 +40,7 @@ propedit_cli_parser_c::add_target() {
try {
m_target = m_options->add_track_or_segmentinfo_target(m_next_arg);
} catch (...) {
mxerror(boost::format(Y("Invalid selector in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Invalid selector in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -52,7 +52,7 @@ propedit_cli_parser_c::add_change() {
: change_c::ct_delete;
m_target->add_change(type, m_next_arg);
} catch (std::runtime_error &error) {
mxerror(boost::format(Y("Invalid change spec (%3%) in '%1% %2%'.\n")) % m_current_arg % m_next_arg % error.what());
mxerror(fmt::format(Y("Invalid change spec ({2}) in '{0} {1}'.\n"), m_current_arg, m_next_arg, error.what()));
}
}
@ -61,7 +61,7 @@ propedit_cli_parser_c::add_tags() {
try {
m_options->add_tags(m_next_arg);
} catch (...) {
mxerror(boost::format(Y("Invalid selector in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Invalid selector in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -70,7 +70,7 @@ propedit_cli_parser_c::add_chapters() {
try {
m_options->add_chapters(m_next_arg);
} catch (...) {
mxerror(boost::format(Y("Invalid selector in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Invalid selector in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -93,7 +93,7 @@ void
propedit_cli_parser_c::set_attachment_uid() {
auto uid = uint64_t{};
if (!parse_number(m_next_arg, uid))
mxerror(boost::format(Y("The value '%1%' is not a number.\n")) % m_next_arg);
mxerror(fmt::format(Y("The value '{0}' is not a number.\n"), m_next_arg));
m_attachment.m_uid.reset(uid);
}
@ -104,7 +104,7 @@ propedit_cli_parser_c::add_attachment() {
m_options->add_attachment_command(attachment_target_c::ac_add, m_next_arg, m_attachment);
m_attachment = attachment_target_c::options_t();
} catch (...) {
mxerror(boost::format(Y("Invalid selector in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Invalid selector in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -113,7 +113,7 @@ propedit_cli_parser_c::delete_attachment() {
try {
m_options->add_attachment_command(attachment_target_c::ac_delete, m_next_arg, m_attachment);
} catch (...) {
mxerror(boost::format(Y("Invalid selector in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Invalid selector in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -123,7 +123,7 @@ propedit_cli_parser_c::replace_attachment() {
m_options->add_attachment_command(m_current_arg == "--update-attachment" ? attachment_target_c::ac_update : attachment_target_c::ac_replace, m_next_arg, m_attachment);
m_attachment = attachment_target_c::options_t();
} catch (...) {
mxerror(boost::format(Y("Invalid selector in '%1% %2%'.\n")) % m_current_arg % m_next_arg);
mxerror(fmt::format(Y("Invalid selector in '{0} {1}'.\n"), m_current_arg, m_next_arg));
}
}
@ -179,17 +179,16 @@ propedit_cli_parser_c::list_property_names_for_table(const std::vector<property_
auto max_name_len = boost::accumulate(table, 0u, [](size_t a, const property_element_c &e) { return std::max(a, e.m_name.length()); });
static boost::regex s_newline_re("\\s*\\n\\s*", boost::regex::perl);
boost::format format((boost::format("%%|1$-%1%s| | %%|2$-2s| |") % max_name_len).str());
std::string indent_string = std::string(max_name_len, ' ') + " | | ";
mxinfo("\n");
mxinfo(boost::format(Y("Elements in the category '%1%' ('--edit %2%'):\n")) % title % edit_spec);
mxinfo(fmt::format(Y("Elements in the category '{0}' ('--edit {1}'):\n"), title, edit_spec));
for (auto &property : table) {
std::string name = (format % property.m_name % ebml_type_map[property.m_type]).str();
std::string description = property.m_title.get_translated()
+ ": "
+ boost::regex_replace(property.m_description.get_translated(), s_newline_re, " ", boost::match_default | boost::match_single_line);
auto name = fmt::format("{0:<{1}} | {2:<2} |", property.m_name, max_name_len, ebml_type_map[property.m_type]);
auto description = property.m_title.get_translated()
+ ": "
+ boost::regex_replace(property.m_description.get_translated(), s_newline_re, " ", boost::match_default | boost::match_single_line);
mxinfo(format_paragraph(description, max_name_len + 8, name, indent_string));
}
}

View File

@ -58,7 +58,7 @@ segment_info_target_c::add_change(change_c::change_type_e type,
void
segment_info_target_c::dump_info()
const {
mxinfo(boost::format(" segment_info_target:\n"));
mxinfo(fmt::format(" segment_info_target:\n"));
for (auto &change : m_changes)
change->dump_info();

View File

@ -100,19 +100,19 @@ void
tag_target_c::dump_info()
const
{
mxinfo(boost::format(" tag_target:\n"
" operation_mode: %1%\n"
" selection_mode: %2%\n"
" selection_param: %3%\n"
" selection_track_type: %4%\n"
" track_uid: %5%\n"
" file_name: %6%\n")
% static_cast<int>(m_operation_mode)
% static_cast<int>(m_selection_mode)
% m_selection_param
% m_selection_track_type
% m_track_uid
% m_file_name);
mxinfo(fmt::format(" tag_target:\n"
" operation_mode: {0}\n"
" selection_mode: {1}\n"
" selection_param: {2}\n"
" selection_track_type: {3}\n"
" track_uid: {4}\n"
" file_name: {5}\n",
static_cast<int>(m_operation_mode),
static_cast<int>(m_selection_mode),
m_selection_param,
m_selection_track_type,
m_track_uid,
m_file_name));
for (auto &change : m_changes)
change->dump_info();
@ -168,7 +168,7 @@ tag_target_c::execute() {
fix_mandatory_elements(m_level1_element);
if (!m_level1_element->CheckMandatory())
mxerror(boost::format(Y("Error parsing the tags in '%1%': some mandatory elements are missing.\n")) % m_file_name);
mxerror(fmt::format(Y("Error parsing the tags in '{0}': some mandatory elements are missing.\n"), m_file_name));
if (m_analyzer->is_webm())
mtx::tags::remove_elements_unsupported_by_webm(*m_level1_element);
@ -351,7 +351,7 @@ tag_target_c::account_all_clusters() {
file.setFilePointer(m_analyzer->get_segment_data_start_pos());
mxinfo(Y("The file is read in order to create track statistics.\n"));
mxinfo(boost::format(Y("Progress: %1%%%%2%")) % 0 % "\r");
mxinfo(fmt::format(Y("Progress: {0}%{1}"), 0, "\r"));
while (true) {
auto cluster = kax_file->read_next_cluster();
@ -364,12 +364,12 @@ tag_target_c::account_all_clusters() {
auto current_progress = std::lround(file.getFilePointer() * 100ull / static_cast<double>(file_size));
if (current_progress != previous_progress) {
mxinfo(boost::format(Y("Progress: %1%%%%2%")) % current_progress % "\r");
mxinfo(fmt::format(Y("Progress: {0}%{1}"), current_progress, "\r"));
previous_progress = current_progress;
}
}
mxinfo(boost::format(Y("Progress: %1%%%%2%")) % 100 % "\n");
mxinfo(fmt::format(Y("Progress: {0}%{1}"), 100, "\n"));
}
void

View File

@ -69,17 +69,17 @@ track_target_c::add_change(change_c::change_type_e type,
void
track_target_c::dump_info()
const {
mxinfo(boost::format(" track_target:\n"
" selection_mode: %1%\n"
" selection_param: %2%\n"
" selection_track_type: %3%\n"
" track_uid: %4%\n"
" file_name: %5%\n")
% static_cast<int>(m_selection_mode)
% m_selection_param
% m_selection_track_type
% m_track_uid
% m_file_name);
mxinfo(fmt::format(" track_target:\n"
" selection_mode: {0}\n"
" selection_param: {1}\n"
" selection_track_type: {2}\n"
" track_uid: {3}\n"
" file_name: {4}\n",
static_cast<int>(m_selection_mode),
m_selection_param,
m_selection_track_type,
m_track_uid,
m_file_name));
for (auto &change : m_changes)
change->dump_info();
@ -196,7 +196,7 @@ track_target_c::set_level1_element(ebml_element_cptr level1_element_cp,
return;
}
mxerror(boost::format(Y("No track corresponding to the edit specification '%1%' was found. %2%\n")) % m_spec % FILE_NOT_MODIFIED);
mxerror(fmt::format(Y("No track corresponding to the edit specification '{0}' was found. {1}\n"), m_spec, FILE_NOT_MODIFIED));
}
void