FileInfo.h 1.2 KB

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