📄 wytermios.cpp
字号:
/* Copyright is licensed under GNU LGPL. by I.J.Wang 2003*/#define WYLIB_SOURCE#include "wytermios.h"#include <cstring>const char WyTermios::class_name[]="WyTermios";WyTermios::WyTermios() WY__TSPC(){ _tio.c_iflag=tcflag_t(); _tio.c_oflag=tcflag_t(); _tio.c_cflag=tcflag_t(); _tio.c_lflag=tcflag_t(); std::memset(_tio.c_cc,cc_t(),NCCS);};WyTermios::WyTermios(const WyTermios& src) WY__TSPC(){ _tio=src._tio;};WyTermios::WyTermios(WyTermios& src, Wy::ByMove_t) WY__TSPC(){ _tio=src._tio;};bool WyTermios::is_default(void) const WY__TSPC(){ if((_tio.c_iflag!=tcflag_t())|| (_tio.c_oflag!=tcflag_t())|| (_tio.c_cflag!=tcflag_t())|| (_tio.c_lflag!=tcflag_t())) { return(false); } for(int i=0; i<NCCS; ++i) { if(_tio.c_cc[i]!=cc_t()) { return(false); } } return(true);}void WyTermios::reset(void) WY__TSPC(){ _tio.c_iflag=tcflag_t(); _tio.c_oflag=tcflag_t(); _tio.c_cflag=tcflag_t(); _tio.c_lflag=tcflag_t(); std::memset(_tio.c_cc,cc_t(),NCCS);};void WyTermios::reset(const WyTermios& src) WY__TSPC(){ _tio=src._tio;};void WyTermios::swap(WyTermios& src) WY__TSPC(){ Wy__Base::memswp(&_tio,&src._tio,sizeof(_tio));};const WyTermios& WyTermios::operator =(const WyTermios &src) WY__TSPC(){ _tio=src._tio; return(*this);};speed_t WyTermios::getispeed(void) const WY__TSPC(){ return ::cfgetispeed(&_tio);};speed_t WyTermios::getospeed(void) const WY__TSPC(){ return ::cfgetospeed(&_tio);};WyRet WyTermios::setispeed(speed_t speed) WY__TSPC(){ if(::cfsetispeed(&_tio,speed)!=0) { WY_RETURN(errno); } return(Ok);};WyRet WyTermios::setospeed(speed_t speed) WY__TSPC(){ if(::cfsetospeed(&_tio,speed)!=0) { WY_RETURN(errno); } return(Ok);};tcflag_t WyTermios::iflag(void) const WY__TSPC(){ return _tio.c_iflag;};void WyTermios::iflag(tcflag_t v) WY__TSPC(){ _tio.c_iflag=v;};void WyTermios::iflag_or(tcflag_t v) WY__TSPC(){ _tio.c_iflag|=v;};void WyTermios::iflag_and(tcflag_t v) WY__TSPC(){ _tio.c_iflag&=v;};tcflag_t WyTermios::oflag(void) const WY__TSPC(){ return _tio.c_oflag;};void WyTermios::oflag(tcflag_t v) WY__TSPC(){ _tio.c_oflag=v;};void WyTermios::oflag_or(tcflag_t v) WY__TSPC(){ _tio.c_oflag|=v;};void WyTermios::oflag_and(tcflag_t v) WY__TSPC(){ _tio.c_oflag&=v;};tcflag_t WyTermios::cflag(void) const WY__TSPC(){ return _tio.c_cflag;};void WyTermios::cflag(tcflag_t v) WY__TSPC(){ _tio.c_cflag=v;};void WyTermios::cflag_or(tcflag_t v) WY__TSPC(){ _tio.c_cflag|=v;};void WyTermios::cflag_and(tcflag_t v) WY__TSPC(){ _tio.c_cflag&=v;};tcflag_t WyTermios::lflag(void) const WY__TSPC(){ return _tio.c_lflag;};void WyTermios::lflag(tcflag_t v) WY__TSPC(){ _tio.c_lflag=v;};void WyTermios::lflag_or(tcflag_t v) WY__TSPC(){ _tio.c_lflag|=v;};void WyTermios::lflag_and(tcflag_t v) WY__TSPC(){ _tio.c_lflag&=v;};cc_t WyTermios::cc_VSTOP(void) const WY__TSPC(){ return _tio.c_cc[VSTOP];};void WyTermios::cc_VSTOP(cc_t v) WY__TSPC(){ _tio.c_cc[VSTOP]=v;};cc_t WyTermios::cc_VSTART(void) const WY__TSPC(){ return _tio.c_cc[VSTART];};void WyTermios::cc_VSTART(cc_t v) WY__TSPC(){ _tio.c_cc[VSTART]=v;};cc_t WyTermios::cc_VSUSP(void) const WY__TSPC(){ return _tio.c_cc[VSUSP];};void WyTermios::cc_VSUSP(cc_t v) WY__TSPC(){ _tio.c_cc[VSUSP]=v;};cc_t WyTermios::cc_VQUIT(void) const WY__TSPC(){ return _tio.c_cc[VQUIT]; };void WyTermios::cc_VQUIT(cc_t v) WY__TSPC(){ _tio.c_cc[VQUIT]=v;};cc_t WyTermios::cc_VKILL(void) const WY__TSPC(){ return _tio.c_cc[VKILL];};void WyTermios::cc_VKILL(cc_t v) WY__TSPC(){ _tio.c_cc[VKILL]=v; };cc_t WyTermios::cc_VERASE(void) const WY__TSPC(){ return _tio.c_cc[VERASE]; };void WyTermios::cc_VERASE(cc_t v) WY__TSPC(){ _tio.c_cc[VERASE]=v; };cc_t WyTermios::cc_VEOL(void) const WY__TSPC(){ return _tio.c_cc[VEOL]; };void WyTermios::cc_VEOL(cc_t v) WY__TSPC(){ _tio.c_cc[VEOL]=v; };cc_t WyTermios::cc_VEOF(void) const WY__TSPC(){ return _tio.c_cc[VEOF]; };void WyTermios::cc_VEOF(cc_t v) WY__TSPC(){ _tio.c_cc[VEOF]=v; };cc_t WyTermios::cc_VINTR(void) const WY__TSPC(){ return _tio.c_cc[VINTR]; };void WyTermios::cc_VINTR(cc_t v) WY__TSPC(){ _tio.c_cc[VINTR]=v;};cc_t WyTermios::cc_VTIME(void) const WY__TSPC(){ return _tio.c_cc[VTIME]; };void WyTermios::cc_VTIME(cc_t v) WY__TSPC(){ _tio.c_cc[VTIME]=v; };cc_t WyTermios::cc_VMIN(void) const WY__TSPC(){ return _tio.c_cc[VMIN]; };void WyTermios::cc_VMIN(cc_t v) WY__TSPC(){ _tio.c_cc[VMIN]=v;};bool WyTermios::operator ==(const WyTermios& rhs) const WY__TSPC(){ if(_tio.c_iflag!=rhs._tio.c_iflag) { return(false); } if(_tio.c_oflag!=rhs._tio.c_oflag) { return(false); } if(_tio.c_cflag!=rhs._tio.c_cflag) { return(false); } if(_tio.c_lflag!=rhs._tio.c_lflag) { return(false); } return(std::memcmp(_tio.c_cc,rhs._tio.c_cc,sizeof(_tio.c_cc))==0);};struct ::termios* WyTermios::wy_tio_ptr(void) WY__NOTHROW__{ return &_tio;};const struct ::termios* WyTermios::wy_tio_ptr(void) const WY__NOTHROW__{ return &_tio;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -