annotate DEPENDENCIES/generic/include/boost/wave/util/filesystem_compatibility.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Boost.Wave: A Standard compliant C++ preprocessor library
Chris@16 3
Chris@16 4 http://www.boost.org/
Chris@16 5
Chris@16 6 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
Chris@16 7 Software License, Version 1.0. (See accompanying file
Chris@16 8 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 =============================================================================*/
Chris@16 10
Chris@16 11 #if !defined(BOOST_WAVE_FILESYSTEM_COMPATIBILITY_MAR_09_2009_0142PM)
Chris@16 12 #define BOOST_WAVE_FILESYSTEM_COMPATIBILITY_MAR_09_2009_0142PM
Chris@16 13
Chris@16 14 #include <string>
Chris@16 15
Chris@16 16 #include <boost/version.hpp>
Chris@16 17 #include <boost/filesystem/path.hpp>
Chris@16 18 #include <boost/filesystem/operations.hpp>
Chris@16 19
Chris@16 20 namespace boost { namespace wave { namespace util
Chris@16 21 {
Chris@16 22 ///////////////////////////////////////////////////////////////////////////////
Chris@16 23 // filesystem wrappers allowing to handle different Boost versions
Chris@16 24 #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
Chris@16 25 // interface wrappers for older Boost versions
Chris@16 26 inline boost::filesystem::path initial_path()
Chris@16 27 {
Chris@16 28 return boost::filesystem::initial_path();
Chris@16 29 }
Chris@16 30
Chris@16 31 inline boost::filesystem::path current_path()
Chris@16 32 {
Chris@16 33 return boost::filesystem::current_path();
Chris@16 34 }
Chris@16 35
Chris@16 36 template <typename String>
Chris@16 37 inline boost::filesystem::path create_path(String const& p)
Chris@16 38 {
Chris@16 39 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 40 return boost::filesystem::path(p);
Chris@16 41 #else
Chris@16 42 return boost::filesystem::path(p, boost::filesystem::native);
Chris@16 43 #endif
Chris@16 44 }
Chris@16 45
Chris@16 46 inline std::string leaf(boost::filesystem::path const& p)
Chris@16 47 {
Chris@16 48 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 49 return p.leaf().string();
Chris@16 50 #else
Chris@16 51 return p.leaf();
Chris@16 52 #endif
Chris@16 53 }
Chris@16 54
Chris@16 55 inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
Chris@16 56 {
Chris@16 57 return p.branch_path();
Chris@16 58 }
Chris@16 59
Chris@16 60 inline boost::filesystem::path normalize(boost::filesystem::path& p)
Chris@16 61 {
Chris@16 62 return p.normalize();
Chris@16 63 }
Chris@16 64
Chris@16 65 inline std::string native_file_string(boost::filesystem::path const& p)
Chris@16 66 {
Chris@16 67 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 68 return p.string();
Chris@16 69 #else
Chris@16 70 return p.native_file_string();
Chris@16 71 #endif
Chris@16 72 }
Chris@16 73
Chris@16 74 inline boost::filesystem::path complete_path(
Chris@16 75 boost::filesystem::path const& p)
Chris@16 76 {
Chris@16 77 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 78 #if BOOST_VERSION >= 105000
Chris@16 79 return boost::filesystem::complete(p, initial_path());
Chris@16 80 #else
Chris@16 81 return boost::filesystem3::complete(p, initial_path());
Chris@16 82 #endif
Chris@16 83 #else
Chris@16 84 return boost::filesystem::complete(p, initial_path());
Chris@16 85 #endif
Chris@16 86 }
Chris@16 87
Chris@16 88 inline boost::filesystem::path complete_path(
Chris@16 89 boost::filesystem::path const& p, boost::filesystem::path const& base)
Chris@16 90 {
Chris@16 91 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 92 #if BOOST_VERSION >= 105000
Chris@16 93 return boost::filesystem::complete(p, base);
Chris@16 94 #else
Chris@16 95 return boost::filesystem3::complete(p, base);
Chris@16 96 #endif
Chris@16 97 #else
Chris@16 98 return boost::filesystem::complete(p, base);
Chris@16 99 #endif
Chris@16 100 }
Chris@16 101
Chris@16 102 #else
Chris@16 103
Chris@16 104 // interface wrappers if deprecated functions do not exist
Chris@16 105 inline boost::filesystem::path initial_path()
Chris@16 106 {
Chris@16 107 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 108 #if BOOST_VERSION >= 105000
Chris@16 109 return boost::filesystem::detail::initial_path();
Chris@16 110 #else
Chris@16 111 return boost::filesystem3::detail::initial_path();
Chris@16 112 #endif
Chris@16 113 #else
Chris@16 114 return boost::filesystem::initial_path<boost::filesystem::path>();
Chris@16 115 #endif
Chris@16 116 }
Chris@16 117
Chris@16 118 inline boost::filesystem::path current_path()
Chris@16 119 {
Chris@16 120 #if BOOST_FILESYSTEM_VERSION >= 3
Chris@16 121 #if BOOST_VERSION >= 105000
Chris@16 122 return boost::filesystem::current_path();
Chris@16 123 #else
Chris@16 124 return boost::filesystem3::current_path();
Chris@16 125 #endif
Chris@16 126 #else
Chris@16 127 return boost::filesystem::current_path<boost::filesystem::path>();
Chris@16 128 #endif
Chris@16 129 }
Chris@16 130
Chris@16 131 template <typename String>
Chris@16 132 inline boost::filesystem::path create_path(String const& p)
Chris@16 133 {
Chris@16 134 return boost::filesystem::path(p);
Chris@16 135 }
Chris@16 136
Chris@16 137 inline std::string leaf(boost::filesystem::path const& p)
Chris@16 138 {
Chris@16 139 #if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
Chris@16 140 return p.filename().string();
Chris@16 141 #else
Chris@16 142 return p.filename();
Chris@16 143 #endif
Chris@16 144 }
Chris@16 145
Chris@16 146 inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
Chris@16 147 {
Chris@16 148 return p.parent_path();
Chris@16 149 }
Chris@16 150
Chris@16 151 inline boost::filesystem::path normalize(boost::filesystem::path& p)
Chris@16 152 {
Chris@16 153 return p; // function doesn't exist anymore
Chris@16 154 }
Chris@16 155
Chris@16 156 inline std::string native_file_string(boost::filesystem::path const& p)
Chris@16 157 {
Chris@16 158 #if BOOST_VERSION >= 104600
Chris@16 159 return p.string();
Chris@16 160 #else
Chris@16 161 return p.file_string();
Chris@16 162 #endif
Chris@16 163 }
Chris@16 164
Chris@16 165 inline boost::filesystem::path complete_path(
Chris@16 166 boost::filesystem::path const& p)
Chris@16 167 {
Chris@16 168 #if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
Chris@16 169 return boost::filesystem::absolute(p, initial_path());
Chris@16 170 #else
Chris@16 171 return boost::filesystem::complete(p, initial_path());
Chris@16 172 #endif
Chris@16 173 }
Chris@16 174
Chris@16 175 inline boost::filesystem::path complete_path(
Chris@16 176 boost::filesystem::path const& p, boost::filesystem::path const& base)
Chris@16 177 {
Chris@16 178 #if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
Chris@16 179 return boost::filesystem::absolute(p, base);
Chris@16 180 #else
Chris@16 181 return boost::filesystem::complete(p, base);
Chris@16 182 #endif
Chris@16 183 }
Chris@16 184 #endif
Chris@16 185
Chris@16 186 // starting withBoost V1.50 create_directories throws if given an empty path
Chris@16 187 inline bool create_directories(boost::filesystem::path const& p)
Chris@16 188 {
Chris@16 189 if (p.string().empty())
Chris@16 190 return true;
Chris@16 191 return boost::filesystem::create_directories(p);
Chris@16 192 }
Chris@16 193 }}}
Chris@16 194
Chris@16 195 #endif