EMath++
Classes for mathematical concepts
Loading...
Searching...
No Matches
interface.cpp File Reference

This file contains the text user interface for the emath library. More...

#include <curses.h>
#include <fstream>
#include <string>
#include <vector>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <SFML/Graphics.hpp>
#include <thread>
#include "emath.h"
#include "eparser.h"
#include "font.h"
#include <signal.h>
+ Include dependency graph for interface.cpp:

Go to the source code of this file.

Classes

class  efc::Window
 Generic class for wrapping a curses WINDOW. More...
 
class  efc::OWindow
 Window class extension for output. More...
 
class  efc::IWindow
 Window class extension for input. More...
 
class  efc::Terminal
 Terminal class to manage the terminal through curses. More...
 
class  efc::Plane
 Plane class to draw a function in the Cartesian plane. More...
 
class  efc::Storage
 Storage class to read and write to a file. More...
 
struct  efc::Token
 Struct for representing a token as a type and a value. More...
 
class  efc::Lexer
 Class that works as a token supplier for the Parser class. More...
 
class  efc::Parser
 Class that wraps a std::string and parses it as a number or as a operation. More...
 
class  efc::Application
 Class that contains the application inner logic. More...
 

Namespaces

namespace  efc
 Englobes all the classes and functions of the emath text user interface.
 

Macros

#define INTERFACE_H
 
#define HPADD   1
 
#define WPADD   2
 
#define CPOSY   1
 
#define CPOSX   2
 
#define PSIZE   3
 
#define TOFST   2
 
#define COLOR_ID   1
 
#define KEY_ESC   27
 
#define KEY_TAB   9
 
#define KEY_SPC   32
 
#define KEY_E   101
 
#define KEY_Q   113
 
#define KEY_1   49
 
#define KEY_2   50
 
#define KEY_3   51
 
#define KEY_4   52
 
#define KEY_5   53
 
#define LWIN   0
 
#define RWIN   1
 
#define BWIN   2
 
#define SG_FILE   "polynomials.json"
 
#define swp(l, r, b)   this->lwin->set_active(l); this->rwin->set_active(r); this->bwin->set_active(b);
 
#define V_MENU   {::std::string("[ESC] Exit program"), ::std::string("[TAB] Cycle focus"), ::std::string("[E] Add polynomial"), ::std::string("[Q] Remove polynomial"), ::std::string("[SPACE] New operation")}
 
#define V_OPERATION   {::std::string("[ESC] Back"), ::std::string("[TAB] Cycle focus"), ::std::string("[1] Evaluate operation"), ::std::string("[2] Derivative operation"), ::std::string("[3] Integral operation"), ::std::string("[4] Root finding operation"), ::std::string("[5] Drawing operation"), ::std::string("[SPACE] Arithmetic operations")}
 
#define V_SCROLL   {::std::string("[ESC] Exit program"), ::std::string("[UP ARROW] Scroll up"), ::std::string("[DOWN ARROW] Scroll down")}
 
#define swpa(o)   this->active = o; this->terminal->swap_active(o);
 

Enumerations

enum  efc::TokenType {
  efc::T_NUMBER , efc::T_PLUS , efc::T_MINUS , efc::T_MULTIPLICATION ,
  efc::T_DIVISION , efc::T_EOF
}
 Enum with all the possible Token types. More...
 

Functions

int main ()
 The main function that creates the efc::Application instance, runs it and when it finishes it deletes it.
 

Detailed Description

This file contains the text user interface for the emath library.

It contains an efc namespace with all the implementations inside
It comes with the capability to do arithmetic operations with polynomials, parse polynomials,
solve polynomials, evaluate polynomials and graphically represent polynomials.

Definition in file interface.cpp.

Macro Definition Documentation

◆ BWIN

#define BWIN   2

Definition at line 52 of file interface.cpp.

◆ COLOR_ID

#define COLOR_ID   1

Definition at line 39 of file interface.cpp.

◆ CPOSX

#define CPOSX   2

Definition at line 36 of file interface.cpp.

◆ CPOSY

#define CPOSY   1

Definition at line 35 of file interface.cpp.

◆ HPADD

#define HPADD   1

Definition at line 33 of file interface.cpp.

◆ INTERFACE_H

#define INTERFACE_H

Definition at line 9 of file interface.cpp.

◆ KEY_1

#define KEY_1   49

Definition at line 45 of file interface.cpp.

◆ KEY_2

#define KEY_2   50

Definition at line 46 of file interface.cpp.

◆ KEY_3

#define KEY_3   51

Definition at line 47 of file interface.cpp.

◆ KEY_4

#define KEY_4   52

Definition at line 48 of file interface.cpp.

◆ KEY_5

#define KEY_5   53

Definition at line 49 of file interface.cpp.

◆ KEY_E

#define KEY_E   101

Definition at line 43 of file interface.cpp.

◆ KEY_ESC

#define KEY_ESC   27

Definition at line 40 of file interface.cpp.

◆ KEY_Q

#define KEY_Q   113

Definition at line 44 of file interface.cpp.

◆ KEY_SPC

#define KEY_SPC   32

Definition at line 42 of file interface.cpp.

◆ KEY_TAB

#define KEY_TAB   9

Definition at line 41 of file interface.cpp.

◆ LWIN

#define LWIN   0

Definition at line 50 of file interface.cpp.

◆ PSIZE

#define PSIZE   3

Definition at line 37 of file interface.cpp.

◆ RWIN

#define RWIN   1

Definition at line 51 of file interface.cpp.

◆ SG_FILE

#define SG_FILE   "polynomials.json"

Definition at line 53 of file interface.cpp.

◆ TOFST

#define TOFST   2

Definition at line 38 of file interface.cpp.

◆ V_MENU

#define V_MENU   {::std::string("[ESC] Exit program"), ::std::string("[TAB] Cycle focus"), ::std::string("[E] Add polynomial"), ::std::string("[Q] Remove polynomial"), ::std::string("[SPACE] New operation")}

Definition at line 824 of file interface.cpp.

◆ V_OPERATION

#define V_OPERATION   {::std::string("[ESC] Back"), ::std::string("[TAB] Cycle focus"), ::std::string("[1] Evaluate operation"), ::std::string("[2] Derivative operation"), ::std::string("[3] Integral operation"), ::std::string("[4] Root finding operation"), ::std::string("[5] Drawing operation"), ::std::string("[SPACE] Arithmetic operations")}

Definition at line 825 of file interface.cpp.

◆ V_SCROLL

#define V_SCROLL   {::std::string("[ESC] Exit program"), ::std::string("[UP ARROW] Scroll up"), ::std::string("[DOWN ARROW] Scroll down")}

Definition at line 826 of file interface.cpp.

◆ WPADD

#define WPADD   2

Definition at line 34 of file interface.cpp.

Function Documentation

◆ main()

int main ( )

The main function that creates the efc::Application instance, runs it and when it finishes it deletes it.

Returns
Int 0 If the efc::Application did not end abrubtly

Definition at line 1097 of file interface.cpp.

References efc::Application::init(), and efc::Application::run().