12 #ifndef PT_PREFIXITER_H
13 #define PT_PREFIXITER_H
27 char END()
const {
return high+1; }
28 size_t base_span()
const {
return high-low+1; }
34 if (part[plen-1] == END()) {
38 for (
int l = plen; l<len; ++l) {
41 if (low ==
PT_QU)
break;
57 for (
int l = 0; l<len; ++l) part[l] = low;
63 plen = (low ==
PT_QU && len) ? 1 : len;
81 memcpy(part, other.part, plen);
88 const char *
prefix()
const {
return part; }
89 size_t length()
const {
return plen; }
94 char *
result = ARB_alloc<char>(plen+1);
95 memcpy(result, part, plen);
100 bool done()
const {
return part[0] == END(); }
110 size_t bases = base_span();
111 for (
int l = 0; l<len; ++l) {
114 count = 1+(bases-1)*count;
124 for (
int p = 0; p<plen; ++p) {
125 if (probe[p] != part[p]) {
134 #error PT_prefixIter.h included twice
135 #endif // PT_PREFIXITER_H
const PrefixIterator & operator++()
size_t max_length() const
TYPE * ARB_alloc(size_t nelem)
PrefixIterator(PT_base low_, PT_base high_, int len_)
DECLARE_ASSIGNMENT_OPERATOR(PrefixIterator)
PrefixIterator(const PrefixIterator &other)
const char * prefix() const
bool matches_at(const char *probe) const