visualtest/include/SDL_visualtest_parsehelper.h
changeset 7924 fcb86d323770
child 11382 2c50e79b19e0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/visualtest/include/SDL_visualtest_parsehelper.h	Sun Nov 10 00:32:23 2013 -0500
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* See COPYING.txt for the full license governing this code. */
     1.5 +/**
     1.6 + * \file SDL_visualtest_parsehelper.h
     1.7 + *
     1.8 + * Header with some helper functions for parsing strings.
     1.9 + */
    1.10 +
    1.11 +#ifndef _SDL_visualtest_parsehelper_h
    1.12 +#define _SDL_visualtest_parsehelper_h
    1.13 +
    1.14 +/* Set up for C function definitions, even when using C++ */
    1.15 +#ifdef __cplusplus
    1.16 +extern "C" {
    1.17 +#endif
    1.18 +
    1.19 +/**
    1.20 + * Takes an string of command line arguments and breaks them up into an array
    1.21 + * based on whitespace.
    1.22 + *
    1.23 + * \param args The string of arguments.
    1.24 + *
    1.25 + * \return NULL on failure, an array of strings on success. The last element
    1.26 + *         of the array is NULL. The first element of the array is NULL and should
    1.27 + *         be set to the path of the executable by the caller.
    1.28 + */
    1.29 +char** SDLVisualTest_ParseArgsToArgv(char* args);
    1.30 +
    1.31 +/**
    1.32 + * Takes a string and breaks it into tokens by splitting on whitespace.
    1.33 + *
    1.34 + * \param str The string to be split.
    1.35 + * \param max_token_len Length of each element in the array to be returned.
    1.36 + *
    1.37 + * \return NULL on failure; an array of strings with the tokens on success. The
    1.38 + *         last element of the array is NULL.
    1.39 + */
    1.40 +char** SDLVisualTest_Tokenize(char* str, int max_token_len);
    1.41 +
    1.42 +/* Ends C function definitions when using C++ */
    1.43 +#ifdef __cplusplus
    1.44 +}
    1.45 +#endif
    1.46 +
    1.47 +#endif /* _SDL_visualtest_parsehelper_h */