Merge branch 'daemon-ext'
[libi2ncommon] / src / logread.hxx
CommitLineData
0e23f538
TJ
1/*
2The software in this package is distributed under the GNU General
3Public License version 2 (with a special exception described below).
4
5A copy of GNU General Public License (GPL) is included in this distribution,
6in the file COPYING.GPL.
7
8As a special exception, if other files instantiate templates or use macros
9or inline functions from this file, or you compile this file and link it
10with other works to produce a work based on this file, this file
11does not by itself cause the resulting work to be covered
12by the GNU General Public License.
13
14However the source code for this file must still be made available
15in accordance with section (3) of the GNU General Public License.
16
17This exception does not invalidate any other reasons why a work based
18on this file might be covered by the GNU General Public License.
19*/
7113c4f0 20/***************************************************************************
0e23f538 21 * Copyright (C) 2006 by Intra2net AG *
7113c4f0
TJ
22 * *
23 ***************************************************************************/
24
25#ifndef __LOGREAD_HXX
26#define __LOGREAD_HXX
27
28#include <string>
29
30/**
31 Log file reader class.
32
33 Works on complete and incomplete lines.
34 Devire from this class and implement your
35 own processLine() / processUnfinishedLine() function.
36*/
37class logread
38{
39public:
40 logread(std::string filename, bool _goto_end=false);
41 void read();
42
43protected:
44 std::string line;
45
46 virtual void processUnfinishedLine() {};
47 virtual void processLine() {};
48
49private:
50 // Internal implementation
51 void reset();
52 void goto_end();
53
54 bool check_changed();
55 bool process();
56
57 std::string getLogChanges();
58 void extractSingeLine (std::string &input);
59
60 std::string filename;
61 int logsize;
62 int logsize_old;
63
64 bool line_complete;
65};
66
67#endif