1 | /*
|
---|
2 | * synergy -- mouse and keyboard sharing utility
|
---|
3 | * Copyright (C) 2002 Chris Schoeneman
|
---|
4 | *
|
---|
5 | * This package is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * found in the file COPYING that should have accompanied this file.
|
---|
8 | *
|
---|
9 | * This package is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | * GNU General Public License for more details.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #ifndef ILOGOUTPUTTER_H
|
---|
16 | #define ILOGOUTPUTTER_H
|
---|
17 |
|
---|
18 | #include "IInterface.h"
|
---|
19 | #include "CLog.h"
|
---|
20 |
|
---|
21 | //! Outputter interface
|
---|
22 | /*!
|
---|
23 | Type of outputter interface. The logger performs all output through
|
---|
24 | outputters. ILogOutputter overrides must not call any log functions
|
---|
25 | directly or indirectly.
|
---|
26 | */
|
---|
27 | class ILogOutputter : public IInterface {
|
---|
28 | public:
|
---|
29 | typedef CLog::ELevel ELevel;
|
---|
30 |
|
---|
31 | //! @name manipulators
|
---|
32 | //@{
|
---|
33 |
|
---|
34 | //! Open the outputter
|
---|
35 | /*!
|
---|
36 | Opens the outputter for writing. Calling this method on an
|
---|
37 | already open outputter must have no effect.
|
---|
38 | */
|
---|
39 | virtual void open(const char* title) = 0;
|
---|
40 |
|
---|
41 | //! Close the outputter
|
---|
42 | /*!
|
---|
43 | Close the outputter. Calling this method on an already closed
|
---|
44 | outputter must have no effect.
|
---|
45 | */
|
---|
46 | virtual void close() = 0;
|
---|
47 |
|
---|
48 | //! Show the outputter
|
---|
49 | /*!
|
---|
50 | Causes the output to become visible. This generally only makes sense
|
---|
51 | for a logger in a graphical user interface. Other implementations
|
---|
52 | will do nothing. Iff \p showIfEmpty is \c false then the implementation
|
---|
53 | may optionally only show the log if it's not empty.
|
---|
54 | */
|
---|
55 | virtual void show(bool showIfEmpty) = 0;
|
---|
56 |
|
---|
57 | //! Write a message with level
|
---|
58 | /*!
|
---|
59 | Writes \c message, which has the given \c level, to a log.
|
---|
60 | If this method returns true then CLog will stop passing the
|
---|
61 | message to all outputters in the outputter chain, otherwise
|
---|
62 | it continues. Most implementations should return true.
|
---|
63 | */
|
---|
64 | virtual bool write(ELevel level, const char* message) = 0;
|
---|
65 |
|
---|
66 | //@}
|
---|
67 | //! @name accessors
|
---|
68 | //@{
|
---|
69 |
|
---|
70 | //! Returns the newline sequence for the outputter
|
---|
71 | /*!
|
---|
72 | Different outputters use different character sequences for newlines.
|
---|
73 | This method returns the appropriate newline sequence for this
|
---|
74 | outputter.
|
---|
75 | */
|
---|
76 | virtual const char* getNewline() const = 0;
|
---|
77 |
|
---|
78 | //@}
|
---|
79 | };
|
---|
80 |
|
---|
81 | #endif
|
---|