teditor  1.8.0@@fee5e94
Terminal based editor written in C++
Classes | Public Member Functions | Static Public Member Functions | List of all members
teditor::Mode Class Referenceabstract

#include <mode.h>

+ Inheritance diagram for teditor::Mode:

Classes

struct  Registrar
 

Public Member Functions

 Mode (const std::string &n, const std::string &w)
 ctor More...
 
virtual ~Mode ()
 
virtual const std::string & name () const
 
virtual const std::string & word () const
 
virtual int indent (Buffer &buf, int line)=0
 
virtual KeyCmdMapgetKeyCmdMap ()=0
 
virtual ColorMapgetColorMap ()=0
 
virtual void getColorFor (AttrColor &fg, AttrColor &bg, int lineNum, int pos, const Buffer &b, bool isHighlighted)=0
 
virtual Strings cmdNames () const
 

Static Public Member Functions

static ModePtr createMode (const std::string &mode)
 Helper to create mode object of the named mode. More...
 
static std::string inferMode (const std::string &file, bool isDir)
 Helper to infer mode name from the file. More...
 

Detailed Description

Mode attached with a buffer

Constructor & Destructor Documentation

◆ Mode()

teditor::Mode::Mode ( const std::string &  n,
const std::string &  w 
)
inline

ctor

Parameters
nname of the mode
wlist of chars that define a word in this mode

◆ ~Mode()

virtual teditor::Mode::~Mode ( )
inlinevirtual

dtor

Member Function Documentation

◆ cmdNames()

Strings teditor::Mode::cmdNames ( ) const
virtual

list of all command names that are registered under this mode

Reimplemented in teditor::watch::WatchMode, and teditor::ledger::LedgerMode.

◆ createMode()

ModePtr teditor::Mode::createMode ( const std::string &  mode)
static

Helper to create mode object of the named mode.

Parameters
modename of the mode
Returns
the mode object pointer

◆ getColorFor()

virtual void teditor::Mode::getColorFor ( AttrColor fg,
AttrColor bg,
int  lineNum,
int  pos,
const Buffer b,
bool  isHighlighted 
)
pure virtual

◆ getColorMap()

virtual ColorMap& teditor::Mode::getColorMap ( )
pure virtual

get color map for the buffer this mode applies to

Implemented in teditor::cmbar::CmBarMode, and teditor::readonly::ReadOnlyMode.

◆ getKeyCmdMap()

virtual KeyCmdMap& teditor::Mode::getKeyCmdMap ( )
pure virtual

get key-cmd map for the buffer this mode applies to

Implemented in teditor::cmbar::CmBarMode, and teditor::readonly::ReadOnlyMode.

◆ indent()

virtual int teditor::Mode::indent ( Buffer buf,
int  line 
)
pure virtual

function to compute indentation of the line in the input buffer

Implemented in teditor::cmbar::CmBarMode, teditor::readonly::ReadOnlyMode, teditor::text::TextMode, and teditor::cpp::CppMode.

◆ inferMode()

std::string teditor::Mode::inferMode ( const std::string &  file,
bool  isDir 
)
static

Helper to infer mode name from the file.

Parameters
filethe file
isDiris the input file a directory
Returns
the mode name

◆ name()

virtual const std::string& teditor::Mode::name ( ) const
inlinevirtual

mode's name

◆ word()

virtual const std::string& teditor::Mode::word ( ) const
inlinevirtual

list of chars that define a word


The documentation for this class was generated from the following files: