Debian Codegraph @

cutl/fs/path.ixx

raw
1 // file : cutl/fs/path.ixx
2 // copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
3 // license : MIT; see accompanying LICENSE file
4
5 #ifdef _WIN32
6 # include <cctype> // std::tolower
7 # include <cwctype> // std::towlower
8 #endif
9
10 namespace cutl
11 {
12 namespace fs
13 {
14 #ifdef _WIN32
15 template <>
16 inline char path_traits<char>::
17 tolower (char c)
18 {
19 return std::tolower (c);
20 }
21
22 template <>
23 inline wchar_t path_traits<wchar_t>::
24 tolower (wchar_t c)
25 {
26 return std::towlower (c);
27 }
28 #endif
29
30 template <typename C>
31 inline bool basic_path<C>::
32 absolute () const
33 {
34 #ifdef _WIN32
35 return path_.size () > 1 && path_[1] == ':';
36 #else
37 return !path_.empty () && traits::is_separator (path_[0]);
38 #endif
39 }
40
41 template <typename C>
42 inline bool basic_path<C>::
43 root () const
44 {
45 #ifdef _WIN32
46 return path_.size () == 2 && path_[1] == ':';
47 #else
48 return path_.size () == 1 && traits::is_separator (path_[0]);
49 #endif
50 }
51
52 template <typename C>
53 inline basic_path<C>& basic_path<C>::
54 complete ()
55 {
56 if (relative ())
57 *this = current () / *this;
58
59 return *this;
60 }
61
62 #ifndef _WIN32
63 template <typename C>
64 inline typename basic_path<C>::string_type basic_path<C>::
65 posix_string () const
66 {
67 return string ();
68 }
69 #endif
70 }
71 }