Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*!
  2. * \file include/utils/strings.h
  3. * \brief String handling utilities
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _UTILS_STRINGS_H_
  8. #define _UTILS_STRINGS_H_
  9. /*!
  10. * \brief Generates a buffered string for the printf call
  11. * \param string Format string like for printf
  12. * \returns string in a buffer
  13. */
  14. char *bufferString(const char *string, ...) __attribute__((format(printf, 1, 2)));
  15. /*!
  16. * \brief Expansion of unix home enviroment char.
  17. * Also makes sure string ends in "end" char.
  18. * \param path path string
  19. * \param end end character. 0 appends no additional char
  20. * \returns allocated string of path with expansions
  21. */
  22. char *fullPath(const char *path, char end);
  23. /*!
  24. * \brief Only returns last part of a path string.
  25. * \param filename Path to a file
  26. * \returns Name of the file in filename, without path in front
  27. */
  28. char *getFileFromFullPath(char *filename);
  29. /*!
  30. * \brief Check if a string ends with another string.
  31. * \param str string to check
  32. * \param suffix suffix for which to check
  33. * \returns true if str ends with suffix
  34. */
  35. bool stringEndsWith(const char *str, const char *suffix);
  36. /*!
  37. * \brief Checks if Command matches Symbol.
  38. * Returns the rest of the argument list back in command buffer, if any
  39. * \param symbol command string
  40. * \param command with arguments
  41. * \returns true if command matches symbol
  42. */
  43. bool rc_command(const char *symbol, char *command);
  44. /*!
  45. * \brief Interpret a string as a bool
  46. * \param buffer "true" or "false"
  47. * \param val is set to boolean interpretation of buffer
  48. * \returns -1 for null string, -2 if string is not "true" or "false"
  49. */
  50. int rc_get_bool(char *buffer, bool *val);
  51. #endif