|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // ホストドライバ (基本クラス)
9: //
10:
11: #pragma once
12:
13: #include "object.h"
14: #include "monitor.h"
15:
16: class HostDevice;
17:
18: class Driver : public Object
19: {
20: using inherited = Object;
21: protected:
22: static const int NODATA = -1;
23:
24: protected:
25: Driver(HostDevice *hostdev_, const char *drivername_);
26: public:
27: virtual ~Driver() override;
28:
29: virtual bool InitDriver();
30:
31: // ドライバ固有の Dispatch。 udata を返す。
32: // 必要に応じて udata を変更しても良い。
33: // これ以上処理することがなければ HostDevice::DONE を返す。
34: virtual int Dispatch(int udata);
35:
36: // モニタのうちドライバ依存部分の情報を書き出す。
1.1.1.2 ! root 37: // screen のうち y行目から2行のみがドライバ依存部分なので
1.1 root 38: // ここだけ書き出すこと。不要なら書き出さなくてよい。Clear() しないこと。
1.1.1.2 ! root 39: virtual void MonitorUpdateMD(TextScreen& screen, int y);
1.1 root 40:
41: // ドライバ名を取得。
42: const char *GetDriverName() const { return drivername; }
43:
44: protected:
45: // 親ホストデバイス
46: HostDevice *hostdev {};
47:
48: // ドライバ名 ("None" とか)
49: const char *drivername {};
50: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.