From df1ef68cd8e8582724ce1192bfc202e0b9aeaf0c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 28 Sep 2021 19:24:31 +0300 Subject: Get rid of C++ modules related code and rename *.mxx files to *.hxx --- libbutl/path-io.hxx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 libbutl/path-io.hxx (limited to 'libbutl/path-io.hxx') diff --git a/libbutl/path-io.hxx b/libbutl/path-io.hxx new file mode 100644 index 0000000..a60527d --- /dev/null +++ b/libbutl/path-io.hxx @@ -0,0 +1,36 @@ +// file : libbutl/path-io.hxx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +#pragma once + +#include +#include + +#include + +#include + +namespace butl +{ + // This is the default path IO implementation. It is separate to allow + // custom implementations. For example, we may want to print paths as + // relative to the working directory. Or we may want to print '~' for the + // home directory prefix. Or we may want to print dir_path with a trailing + // '/'. + // + template + inline std::basic_ostream& + operator<< (std::basic_ostream& os, const basic_path& p) + { + return to_stream (os, p, false /* representation */); + } + + template + inline std::basic_ostream& + operator<< (std::basic_ostream& os, const basic_path_name_view

& v) + { + assert (!v.null ()); + + return v.name != nullptr && *v.name ? (os << **v.name) : (os << *v.path); + } +} -- cgit v1.1