From 8e761289a2446367267c6c0d9a26e734f0f78306 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 Dec 2020 20:29:05 +0300 Subject: Get rid of legacy build systems and rename cutl/ to libcutl/ --- libcutl/fs/path.ixx | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 libcutl/fs/path.ixx (limited to 'libcutl/fs/path.ixx') diff --git a/libcutl/fs/path.ixx b/libcutl/fs/path.ixx new file mode 100644 index 0000000..461a871 --- /dev/null +++ b/libcutl/fs/path.ixx @@ -0,0 +1,70 @@ +// file : libcutl/fs/path.ixx +// license : MIT; see accompanying LICENSE file + +#ifdef _WIN32 +# include // std::tolower +# include // std::towlower +#endif + +namespace cutl +{ + namespace fs + { +#ifdef _WIN32 + template <> + inline char path_traits:: + tolower (char c) + { + return std::tolower (c); + } + + template <> + inline wchar_t path_traits:: + tolower (wchar_t c) + { + return std::towlower (c); + } +#endif + + template + inline bool basic_path:: + absolute () const + { +#ifdef _WIN32 + return path_.size () > 1 && path_[1] == ':'; +#else + return !path_.empty () && traits::is_separator (path_[0]); +#endif + } + + template + inline bool basic_path:: + root () const + { +#ifdef _WIN32 + return path_.size () == 2 && path_[1] == ':'; +#else + return path_.size () == 1 && traits::is_separator (path_[0]); +#endif + } + + template + inline basic_path& basic_path:: + complete () + { + if (relative ()) + *this = current () / *this; + + return *this; + } + +#ifndef _WIN32 + template + inline typename basic_path::string_type basic_path:: + posix_string () const + { + return string (); + } +#endif + } +} -- cgit v1.1