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.4KB

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