ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
message_buffer.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 //=============================================================================
23 //
24 // MessageBuffer, the IOutputHandler implementation that stores debug messages
25 // in a vector. Could be handy if you need to temporarily buffer debug log
26 // while specifying how to actually print it.
27 //
28 //=============================================================================
29 
30 #ifndef AGS_ENGINE_DEBUGGING_MESSAGE_BUFFER_H
31 #define AGS_ENGINE_DEBUGGING_MESSAGE_BUFFER_H
32 
33 #include "common/std/vector.h"
34 #include "ags/shared/debugging/output_handler.h"
35 
36 namespace AGS3 {
37 namespace AGS {
38 namespace Engine {
39 
40 using Shared::String;
41 using Shared::DebugMessage;
42 
44 public:
45  MessageBuffer(size_t buffer_limit = 1024);
46 
47  void PrintMessage(const DebugMessage &msg) override;
48 
49  // Clears buffer
50  void Clear();
51  // Sends buffered messages into given output target
52  void Send(const String &out_id);
53  // Sends buffered messages into given output target and clears buffer
54  void Flush(const String &out_id);
55 
56 private:
57  const size_t _bufferLimit;
59  size_t _msgLost;
60 };
61 
62 } // namespace Engine
63 } // namespace AGS
64 } // namespace AGS3
65 
66 #endif
Definition: achievements_tables.h:27
Definition: vector.h:39
Definition: output_handler.h:39
Definition: string.h:62
Definition: output_handler.h:55
Definition: engine.h:144
Definition: ags.h:40
Definition: message_buffer.h:43