diff --git a/crop.cpp b/crop.cpp index a6e3cda6dd725de1d47f3deee467bb93457407d0..92a3fb5e4138209d07ec06946496e6176c67ece3 100644 --- a/crop.cpp +++ b/crop.cpp @@ -20,8 +20,8 @@ enum class Options Separator, Invalid }; -using Option = support::MappedEnum<Options, Options::Invalid, 2>; -template <> Option::Guts::map_type Option::Guts::map +using Option = support::mapped_enum<Options, Options::Invalid, 2>; +template <> Option::guts::map_type Option::guts::map {{ { "-p"s, "--padding"s }, { "-c"s, "--color"s }, @@ -37,8 +37,8 @@ enum class Formats Hex, Invalid }; -using Format = support::MappedEnum<Formats, Formats::Invalid>; -template <> Format::Guts::map_type Format::Guts::map +using Format = support::mapped_enum<Formats, Formats::Invalid>; +template <> Format::guts::map_type Format::guts::map {{ { "plain"s }, { "one-line"s }, @@ -57,8 +57,8 @@ enum class Colors White, Invalid }; -using Color = support::MappedEnum<Colors, Colors::Invalid>; -template <> Color::Guts::map_type Color::Guts::map +using Color = support::mapped_enum<Colors, Colors::Invalid>; +template <> Color::guts::map_type Color::guts::map {{ { "black"s }, { "red"s }, @@ -70,7 +70,8 @@ template <> Color::Guts::map_type Color::Guts::map { "white"s } }}; -using const_range = support::range<file::buffer<>::const_iterator>; +using buffer = std::vector<unsigned char>; +using const_range = support::range<buffer::const_iterator>; void print(const_range range, Format format, Color color = Colors::Invalid) { @@ -110,7 +111,7 @@ void print(const_range range, Format format, Color color = Colors::Invalid) void crop(const string& filename, const string& range, Color color, size_t padding, Format format) { auto r = support::storn<size_t>(range); - const auto source = file::dump(file::bropex(filename)); + const auto source = file::dump<buffer>(file::bropex(filename)); print(support::get_iterator_range(source, {r.lower()-padding , r.lower()}), format); print(support::get_iterator_range(source, r), format, color); print(support::get_iterator_range(source, {r.upper(), r.upper()+padding}), format); diff --git a/shred.cpp b/shred.cpp index 32136964230993fa47494459c4932eacbc2e8d00..c15f9c3edd8f83f45bfcbf822265134d438b1a41 100644 --- a/shred.cpp +++ b/shred.cpp @@ -31,8 +31,8 @@ enum class Options Terminator, Invalid }; -using Option = support::MappedEnum<Options, Options::Invalid, 2>; -template <> Option::Guts::map_type Option::Guts::map +using Option = support::mapped_enum<Options, Options::Invalid, 2>; +template <> Option::guts::map_type Option::guts::map {{ { "-s"s, "--size"s }, { "--"s, "--files"s } @@ -76,7 +76,7 @@ void shred(string path, file::size_type piece_size = default_piece_size) << victim_size << '\n'; } - file::buffer<> piece; + file::buffer_type piece; for(int i = 1; victim_size; ++i, victim_size -= piece.size()) {