StrIterRead
Description
Read the current character into *out and advance the cursor. Propagating alias for IterRead; see IterRead for the full contract.
Parameters
| Name | Direction | Description |
|---|---|---|
mi |
in | Pointer to the StrIter to read from. |
out |
out | Destination char *; receives the current character. |
Success
*out is set, the cursor advances by one in the iteration direction, returns true.
Failure
Iterator is exhausted; *out is not written, the cursor is unchanged, returns false.
Usage example (Cross-references)
Usage examples (Cross-references)
StrIter aug_it = StrIterFromZstr(augmentation + 1);
char a;
while (StrIterRead(&aug_it, &a)) {
switch (a) {
case 'L' : {- In
StrIter.c:15:
}
char c = 0;
if (!StrIterRead(&si, &c) || c != 'a') {
return false;
}- In
StrIter.c:18:
return false;
}
if (!StrIterRead(&si, &c) || c != 'b') {
return false;
}- In
StrIter.c:21:
return false;
}
if (!StrIterRead(&si, &c) || c != 'c') {
return false;
}- In
StrIter.c:25:
}
// The NUL terminator is not part of the range: a fourth read fails.
return !StrIterRead(&si, &c);
}- In
StrIter.c:36:
}
char c = 0;
if (!StrIterRead(&si, &c) || c != 'a') {
return false;
}- In
StrIter.c:39:
return false;
}
if (!StrIterRead(&si, &c) || c != 'b') {
return false;
}- In
StrIter.c:43:
}
// 'c'/'d' are past the capped length even though they are in memory.
return !StrIterRead(&si, &c);
}
Last updated on