blob: 54d884b5326a574085a681d2c429cf55e74de718 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// file : libbutl/path-io.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#ifndef __cpp_modules_ts
#pragma once
#endif
// C includes.
#ifndef __cpp_lib_modules_ts
#include <ostream>
#endif
// Other includes.
#ifdef __cpp_modules_ts
export module butl.path_io;
#ifdef __cpp_lib_modules_ts
import std.core; //@@ MOD TMP (should not be needed).
import std.io;
#endif
import butl.path;
#else
#include <libbutl/path.mxx>
#endif
#include <libbutl/export.hxx>
LIBBUTL_MODEXPORT namespace butl
{
// This is the default path IO implementation. It is separate to allo 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 <typename C, typename K>
inline std::basic_ostream<C>&
operator<< (std::basic_ostream<C>& os, const basic_path<C, K>& p)
{
return os << p.string ();
}
template <typename C, typename P>
inline std::basic_ostream<C>&
operator<< (std::basic_ostream<C>& os, const basic_path_name<P>& pn)
{
return os << (pn.name ? *pn.name : pn.path->string ());
}
}
|