Subversion Repositories pentevo

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef _STRITER_H
  2. #define _STRITER_H
  3. /* striter.h */
  4. /*****************************************************************************/
  5. /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only                     */
  6. /*                                                                           */
  7. /* AS                                                                        */
  8. /*                                                                           */
  9. /* String Iteration                                                          */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12.  
  13. #include "datatypes.h"
  14.  
  15. typedef Boolean (*as_qualify_quote_fnc_t)(const char *p_start, const char *p_quote_pos);
  16.  
  17. typedef struct as_quoted_iterator_cb_data
  18. {
  19.   /* initialized by function */
  20.   const char *p_str;
  21.   Boolean in_single_quote, in_double_quote;
  22.   /* initialized by caller */
  23.   Boolean callback_before;
  24.   as_qualify_quote_fnc_t qualify_quote;
  25. } as_quoted_iterator_cb_data_t;
  26. /* callback return values:
  27.    <0 -> terminate
  28.    >=0 -> continue and skip next n characters */
  29. typedef int (*as_quoted_iterator_cb_t)(const char *p_pos, as_quoted_iterator_cb_data_t *p_cb_data);
  30.  
  31. extern void as_iterate_str(const char *p_str, as_quoted_iterator_cb_t callback, as_quoted_iterator_cb_data_t *p_cb_data);
  32. extern void as_iterate_str_quoted(const char *p_str, as_quoted_iterator_cb_t callback, as_quoted_iterator_cb_data_t *p_cb_data);
  33.  
  34. #endif /* _STRITER_H */
  35.