Skip to content

Commit

Permalink
Revert "Starting to use std::format"
Browse files Browse the repository at this point in the history
This reverts commit 53ce000.
  • Loading branch information
flamewing committed Oct 20, 2023
1 parent 1577428 commit 908c854
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions include/mdcomp/options_lib.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@

#include <getopt.h>

#include <boost/io_fwd.hpp>
#include <boost/io/ios_state.hpp>

#include <array>
#include <charconv>
#include <concepts> // IWYU pragma: keep
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <format>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
#include <ranges>
Expand Down Expand Up @@ -96,17 +99,14 @@ namespace detail {
[[noreturn]] inline void print_error(
std::errc error, std::string const& parameter, char const* value) {
if (error == std::errc::invalid_argument) {
std::cerr << std::format(
"Invalid value '{}' given for '{}' parameter!\n", value, parameter);
std::cerr << "Invalid value '" << value << "' given for '" << parameter
<< "' parameter!\n";
} else if (error == std::errc::result_out_of_range) {
std::cerr << std::format(
"The value '{}' given for '{}' parameter is out of range!\n", value,
parameter);
std::cerr << "The value '" << value << "' given for '" << parameter
<< "' parameter is out of range!\n";
} else {
std::cerr << std::format(
"Unknown error happened when parsing value '{}' given for '{}' "
"parameter!\n",
value, parameter);
std::cerr << "Unknown error happened when parsing value '" << value
<< "' given for '" << parameter << "' parameter!\n";
}
throw 5;
}
Expand Down Expand Up @@ -277,8 +277,9 @@ namespace detail {
inline void do_decode(instream& input, outstream& output, options_t const& options) {
auto const do_print_end = [&]() noexcept {
if constexpr (has_print_end<options_t>) {
std::cout << std::format(
"0x{:06X}\n", static_cast<std::streamoff>(input.tellg()));
boost::io::ios_all_saver const flags(std::cout);
std::cout << "0x" << std::hex << std::setw(6) << std::setfill('0')
<< std::uppercase << std::right << input.tellg() << std::endl;
}
};
if constexpr (has_moduled<options_t>) {
Expand Down

0 comments on commit 908c854

Please sign in to comment.