Annotation of nono/debugger/consio.h, revision 1.1

1.1     ! root        1: //
        !             2: // nono
        !             3: // Copyright (C) 2019 [email protected]
        !             4: //
        !             5: 
        !             6: #pragma once
        !             7: 
        !             8: // コンソール(?)
        !             9: class Consio
        !            10: {
        !            11:  public:
        !            12:        Consio() { }
        !            13:        virtual ~Consio() { }
        !            14: 
        !            15:        virtual bool Init() = 0;
        !            16: 
        !            17:        virtual bool Open() = 0;
        !            18:        virtual void Close() = 0;
        !            19:        virtual void Print(const char *fmt, ...) __printflike(2, 3) = 0;
        !            20:        virtual void Flush() = 0;
        !            21: 
        !            22:        // 1文字読み込む。
        !            23:        // 戻り値は正なら読み込んだバイト。0 なら EOF。-1 ならエラー。
        !            24:        virtual int  GetChar() = 0;
        !            25: 
        !            26:        // 1行読み込む。
        !            27:        // 戻り値は読み込んだバイト数。0 なら EOF。-1 ならエラー。
        !            28:        // バッファは \0 で終端してある。
        !            29:        virtual int  Gets(char *, int) = 0;
        !            30: 
        !            31:        // 受信データがあれば正、なければ 0 を返す。エラーなら負数を返す。
        !            32:        virtual int  Poll() = 0;
        !            33: };
        !            34: 
        !            35: class ConsioTCP
        !            36:        : public Consio
        !            37: {
        !            38:  public:
        !            39:        ConsioTCP();
        !            40:        virtual ~ConsioTCP();
        !            41: 
        !            42:        bool Init();
        !            43:        bool Open();
        !            44:        void Close();
        !            45:        void Print(const char *fmt, ...) __printflike(2, 3);
        !            46:        void Flush();
        !            47:        int  GetChar();
        !            48:        int  Gets(char *, int);
        !            49:        int  Poll();
        !            50: 
        !            51:  private:
        !            52:        int ls = 0;
        !            53:        int sock = 0;
        !            54:        struct addrinfo *res = NULL;
        !            55:        struct addrinfo *ai = NULL;
        !            56: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.