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&) noexcept(false);
25 void apply(const DataBlock&, const char* separator) noexcept(false);
26 void apply(const DataBlock&, const char separator) noexcept(false);
28 const Token* operator [](int index) const ;
30 const Token* operator [](const_iterator ii) const {
31 return (ii == end()) ? NULL : token(ii);
34 static const Token* token(const_iterator ii) { return data(ii); }
35 static Token* token(iterator ii) { return data(ii); }
38 int createToken(const char* p, const int size) {
39 create()->setValue(p, size);
43 static int find(const char* data, const int size, const char character) ;
44 static int find(const char* data, const int size, const char* searched) ;
45 static bool isSpace(const int c) { return c <= '\t' || c == ' ' || c >= 128; }