Shell终端光标和颜色控制
Posted tookkke
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Shell终端光标和颜色控制相关的知识,希望对你有一定的参考价值。
#include "SColor.h"
bool SColor::b_allEnabled=true;
void SColor::setAllEnabled(bool enabled)
b_allEnabled=enabled;
bool SColor::allEnabled()
return b_allEnabled;
void SColor::setEnabled(bool enabled)
b_enabled=enabled;
bool SColor::enabled()const
return b_enabled;
void SColor::move(int x,int y,std::ostream& os)
if(allEnabled())os<<"\\e["<<x-1<<";"<<y-1<<"H";
void SColor::moveUP(int n,std::ostream& os)
if(allEnabled())os<<"\\e["<<n<<"A";
void SColor::moveDOWN(int n,std::ostream& os)
if(allEnabled())os<<"\\e["<<n<<"B";
void SColor::moveRIGHT(int n,std::ostream& os)
if(allEnabled())os<<"\\e["<<n<<"C";
void SColor::moveLEFT(int n,std::ostream& os)
if(allEnabled())os<<"\\e["<<n<<"D";
void SColor::clear(std::ostream& os)
if(allEnabled())os<<"\\e[2J\\e[1;1H";
void SColor::clearLine(std::ostream& os)
if(allEnabled())os<<"\\e[K";
void SColor::setCursor(int x,int y,std::ostream& os)
if(allEnabled())os<<"\\e["<<x<<";"<<y<<"H";
void
以上是关于Shell终端光标和颜色控制的主要内容,如果未能解决你的问题,请参考以下文章