SDL_visualtest_parsehelper.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* See LICENSE.txt for the full license governing this code. */
  2. /**
  3. * \file SDL_visualtest_parsehelper.h
  4. *
  5. * Header with some helper functions for parsing strings.
  6. */
  7. #ifndef SDL_visualtest_parsehelper_h_
  8. #define SDL_visualtest_parsehelper_h_
  9. /* Set up for C function definitions, even when using C++ */
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * Takes an string of command line arguments and breaks them up into an array
  15. * based on whitespace.
  16. *
  17. * \param args The string of arguments.
  18. *
  19. * \return NULL on failure, an array of strings on success. The last element
  20. * of the array is NULL. The first element of the array is NULL and should
  21. * be set to the path of the executable by the caller.
  22. */
  23. char** SDLVisualTest_ParseArgsToArgv(char* args);
  24. /**
  25. * Takes a string and breaks it into tokens by splitting on whitespace.
  26. *
  27. * \param str The string to be split.
  28. * \param max_token_len Length of each element in the array to be returned.
  29. *
  30. * \return NULL on failure; an array of strings with the tokens on success. The
  31. * last element of the array is NULL.
  32. */
  33. char** SDLVisualTest_Tokenize(char* str, int max_token_len);
  34. /* Ends C function definitions when using C++ */
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif /* SDL_visualtest_parsehelper_h_ */
  39. /* vi: set ts=4 sw=4 expandtab: */