SDL_visualtest_parsehelper.h (1289B)
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 8#ifndef _SDL_visualtest_parsehelper_h 9#define _SDL_visualtest_parsehelper_h 10 11/* Set up for C function definitions, even when using C++ */ 12#ifdef __cplusplus 13extern "C" { 14#endif 15 16/** 17 * Takes an string of command line arguments and breaks them up into an array 18 * based on whitespace. 19 * 20 * \param args The string of arguments. 21 * 22 * \return NULL on failure, an array of strings on success. The last element 23 * of the array is NULL. The first element of the array is NULL and should 24 * be set to the path of the executable by the caller. 25 */ 26char** SDLVisualTest_ParseArgsToArgv(char* args); 27 28/** 29 * Takes a string and breaks it into tokens by splitting on whitespace. 30 * 31 * \param str The string to be split. 32 * \param max_token_len Length of each element in the array to be returned. 33 * 34 * \return NULL on failure; an array of strings with the tokens on success. The 35 * last element of the array is NULL. 36 */ 37char** SDLVisualTest_Tokenize(char* str, int max_token_len); 38 39/* Ends C function definitions when using C++ */ 40#ifdef __cplusplus 41} 42#endif 43 44#endif /* _SDL_visualtest_parsehelper_h */