diff options
Diffstat (limited to 'boost/filesystem/convenience.hpp')
-rw-r--r-- | boost/filesystem/convenience.hpp | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/boost/filesystem/convenience.hpp b/boost/filesystem/convenience.hpp index a132e17f0f..f0bd986909 100644 --- a/boost/filesystem/convenience.hpp +++ b/boost/filesystem/convenience.hpp @@ -1,35 +1,58 @@ -// boost/filesystem/convenience.hpp --------------------------------------------------// +// boost/filesystem/convenience.hpp ----------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes, 2002-2005 +// Copyright Vladimir Prus, 2002 +// Use, modification, and distribution is subject to 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) -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt +// See library home page at http://www.boost.org/libs/filesystem -// Library home page: http://www.boost.org/libs/filesystem +//----------------------------------------------------------------------------// -//--------------------------------------------------------------------------------------// +#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP +#define BOOST_FILESYSTEM3_CONVENIENCE_HPP -#ifndef BOOST_FILESYSTEM_CONVENIENCEX_HPP -#define BOOST_FILESYSTEM_CONVENIENCEX_HPP +#include <boost/config.hpp> -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif +#include <boost/filesystem/operations.hpp> +#include <boost/system/error_code.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +namespace boost +{ + namespace filesystem + { -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/convenience.hpp> +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# else -# include <boost/filesystem/v3/convenience.hpp> + inline std::string extension(const path & p) + { + return p.extension().string(); + } + + inline std::string basename(const path & p) + { + return p.stem().string(); + } + + inline path change_extension( const path & p, const path & new_extension ) + { + path new_p( p ); + new_p.replace_extension( new_extension ); + return new_p; + } # endif -#endif // BOOST_FILESYSTEM_CONVENIENCEX_HPP + + } // namespace filesystem +} // namespace boost + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP |