OXYGENHUB
◆ main openmsx / src / PrinterPortLogger.hh
1.3 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef MSXPRINTERPORTLOGGER_HH
2
#define MSXPRINTERPORTLOGGER_HH
3
4
#include "File.hh"
5
#include "FilenameSetting.hh"
6
#include "PrinterPortDevice.hh"
7
8
namespace openmsx {
9
10
class CommandController;
11
12
class PrinterPortLogger final : public PrinterPortDevice
13
{
14
public:
15
	explicit PrinterPortLogger(CommandController& commandController);
16
17
	// PrinterPortDevice
18
	[[nodiscard]] bool getStatus(EmuTime time) override;
19
	void setStrobe(bool strobe, EmuTime time) override;
20
	void writeData(uint8_t data, EmuTime time) override;
21
22
	// Pluggable
23
	[[nodiscard]] zstring_view getName() const override;
24
	[[nodiscard]] zstring_view getDescription() const override;
25
	void plugHelper(Connector& connector, EmuTime time) override;
26
	void unplugHelper(EmuTime time) override;
27
28
	template<typename Archive>
29
	void serialize(Archive& ar, unsigned version);
30
31
private:
32
	FilenameSetting logFilenameSetting;
33
	File file;
34
	uint8_t toPrint = 0; // Initialize to avoid a static analysis (cppcheck) warning.
35
	                     // For correctness it's not strictly needed to initialize
36
	                     // this variable. But understanding why exactly it's not
37
	                     // needed depends on the implementation details of a few
38
	                     // other classes, so let's simplify stuff and just
39
	                     // initialize.
40
	bool prevStrobe = true;
41
};
42
43
} // namespace openmsx
44
45
#endif