⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 key.h

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 H
字号:
#ifndef _KEY_H
#define _KEY_H

#include <iostream>
#include <string>
using namespace std;

// encapsulate a key-press for use in the graphics package
// the header file is independent of the graphics package, but
// the implementation relies on the CMU graphics package
// created by Geoff Washburn and others, gw2@andrew.cmu.edu
//
// All Key methods are const, they should be self-explanatory
// by name in returning a bool giving characteristics of the key,
// or an int in the case of funkey() for the function keys
// and accessor functions for the general kinds, see the class enum
// for details

class Key
{
  public:
    enum Kind{ascii, escape, function, arrow, none};
    
    Key();
    Key(char ch);
    Key(char ch, Kind k);
    
    bool isnothing()  const;
    bool isasc()    const;
    bool isfunction() const;
    bool isarrow()    const;
    bool isescape()   const;
    bool iscontrol()  const;
    char aschar()    const;
    
    bool isleftarrow()    const;
    bool isrightarrow()   const;
    bool isuparrow()      const;
    bool isdownarrow()    const;
    bool ishome()         const;
    bool isend()          const;
    bool ispageup()       const;
    bool ispagedown()     const;
    bool iscenter()       const;
    
    int  funkey()         const;
    Kind getKind()        const;
    string tostring()     const;
    
  private:

    char myChar;
    Kind myKind;
};

ostream& operator << (ostream& output, const Key& k);
bool operator == (const Key& lhs, const Key& rhs);
bool operator != (const Key& lhs, const Key& rhs);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -