6#ifndef MIMICPP_PRINTING_PATH_PRINTER_HPP
7#define MIMICPP_PRINTING_PATH_PRINTER_HPP
15#ifndef MIMICPP_DETAIL_IS_MODULE
22namespace mimicpp::printing::detail
24 constexpr int maxPathElements{3};
29 template <pr
int_iterator OutIter>
30 OutIter operator()(OutIter out, std::filesystem::path
const& path)
const
32 static constexpr CharT separator{std::filesystem::path::preferred_separator};
34 auto const pathString = path.lexically_normal().string();
35 auto const rend = pathString.crend();
36 auto iter = std::ranges::find(pathString.crbegin(), rend, separator);
40 ++i, iter = std::ranges::find(iter, rend, separator))
45 return std::ranges::copy(iter.base(), pathString.cend(), std::move(out)).out;
49 StringT operator()(std::filesystem::path
const& path)
const
54 std::ostreambuf_iterator{stream},
56 return std::move(stream).str();
76 [[maybe_unused]]
inline constexpr printing::detail::PathPrinterFn
print_path{};
#define MIMICPP_DETAIL_MODULE_EXPORT
Definition Config.hpp:19
constexpr printing::detail::PathPrinterFn print_path
Functional object that outputs paths in a specific format.
Definition PathPrinter.hpp:76
char CharT
Definition Fwd.hpp:389
std::basic_ostringstream< CharT, CharTraitsT > StringStreamT
Definition Format.hpp:35
std::basic_string< CharT, CharTraitsT > StringT
Definition Fwd.hpp:391