teditor  1.8.0@@fee5e94
Terminal based editor written in C++
Public Member Functions | List of all members
teditor::Line Class Reference

#include <line.h>

Public Member Functions

 Line ()
 
void append (char c)
 
void append (const char *c)
 
void append (const std::string &str)
 
void prepend (char c)
 
void prepend (const char *c)
 
void prepend (char c, int count)
 
void insert (char c, int idx)
 
void insert (const char *c, int idx)
 
void insert (const std::string &str, int idx)
 
std::string erase (int idx, int len=1)
 
Line split (int idx)
 
void join (const Line &other)
 
int numLinesNeeded (int wid) const
 
bool empty () const
 
int length () const
 
const std::string & get () const
 
char at (int idx) const
 
void clear ()
 
int findFirstNotOf (const std::string &str, int pos) const
 
int findLastNotOf (const std::string &str, int pos) const
 
int indentSize () const
 

Detailed Description

Base class to store a line in the buffer

Constructor & Destructor Documentation

◆ Line()

teditor::Line::Line ( )
inline

Member Function Documentation

◆ at()

char teditor::Line::at ( int  idx) const
inline

access idx'th element in the line

◆ clear()

void teditor::Line::clear ( )
inline

clear the line

◆ empty()

bool teditor::Line::empty ( ) const
inline

Check for empty line

◆ erase()

std::string teditor::Line::erase ( int  idx,
int  len = 1 
)

erases from the given index and returns the erased chars

◆ findFirstNotOf()

int teditor::Line::findFirstNotOf ( const std::string &  str,
int  pos 
) const

Same as find_first_not_of function of std::string However, if no match, it will return the length of the line itself

◆ findLastNotOf()

int teditor::Line::findLastNotOf ( const std::string &  str,
int  pos 
) const

Same as find_last_not_of function of std::string However, if no match, it will return 0

◆ get()

const std::string& teditor::Line::get ( ) const
inline

get the string

◆ indentSize()

int teditor::Line::indentSize ( ) const

measures the indentation at the beginning of this line

◆ length()

int teditor::Line::length ( ) const
inline

Number of chars in the line

◆ numLinesNeeded()

int teditor::Line::numLinesNeeded ( int  wid) const

number of lines needed on the screen to render this line


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