Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

strings.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*!
  2. * \file include/utils/strings.h
  3. * \brief String handling utilities
  4. *
  5. * \author xythobuz
  6. * \author Mongoose
  7. */
  8. #ifndef _UTILS_STRINGS_H_
  9. #define _UTILS_STRINGS_H_
  10. #include <cstdarg>
  11. /*!
  12. * \brief Check if a string ends with another string.
  13. * \param str string to check
  14. * \param suffix suffix for which to check
  15. * \returns true if str ends with suffix
  16. */
  17. bool stringEndsWith(const char *str, const char *suffix);
  18. /*!
  19. * \brief Generates a buffered string for the printf call
  20. * \param string format string like for printf
  21. * \param args arguments matching format string
  22. * \returns string in a buffer
  23. */
  24. char *bufferString(const char *string, va_list args) __attribute__((format(printf, 1, 0)));
  25. /*!
  26. * \brief Generates a buffered string for the printf call
  27. * \param string format string like for printf
  28. * \returns string in a buffer
  29. */
  30. char *bufferString(const char *string, ...) __attribute__((format(printf, 1, 2)));
  31. /*!
  32. * \brief Expansion of unix home enviroment char.
  33. * Also makes sure string ends in "end" char.
  34. * \param path path string
  35. * \param end end character. 0 appends no additional char
  36. * \returns allocated string of path with expansions
  37. */
  38. char *fullPath(const char *path, char end);
  39. #endif