43 #ifndef COMMONCPP_TOKENIZER_H_
44 #define COMMONCPP_TOKENIZER_H_
46 #ifndef COMMONCPP_CONFIG_H_
47 #include <commoncpp/config.h>
50 #ifndef COMMONCPP_THREAD_H_
54 #ifndef COMMMONCPP_EXCEPTION_H_
139 : myTok(&tok),tokEnd(0),endp(end),token(0) {}
142 : myTok(&tok),tokEnd(0),endp(myTok->str-1),token(0) {
151 {
if (token) *token=
'\0';
delete [] token; }
158 myTok(i.myTok),start(i.start),tokEnd(i.tokEnd),
159 endp(i.endp),token(0) {}
167 start = i.start; endp = i.endp; tokEnd = i.tokEnd;
187 const
char* operator*() THROWS (NoSuchElementException);
195 inline
char nextDelimiter()
const
196 {
return (tokEnd) ? *tokEnd :
'\0';}
203 inline bool operator == (
const iterator &other)
const
204 {
return (endp == other.endp);}
211 inline bool operator != (
const iterator &other)
const
212 {
return (endp != other.endp);}
262 bool skipAllDelim =
false,
Common C++ thread class and sychronization objects.
Splits delimited string into tokens.
void setDelimiters(const char *d)
changes the set of delimiters used in subsequent iterations.
iterator(const iterator &i)
copy constructor.
void start(JoinableThread *thread, int priority=0)
Convenience function to start a joinable thread.
Exception thrown, if someone tried to read beyond the end of the tokens.
iterator & operator=(const iterator &i)
assignment operator.
static const char *const SPACE
a delimiter string containing all usual whitespace delimiters.
const iterator & end() const
the iterator marking the end.
iterator begin(const char *d)
returns a begin iterator with an alternate set of delimiters.
The input forward iterator for tokens.
iterator begin() const
returns the begin iterator
GNU Common C++ exception model base classes.