Open Source Tomb Raider Engine
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

strings.h 1.4KB

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