summaryrefslogtreecommitdiff
path: root/libcutl/cutl/fs/path.ixx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:25:44 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-23 15:25:44 +0200
commit8286ac511144e4f17d34eac9affb97e50646344a (patch)
treef1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /libcutl/cutl/fs/path.ixx
parenta15cf65c44d5c224169c32ef5495b68c758134b7 (diff)
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'libcutl/cutl/fs/path.ixx')
-rw-r--r--libcutl/cutl/fs/path.ixx71
1 files changed, 71 insertions, 0 deletions
diff --git a/libcutl/cutl/fs/path.ixx b/libcutl/cutl/fs/path.ixx
new file mode 100644
index 0000000..80d3bb3
--- /dev/null
+++ b/libcutl/cutl/fs/path.ixx
@@ -0,0 +1,71 @@
+// file : cutl/fs/path.ixx
+// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifdef _WIN32
+# include <cctype> // std::tolower
+# include <cwctype> // std::towlower
+#endif
+
+namespace cutl
+{
+ namespace fs
+ {
+ template <typename C>
+ inline bool basic_path<C>::
+ absolute () const
+ {
+#ifdef _WIN32
+ return path_.size () > 1 && path_[1] == ':';
+#else
+ return !path_.empty () && traits::is_separator (path_[0]);
+#endif
+ }
+
+ template <typename C>
+ inline bool basic_path<C>::
+ root () const
+ {
+#ifdef _WIN32
+ return path_.size () == 2 && path_[1] == ':';
+#else
+ return path_.size () == 1 && traits::is_separator (path_[0]);
+#endif
+ }
+
+ template <typename C>
+ inline basic_path<C>& basic_path<C>::
+ complete ()
+ {
+ if (relative ())
+ *this = current () / *this;
+
+ return *this;
+ }
+
+#ifndef _WIN32
+ template <typename C>
+ inline typename basic_path<C>::string_type basic_path<C>::
+ posix_string () const
+ {
+ return string ();
+ }
+#endif
+
+#ifdef _WIN32
+ template <>
+ inline char basic_path<char>::
+ tolower (char c)
+ {
+ return std::tolower (c);
+ }
+
+ template <>
+ inline wchar_t basic_path<wchar_t>::
+ tolower (wchar_t c)
+ {
+ return std::towlower (c);
+ }
+#endif
+ }
+}