SDL_visualtest_parsehelper.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* See COPYING.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 */