convenience.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // boost/filesystem/convenience.hpp ----------------------------------------//
  2. // Copyright Beman Dawes, 2002-2005
  3. // Copyright Vladimir Prus, 2002
  4. // Use, modification, and distribution is subject to the Boost Software
  5. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. // See library home page at http://www.boost.org/libs/filesystem
  8. //----------------------------------------------------------------------------//
  9. #ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP
  10. #define BOOST_FILESYSTEM3_CONVENIENCE_HPP
  11. #include <boost/config.hpp>
  12. # if defined( BOOST_NO_STD_WSTRING )
  13. # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
  14. # endif
  15. #include <boost/filesystem/operations.hpp>
  16. #include <boost/system/error_code.hpp>
  17. #include <boost/config/abi_prefix.hpp> // must be the last #include
  18. namespace boost
  19. {
  20. namespace filesystem
  21. {
  22. # ifndef BOOST_FILESYSTEM_NO_DEPRECATED
  23. inline std::string extension(const path & p)
  24. {
  25. return p.extension().string();
  26. }
  27. inline std::string basename(const path & p)
  28. {
  29. return p.stem().string();
  30. }
  31. inline path change_extension( const path & p, const path & new_extension )
  32. {
  33. path new_p( p );
  34. new_p.replace_extension( new_extension );
  35. return new_p;
  36. }
  37. # endif
  38. } // namespace filesystem
  39. } // namespace boost
  40. #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
  41. #endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP