Kea: master_lexer_state.h Source File

| Kea 3.0.0

master_lexer_state.h
Go to the documentation of this file.
1// Copyright (C) 2012-2024 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
9
10#include <dns/master_lexer.h>
11
12namespace isc {
13namespace dns {
14
15namespace master_lexer_internal {
16
48 class State {
49public:
54 virtual ~State() {}
55
69 static const State* start(MasterLexer& lexer,
70 MasterLexer::Options options);
71
84 virtual void handle(MasterLexer& lexer) const = 0;
85
91 enum ID {
92 CRLF,
93 String,
94 QString,
95 Number
96 };
97
103 static const State& getInstance(ID state_id);
104
111 bool wasLastEOL(const MasterLexer& lexer) const;
112 const MasterToken& getToken(const MasterLexer& lexer) const;
113 size_t getParenCount(const MasterLexer& lexer) const;
115
116protected:
126 MasterLexer::MasterLexerImpl* getLexerImpl(MasterLexer& lexer) const {
127 return (lexer.impl_.get());
128 }
129};
130
131} // namespace master_lexer_internal
132} // namespace dns
133} // namespace isc
134#endif // MASTER_LEXER_STATE_H
isc::dns::MasterLexer
Tokenizer for parsing DNS master files.
Definition master_lexer.h:303
isc::dns::MasterLexer::Options
Options
Options for getNextToken.
Definition master_lexer.h:345
isc::dns::MasterToken
Tokens for MasterLexer.
Definition master_lexer.h:40
isc::dns::master_lexer_internal::State
Tokenization state for MasterLexer.
Definition master_lexer_state.h:48
isc::dns::master_lexer_internal::State::handle
virtual void handle(MasterLexer &lexer) const =0
Handle the process of one specific state.
isc::dns::master_lexer_internal::State::getParenCount
size_t getParenCount(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:126
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::master_lexer_internal::State::~State
virtual ~State()
Virtual destructor.
Definition master_lexer_state.h:54
isc::dns::master_lexer_internal::State::getInstance
static const State & getInstance(ID state_id)
Returns a State instance of the given state.
isc::dns::master_lexer_internal::State::getToken
const MasterToken & getToken(const MasterLexer &lexer) const
isc::dns::master_lexer_internal::State::wasLastEOL
bool wasLastEOL(const MasterLexer &lexer) const
isc::dns::master_lexer_internal::State::ID
ID
Types of states.
Definition master_lexer_state.h:91
isc::dns::master_lexer_internal::State::String
@ String
Handling a string token.
Definition master_lexer_state.h:93
isc::dns::master_lexer_internal::State::CRLF
@ CRLF
Just seen a carriage-return character.
Definition master_lexer_state.h:92
isc::dns::master_lexer_internal::State::QString
@ QString
Handling a quoted string token.
Definition master_lexer_state.h:94
isc::dns::master_lexer_internal::State::Number
@ Number
Handling a number.
Definition master_lexer_state.h:95
master_lexer.h
isc::dns::master_lexer_internal
Definition master_lexer.h:22
isc::dns
Definition char_string.cc:26
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148