convenience.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_FILESYSTEM_CONVENIENCE_HPP
  10. #define BOOST_FILESYSTEM_CONVENIENCE_HPP
  11. #include <boost/filesystem/config.hpp>
  12. #include <boost/filesystem/operations.hpp>
  13. #include <boost/system/error_code.hpp>
  14. #include <boost/filesystem/detail/header.hpp> // must be the last #include
  15. namespace boost {
  16. namespace filesystem {
  17. #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
  18. BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::extension() instead")
  19. inline std::string extension(const path& p)
  20. {
  21. return p.extension().string();
  22. }
  23. BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::stem() instead")
  24. inline std::string basename(const path& p)
  25. {
  26. return p.stem().string();
  27. }
  28. BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::replace_extension() instead")
  29. inline path change_extension(const path& p, const path& new_extension)
  30. {
  31. path new_p(p);
  32. new_p.replace_extension(new_extension);
  33. return new_p;
  34. }
  35. #endif
  36. } // namespace filesystem
  37. } // namespace boost
  38. #include <boost/filesystem/detail/footer.hpp>
  39. #endif // BOOST_FILESYSTEM_CONVENIENCE_HPP