StuBS
linenoise.hpp File Reference
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <string>
#include <fstream>
#include <functional>
#include <vector>
#include <iostream>
Include dependency graph for linenoise.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  linenoise::linenoiseState
 

Namespaces

namespace  linenoise
 

Macros

#define LINENOISE_DEFAULT_HISTORY_MAX_LEN   100
 
#define LINENOISE_MAX_LINE   4096
 
#define LINENOISE_HISTORY_NEXT   0
 
#define LINENOISE_HISTORY_PREV   1
 

Typedefs

typedef std::function< void(const char *, std::vector< std::string > &)> linenoise::CompletionCallback
 

Enumerations

enum  linenoise::KEY_ACTION {
  linenoise::KEY_NULL = 0 ,
  linenoise::CTRL_A = 1 ,
  linenoise::CTRL_B = 2 ,
  linenoise::CTRL_C = 3 ,
  linenoise::CTRL_D = 4 ,
  linenoise::CTRL_E = 5 ,
  linenoise::CTRL_F = 6 ,
  linenoise::CTRL_H = 8 ,
  linenoise::TAB = 9 ,
  linenoise::CTRL_K = 11 ,
  linenoise::CTRL_L = 12 ,
  linenoise::ENTER = 13 ,
  linenoise::CTRL_N = 14 ,
  linenoise::CTRL_P = 16 ,
  linenoise::CTRL_T = 20 ,
  linenoise::CTRL_U = 21 ,
  linenoise::CTRL_W = 23 ,
  linenoise::ESC = 27 ,
  linenoise::BACKSPACE = 127
}
 

Functions

void linenoise::linenoiseAtExit (void)
 
bool linenoise::AddHistory (const char *line)
 
void linenoise::refreshLine (struct linenoiseState *l)
 
static int linenoise::unicodeIsWideChar (unsigned long cp)
 
int linenoise::unicodeIsCombiningChar (unsigned long cp)
 
int linenoise::unicodePrevUTF8CharLen (char *buf, int pos)
 
int linenoise::unicodeUTF8CharLen (char *buf, int buf_len, int pos)
 
int linenoise::unicodeUTF8CharToCodePoint (const char *buf, int len, int *cp)
 
int linenoise::unicodeGraphemeLen (char *buf, int buf_len, int pos)
 
int linenoise::unicodePrevGraphemeLen (char *buf, int pos)
 
int linenoise::isAnsiEscape (const char *buf, int buf_len, int *len)
 
int linenoise::unicodeColumnPos (const char *buf, int buf_len)
 
int linenoise::unicodeColumnPosForMultiLine (char *buf, int buf_len, int pos, int cols, int ini_pos)
 
int linenoise::unicodeReadUTF8Char (int fd, char *buf, int *cp)
 
void linenoise::SetMultiLine (bool ml)
 
bool linenoise::isUnsupportedTerm (void)
 
bool linenoise::enableRawMode (int fd)
 
void linenoise::disableRawMode (int fd)
 
int linenoise::getCursorPosition (int ifd, int ofd)
 
int linenoise::getColumns (int ifd, int ofd)
 
void linenoise::linenoiseClearScreen (void)
 
void linenoise::linenoiseBeep (void)
 
int linenoise::completeLine (struct linenoiseState *ls, char *cbuf, int *c)
 
void linenoise::SetCompletionCallback (CompletionCallback fn)
 
void linenoise::refreshSingleLine (struct linenoiseState *l)
 
void linenoise::refreshMultiLine (struct linenoiseState *l)
 
int linenoise::linenoiseEditInsert (struct linenoiseState *l, const char *cbuf, int clen)
 
void linenoise::linenoiseEditMoveLeft (struct linenoiseState *l)
 
void linenoise::linenoiseEditMoveRight (struct linenoiseState *l)
 
void linenoise::linenoiseEditMoveHome (struct linenoiseState *l)
 
void linenoise::linenoiseEditMoveEnd (struct linenoiseState *l)
 
void linenoise::linenoiseEditHistoryNext (struct linenoiseState *l, int dir)
 
void linenoise::linenoiseEditDelete (struct linenoiseState *l)
 
void linenoise::linenoiseEditBackspace (struct linenoiseState *l)
 
void linenoise::linenoiseEditDeletePrevWord (struct linenoiseState *l)
 
int linenoise::linenoiseEdit (int stdin_fd, int stdout_fd, char *buf, int buflen, const char *prompt)
 
bool linenoise::linenoiseRaw (const char *prompt, std::string &line)
 
bool linenoise::Readline (const char *prompt, std::string &line)
 
std::string linenoise::Readline (const char *prompt, bool &quit)
 
std::string linenoise::Readline (const char *prompt)
 
bool linenoise::SetHistoryMaxLen (size_t len)
 
bool linenoise::SaveHistory (const char *path)
 
bool linenoise::LoadHistory (const char *path)
 
const std::vector< std::string > & linenoise::GetHistory ()
 

Constants

static const char * linenoise::unsupported_term [] = {"dumb","cons25","emacs",nullptr}
 
static CompletionCallback linenoise::completionCallback
 
static struct termios linenoise::orig_termios
 
static bool linenoise::rawmode = false
 
static bool linenoise::mlmode = false
 
static bool linenoise::atexit_registered = false
 
static size_t linenoise::history_max_len = LINENOISE_DEFAULT_HISTORY_MAX_LEN
 
static std::vector< std::string > linenoise::history
 
static unsigned long linenoise::unicodeWideCharTable [][2]
 
static int linenoise::unicodeWideCharTableSize = sizeof(unicodeWideCharTable) / sizeof(unicodeWideCharTable[0])
 
static unsigned long linenoise::unicodeCombiningCharTable []
 
static int linenoise::unicodeCombiningCharTableSize = sizeof(unicodeCombiningCharTable) / sizeof(unicodeCombiningCharTable[0])
 

Class Documentation

◆ linenoise::linenoiseState

struct linenoise::linenoiseState
Class Members
int ifd
int ofd
char * buf
int buflen
string prompt
int pos
int oldcolpos
int len
int cols
int maxrows
int history_index

Macro Definition Documentation

◆ LINENOISE_DEFAULT_HISTORY_MAX_LEN

#define LINENOISE_DEFAULT_HISTORY_MAX_LEN   100

◆ LINENOISE_MAX_LINE

#define LINENOISE_MAX_LINE   4096

◆ LINENOISE_HISTORY_NEXT

#define LINENOISE_HISTORY_NEXT   0

◆ LINENOISE_HISTORY_PREV

#define LINENOISE_HISTORY_PREV   1