Kea 2.7.6
message_reader.h
Go to the documentation of this file.
1// Copyright (C) 2011-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 MESSAGE_READER_H
8#define MESSAGE_READER_H
9
10#include <map>
11#include <string>
12#include <vector>
13
15#include <log/message_types.h>
16
17namespace isc {
18namespace log {
19
24
26public:
27
36 typedef enum {
40
42 typedef std::vector<std::string> MessageIDCollection;
43
55 MessageReader(MessageDictionary* dictionary = NULL) :
56 dictionary_(dictionary), lineno_(0)
57 {}
58
61 {}
62
70 return (dictionary_);
71 }
72
73
81 void setDictionary(MessageDictionary* dictionary) {
82 dictionary_ = dictionary;
83 }
84
85
93 virtual void readFile(const std::string& file, Mode mode = ADD);
94
95
104 virtual void processLine(const std::string& line, Mode mode = ADD);
105
106
110 virtual std::string getNamespace() const {
111 return (ns_);
112 }
113
114
118 virtual void clearNamespace() {
119 ns_ = "";
120 }
121
122
126 virtual std::string getPrefix() const {
127 return (prefix_);
128 }
129
130
134 virtual void clearPrefix() {
135 prefix_ = "";
136 }
137
138
146 return (not_added_);
147 }
148
149private:
150
159 void parseMessage(const std::string& line, Mode mode);
160
161
168 void parseDirective(const std::string& line);
169
170
174 void parsePrefix(const std::vector<std::string>& tokens);
175
176
180 void parseNamespace(const std::vector<std::string>& tokens);
181
192 bool invalidSymbol(const std::string& symbol);
193
194
195
197 MessageDictionary* dictionary_;
198 MessageIDCollection not_added_;
199 int lineno_;
200 std::string prefix_;
201 std::string ns_;
202};
203
204} // namespace log
205} // namespace isc
206
207#endif // MESSAGE_READER_H
Read Message File.
virtual void processLine(const std::string &line, Mode mode=ADD)
Process Line.
MessageReader(MessageDictionary *dictionary=NULL)
Constructor.
virtual ~MessageReader()
Virtual Destructor.
virtual void clearNamespace()
Clear Namespace.
MessageIDCollection getNotAdded() const
Get Not-Added List.
void setDictionary(MessageDictionary *dictionary)
Set Dictionary.
MessageDictionary * getDictionary() const
Get Dictionary.
virtual std::string getPrefix() const
Get Prefix.
virtual void clearPrefix()
Clear Prefix.
virtual std::string getNamespace() const
Get Namespace.
std::vector< std::string > MessageIDCollection
Visible collection types.
virtual void readFile(const std::string &file, Mode mode=ADD)
Read File.
Defines the logger used by the top-level component of kea-lfc.