summaryrefslogtreecommitdiff
path: root/boost/wave/util/filesystem_compatibility.hpp
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 12:57:26 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 12:57:26 -0700
commit1a78a62555be32868418fe52f8e330c9d0f95d5a (patch)
treed3765a80e7d3b9640ec2e930743630cd6b9fce2b /boost/wave/util/filesystem_compatibility.hpp
downloadboost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.gz
boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.bz2
boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.zip
Imported Upstream version 1.49.0upstream/1.49.0
Diffstat (limited to 'boost/wave/util/filesystem_compatibility.hpp')
-rw-r--r--boost/wave/util/filesystem_compatibility.hpp172
1 files changed, 172 insertions, 0 deletions
diff --git a/boost/wave/util/filesystem_compatibility.hpp b/boost/wave/util/filesystem_compatibility.hpp
new file mode 100644
index 0000000000..5bd924af72
--- /dev/null
+++ b/boost/wave/util/filesystem_compatibility.hpp
@@ -0,0 +1,172 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+
+ http://www.boost.org/
+
+ Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost
+ Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_WAVE_FILESYSTEM_COMPATIBILITY_MAR_09_2009_0142PM)
+#define BOOST_WAVE_FILESYSTEM_COMPATIBILITY_MAR_09_2009_0142PM
+
+#include <string>
+
+#include <boost/version.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/operations.hpp>
+
+namespace boost { namespace wave { namespace util
+{
+///////////////////////////////////////////////////////////////////////////////
+// filesystem wrappers allowing to handle different Boost versions
+#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
+// interface wrappers for older Boost versions
+ inline boost::filesystem::path initial_path()
+ {
+ return boost::filesystem::initial_path();
+ }
+
+ inline boost::filesystem::path current_path()
+ {
+ return boost::filesystem::current_path();
+ }
+
+ template <typename String>
+ inline boost::filesystem::path create_path(String const& p)
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem::path(p);
+#else
+ return boost::filesystem::path(p, boost::filesystem::native);
+#endif
+ }
+
+ inline std::string leaf(boost::filesystem::path const& p)
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return p.leaf().string();
+#else
+ return p.leaf();
+#endif
+ }
+
+ inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
+ {
+ return p.branch_path();
+ }
+
+ inline boost::filesystem::path normalize(boost::filesystem::path& p)
+ {
+ return p.normalize();
+ }
+
+ inline std::string native_file_string(boost::filesystem::path const& p)
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return p.string();
+#else
+ return p.native_file_string();
+#endif
+ }
+
+ inline boost::filesystem::path complete_path(
+ boost::filesystem::path const& p)
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem3::complete(p, initial_path());
+#else
+ return boost::filesystem::complete(p, initial_path());
+#endif
+ }
+
+ inline boost::filesystem::path complete_path(
+ boost::filesystem::path const& p, boost::filesystem::path const& base)
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem3::complete(p, base);
+#else
+ return boost::filesystem::complete(p, base);
+#endif
+ }
+
+#else
+
+// interface wrappers if deprecated functions do not exist
+ inline boost::filesystem::path initial_path()
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem3::detail::initial_path();
+#else
+ return boost::filesystem::initial_path<boost::filesystem::path>();
+#endif
+ }
+
+ inline boost::filesystem::path current_path()
+ {
+#if BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem3::current_path();
+#else
+ return boost::filesystem::current_path<boost::filesystem::path>();
+#endif
+ }
+
+ template <typename String>
+ inline boost::filesystem::path create_path(String const& p)
+ {
+ return boost::filesystem::path(p);
+ }
+
+ inline std::string leaf(boost::filesystem::path const& p)
+ {
+#if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
+ return p.filename().string();
+#else
+ return p.filename();
+#endif
+ }
+
+ inline boost::filesystem::path branch_path(boost::filesystem::path const& p)
+ {
+ return p.parent_path();
+ }
+
+ inline boost::filesystem::path normalize(boost::filesystem::path& p)
+ {
+ return p; // function doesn't exist anymore
+ }
+
+ inline std::string native_file_string(boost::filesystem::path const& p)
+ {
+#if BOOST_VERSION >= 104600
+ return p.string();
+#else
+ return p.file_string();
+#endif
+ }
+
+ inline boost::filesystem::path complete_path(
+ boost::filesystem::path const& p)
+ {
+#if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem::absolute(p, initial_path());
+#else
+ return boost::filesystem::complete(p, initial_path());
+#endif
+ }
+
+ inline boost::filesystem::path complete_path(
+ boost::filesystem::path const& p, boost::filesystem::path const& base)
+ {
+#if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3
+ return boost::filesystem::absolute(p, base);
+#else
+ return boost::filesystem::complete(p, base);
+#endif
+ }
+#endif
+
+}}}
+
+#endif