FileInfo.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. /*
  3. * FileInfo.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. #include <boost/utility/string_ref.hpp>
  12. namespace FileInfo
  13. {
  14. /**
  15. * Returns the name of the file.
  16. *
  17. * @return the name of the file. E.g. foo.txt
  18. */
  19. boost::string_ref DLL_LINKAGE GetFilename(boost::string_ref path);
  20. /**
  21. * Gets the file extension.
  22. *
  23. * @return the file extension. E.g. .ext
  24. */
  25. boost::string_ref DLL_LINKAGE GetExtension(boost::string_ref path);
  26. /**
  27. * Gets the file name exclusive the extension of the file.
  28. *
  29. * @return the file name exclusive the extension and the path of the file. E.g. foo
  30. */
  31. boost::string_ref DLL_LINKAGE GetStem(boost::string_ref path);
  32. /**
  33. * Gets the path to the file only.
  34. *
  35. * @return the path to the file only. E.g. ./dir/
  36. */
  37. boost::string_ref DLL_LINKAGE GetParentPath(boost::string_ref path);
  38. /**
  39. * Gets the file name + path exclusive the extension of the file.
  40. *
  41. * @return the file name exclusive the extension of the file. E.g. ./dir/foo
  42. */
  43. boost::string_ref DLL_LINKAGE GetPathStem(boost::string_ref path);
  44. } // namespace FileInfo