striter: Iterator over substrings of a str.

## Data Structures

struct | striter

## Macros

#define | str_copyiter(STR, ITER)
#define | str_catiter(STR, ITER)
#define | obuf_putiter(OBUF, ITER)
#define | striter_loop(ITER, STR, SEP)

## Functions

void | striter_start (striter *iter, const struct str *s, char sep)
int | striter_valid (striter *)
int | striter_advance (striter *)

## Detailed Description

Calling Convention
  All non-void functions return `0` (false) if the function failed or the iterator is no longer valid, and non-zero (true) otherwise.

## Macro Definition Documentation

## obuf_putiter

#define obuf_putiter | ( |  | OBUF,
|  |  | ITER )

Value:
obuf_write(OBUF,(ITER)->startptr,(ITER)->len)
obuf_write
int obuf_write(obuf *out, const char *data, unsigned datalen)
Definition obuf_write.c:30

Output the current striter substring to an obuf.

## str_catiter

#define str_catiter | ( |  | STR,
|  |  | ITER )

Value:
str_catb(STR,(ITER)->startptr,(ITER)->len)
str_catb
int str_catb(str *s, const char *in, unsigned len)
Definition cat.c:43

Append the current striter substring to a str.

## str_copyiter

#define str_copyiter | ( |  | STR,
|  |  | ITER )

Value:
str_copyb(STR,(ITER)->startptr,(ITER)->len)
str_copyb
int str_copyb(str *s, const char *in, unsigned len)
Definition copy.c:34

Assign the current striter substring to a str.

## striter_loop

#define striter_loop | ( |  | ITER,
|  |  | STR,
|  |  | SEP )

Value:
for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))
striter_start
void striter_start(striter *iter, const struct str *s, char sep)
Definition iter_start.c:5
striter_valid
int striter_valid(striter *)
Definition iter_valid.c:5
striter_advance
int striter_advance(striter *)
Definition iter_advance.c:5

Loop macro; use in place of `for(...)`

Referenced by envstr_find().

## Function Documentation

## striter_advance()

int striter_advance | ( | striter * | iter | ) |

Advance a striter to the next substring.

References str::len, striter::len, str::s, striter::sep, striter::start, striter::startptr, striter::str, and str_findnext().

Referenced by envstr_make_array().

## striter_start()

void striter_start | ( | striter * | iter,
|  | const struct str * | s,
|  | char | sep )

Start (initialize) a striter.

References striter::len, striter::sep, striter::start, striter::startptr, and striter::str.

Referenced by envstr_make_array().

## striter_valid()

int striter_valid | ( | striter * | iter | ) |

Determine if a striter is valid (after initialization or advancing).

References str::len, striter::start, and striter::str.

Referenced by envstr_make_array().