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,
97  Number
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:
isc::dns::master_lexer_internal::State::start
static const State * start(MasterLexer &lexer, MasterLexer::Options options)
Begin state transitions to get the next token.
isc::dns::MasterToken
Tokens for MasterLexer.
Definition: master_lexer.h:39
isc::dns::master_lexer_internal::State::wasLastEOL
bool wasLastEOL(const MasterLexer &lexer) const
isc::dns::MasterLexer
Tokenizer for parsing DNS master files.
Definition: master_lexer.h:301
isc::dns::master_lexer_internal::State::~State
virtual ~State()
Virtual destructor.
Definition: master_lexer_state.h:56
isc::dns::master_lexer_internal::State::getToken
const MasterToken & getToken(const MasterLexer &lexer) const
isc::dns::master_lexer_internal::State::getLexerImpl
MasterLexer::MasterLexerImpl * getLexerImpl(MasterLexer &lexer) const
An accessor to the internal implementation class of MasterLexer.
Definition: master_lexer_state.h:128
isc::dns::master_lexer_internal::State::QString
@ QString
Handling a quoted string token.
Definition: master_lexer_state.h:96
isc::dns::master_lexer_internal::State::getInstance
static const State & getInstance(ID state_id)
Returns a State instance of the given state.
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::dns::master_lexer_internal::State
Tokenization state for MasterLexer.
Definition: master_lexer_state.h:50
isc::dns::master_lexer_internal::State::CRLF
@ CRLF
Just seen a carriage-return character.
Definition: master_lexer_state.h:94
isc::dns::master_lexer_internal::State::getParenCount
size_t getParenCount(const MasterLexer &lexer) const
isc::dns::master_lexer_internal::State::Number
@ Number
Handling a number.
Definition: master_lexer_state.h:97
isc::dns::master_lexer_internal::State::ID
ID
Types of states.
Definition: master_lexer_state.h:93
isc::dns::master_lexer_internal::State::String
@ String
Handling a string token.
Definition: master_lexer_state.h:95
isc::dns::master_lexer_internal::State::handle
virtual void handle(MasterLexer &lexer) const =0
Handle the process of one specific state.
master_lexer.h
isc::dns::MasterLexer::Options
Options
Options for getNextToken.
Definition: master_lexer.h:343