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
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
str
Definition str.h:31
striter
Definition striter.h:16
striter::start
unsigned start
Definition striter.h:20
striter::sep
char sep
Definition striter.h:26
striter::len
unsigned len
Definition striter.h:24
striter::startptr
const char * startptr
Definition striter.h:22
striter::str
const struct str * str
Definition striter.h:18