striter: Iterator over substrings of a str.


Data Structures

struct  striter

Defines

#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))

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.

Define Documentation

#define obuf_putiter ( OBUF,
ITER   )     obuf_write(OBUF,(ITER)->startptr,(ITER)->len)

Output the current striter substring to an obuf.

#define str_catiter ( STR,
ITER   )     str_catb(STR,(ITER)->startptr,(ITER)->len)

Append the current striter substring to a str.

#define str_copyiter ( STR,
ITER   )     str_copyb(STR,(ITER)->startptr,(ITER)->len)

Assign the current striter substring to a str.

#define striter_loop ( ITER,
STR,
SEP   )     for(striter_start(ITER,STR,SEP);striter_valid(ITER);striter_advance(ITER))

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


Function Documentation

int striter_advance ( striter iter  ) 

Advance a striter to the next substring.

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

Start (initialize) a striter.

int striter_valid ( striter iter  ) 

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


Generated on Thu Feb 19 11:11:50 2009 for bglibs by  doxygen 1.5.4