striter.h
#ifndef STR_ITER__H__
#define STR_ITER__H__
struct str;
typedef struct
{
const struct str* str;
unsigned start;
const char* startptr;
unsigned len;
char sep;
} striter;
void striter_start(striter* iter, const struct str* s, char sep);
int striter_valid(striter*);
int striter_advance(striter*);
#define str_copyiter(STR,ITER) str_copyb(STR,(ITER)->startptr,(ITER)->len)
#define str_catiter(STR,ITER) str_catb(STR,(ITER)->startptr,(ITER)->len)
#define obuf_putiter(OBUF,ITER) obuf_write(OBUF,(ITER)->startptr,(ITER)->len)
#define striter_loop(ITER,STR,SEP) for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))
#endif
striter::start
unsigned start
Definition: striter.h:20
str::s
char * s
Definition: str.h:36
striter::len
unsigned len
Definition: striter.h:24
striter_valid
int striter_valid(striter *)
Definition: iter_valid.c:5
striter
Definition: striter.h:15
striter::str
const struct str * str
Definition: striter.h:18
striter::sep
char sep
Definition: striter.h:26
str
Definition: str.h:30
striter::startptr
const char * startptr
Definition: striter.h:22
striter_advance
int striter_advance(striter *)
Definition: iter_advance.c:5
striter_start
void striter_start(striter *iter, const struct str *s, char sep)
Definition: iter_start.c:5