key.h
来自「C++&datastructure书籍源码,以前外教提供现在与大家共享」· C头文件 代码 · 共 61 行
H
61 行
#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 + =
减小字号Ctrl + -
显示快捷键?