1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_http_internal_Tokenizer_hpp
10 #define anna_http_internal_Tokenizer_hpp
12 #include <anna/core/util/Recycler.hpp>
14 #include <anna/http/internal/Token.hpp>
22 class Tokenizer : public Recycler<Token> {
24 void apply(const DataBlock&) throw(RuntimeException);
25 void apply(const DataBlock&, const char* separator) throw(RuntimeException);
26 void apply(const DataBlock&, const char separator) throw(RuntimeException);
28 const Token* operator [](int index) const throw();
30 const Token* operator [](const_iterator ii) const throw() {
31 return (ii == end()) ? NULL : token(ii);
34 static const Token* token(const_iterator ii) throw() { return data(ii); }
35 static Token* token(iterator ii) throw() { return data(ii); }
38 int createToken(const char* p, const int size) throw() {
39 create()->setValue(p, size);
43 static int find(const char* data, const int size, const char character) throw();
44 static int find(const char* data, const int size, const char* searched) throw();
45 static bool isSpace(const int c) throw() { return c <= '\t' || c == ' ' || c >= 128; }