Kea  1.5.0
master_lexer_state.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef MASTER_LEXER_STATE_H
8 #define MASTER_LEXER_STATE_H 1
9 
10 #include <dns/master_lexer.h>
11 
12 #include <boost/function.hpp>
13 
14 namespace isc {
15 namespace dns {
16 
17 namespace master_lexer_internal {
18 
50 class State {
51 public:
56  virtual ~State() {}
57 
71  static const State* start(MasterLexer& lexer,
72  MasterLexer::Options options);
73 
86  virtual void handle(MasterLexer& lexer) const = 0;
87 
93  enum ID {
94  CRLF,
98  };
99 
105  static const State& getInstance(ID state_id);
106 
113  bool wasLastEOL(const MasterLexer& lexer) const;
114  const MasterToken& getToken(const MasterLexer& lexer) const;
115  size_t getParenCount(const MasterLexer& lexer) const;
117 
118 protected:
128  MasterLexer::MasterLexerImpl* getLexerImpl(MasterLexer& lexer) const {
129  return (lexer.impl_);
130  }
131 };
132 
133 } // namespace master_lexer_internal
134 } // namespace dns
135 } // namespace isc
136 #endif // MASTER_LEXER_STATE_H
137 
138 // Local Variables:
139 // mode: c++
140 // End:
Just seen a carriage-return character.
virtual void handle(MasterLexer &lexer) const =0
Handle the process of one specific state.
static const State * start(MasterLexer &lexer, MasterLexer::Options options)
Begin state transitions to get the next token.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool wasLastEOL(const MasterLexer &lexer) const
const MasterToken & getToken(const MasterLexer &lexer) const
virtual ~State()
Virtual destructor.
Options
Options for getNextToken.
Definition: master_lexer.h:343
Tokens for MasterLexer.
Definition: master_lexer.h:39
Tokenization state for MasterLexer.
static const State & getInstance(ID state_id)
Returns a State instance of the given state.
Tokenizer for parsing DNS master files.
Definition: master_lexer.h:301
MasterLexer::MasterLexerImpl * getLexerImpl(MasterLexer &lexer) const
An accessor to the internal implementation class of MasterLexer.
size_t getParenCount(const MasterLexer &lexer) const