Open Source Tomb Raider Engine
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

strings.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #include <vector>
  12. char *stringRemoveQuotes(const char *s);
  13. char *stringReplace(const char *s, const char *search, const char *replace);
  14. void printStringVector(std::vector<char *> *args);
  15. int readBool(const char *value, bool *var);
  16. /*!
  17. * \brief Check if a string ends with another string.
  18. * \param str string to check
  19. * \param suffix suffix for which to check
  20. * \returns true if str ends with suffix
  21. */
  22. bool stringEndsWith(const char *str, const char *suffix);
  23. /*!
  24. * \brief Generates a buffered string for the printf call
  25. * \param string format string like for printf
  26. * \param args arguments matching format string
  27. * \returns string in a buffer
  28. */
  29. char *bufferString(const char *string, va_list args) __attribute__((format(printf, 1, 0)));
  30. /*!
  31. * \brief Generates a buffered string for the printf call
  32. * \param string format string like for printf
  33. * \returns string in a buffer
  34. */
  35. char *bufferString(const char *string, ...) __attribute__((format(printf, 1, 2)));
  36. /*!
  37. * \brief Expansion of unix home enviroment char.
  38. * Also makes sure string ends in "end" char.
  39. * \param path path string
  40. * \param end end character. 0 appends no additional char
  41. * \returns allocated string of path with expansions
  42. */
  43. char *fullPath(const char *path, char end);
  44. #endif