Milo  0.1
Milo:EquationManipulationProgram
Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
Input Class Reference

#include <milo.h>

Inheritance diagram for Input:
Inheritance graph
[legend]
Collaboration diagram for Input:
Collaboration graph
[legend]

Public Member Functions

Constructor and Virtual Destructor
 Input (Parser &p, Node *parent=nullptr)
 
 Input (Equation &eqn, std::string txt=std::string(), bool current=true, Node *parent=nullptr, bool neg=false, Node::Select s=Node::Select::NONE)
 
 Input (EqnXMLParser &in, Node *parent)
 
 ~Input ()
 Virtual desctructor.
 
Virtual Public Member Functions
std::string toString () const
 
int numFactors () const
 
const std::string & getName () const
 
std::type_index getType () const
 
Helper Public Member functions
bool empty () const
 
void add (char ch)
 
void add (const std::string &s)
 
void remove ()
 
void clear ()
 
const std::string & getBuffer ()
 
bool checkSN (int sn)
 
bool getCurrent ()
 
void setCurrent (bool current)
 
void makeCurrent ()
 
FactorIterator emptyBuffer ()
 
bool unremovable ()
 
- Public Member Functions inherited from Node
void calculateSize (UI::Graphics &gc)
 
void out (XML::Stream &xml)
 
void calculateOrigin (UI::Graphics &gc, int x, int y)
 
void setUpDraw (UI::Graphics &gc)
 
void draw (UI::Graphics &gc) const
 
void setSelect (Select s)
 
Select getSelect () const
 
void setDrawParenthesis (bool fDrawPar)
 
bool getDrawParenthesis () const
 
const Frame & getFrame () const
 
Node * first ()
 
Node * last ()
 
Node * getNextLeft ()
 
Node * getNextRight ()
 
void setParent (Node *parent)
 
Node * getParent () const
 
int getDepth () const
 
int getNth () const
 
void addNth (int n)
 
void multNth (int n)
 
void setNth (int n)
 
void negative ()
 
bool getSign () const
 
Complex getValue () const
 
std::shared_ptr< Node > getSharedPtr ()
 
 Node (Node *parent=nullptr, bool fNeg=false, Select s=NONE)
 
 Node (EqnXMLParser &in, Node *parent)
 
virtual ~Node ()
 Abstract base class needs virtual desctructor.
 
virtual bool isLeaf () const
 
virtual bool isFactor () const
 
virtual Node * findNode (int x, int y)
 
virtual Node * findNode (const Box &b)
 
virtual void normalize ()
 
virtual bool simplify ()
 
virtual bool less (NodePtr b) const
 

Static Public Member Functions

static Input * parse (Parser &p, Node *parent=nullptr)
 
- Static Public Member Functions inherited from Node
static bool createNodeByName (std::string name, Equation &eqn)
 

Static Public Attributes

static const std::string name = "input"
 Name of Input class.
 
static const std::type_index type = typeid(Input)
 Type of Input class.
 
- Static Public Attributes inherited from Node
static const std::vector< std::string > select_tags = { "NONE", "START", "END", "ALL" }
 

Private Member Functions

Virtual Private Member Functions
Frame calcSize (UI::Graphics &gc)
 
void calcOrig (UI::Graphics &gc, int x, int y)
 
void drawNode (UI::Graphics &gc) const
 
Complex getNodeValue () const
 
void xml_out (XML::Stream &xml) const
 

Private Attributes

int m_sn
 Unique serial number of Input class.
 
std::string m_typed
 Stored type characters from keyboard.
 
bool m_current
 True if current active Input class object.
 
Equation & m_eqn
 Equation class object containing this input node.
 
Box m_internal
 Bounding box of Input node.
 

Static Private Attributes

static int input_sn = -1
 Serial number of last created Input node.
 

Additional Inherited Members

- Public Types inherited from Node
enum  Select { NONE, START, END, ALL }
 

Detailed Description

Take input from keyboard and display it on screen. Usually just holds a string of letters and numbers representing a term.

Constructor & Destructor Documentation

Input::Input ( Parser &  p,
Node *  parent = nullptr 
)

Constructor using a text parser for input.

Parameters
pInput parser.
parentParent of this input node.
Input::Input ( Equation &  eqn,
std::string  txt = std::string(),
bool  current = true,
Node *  parent = nullptr,
bool  neg = false,
Node::Select  s = Node::Select::NONE 
)

Constructor directly taking all needed parameters.

Parameters
eqnEquation holding this input.
txtText stored from keyboard.
currentTrue if active.
parentParent node.
negTrue if negative sign.
sSelection state.
Input::Input ( EqnXMLParser &  in,
Node *  parent 
)

Constructor using xml for input

Parameters
inXML input stream.
parentParent of this input node.

Member Function Documentation

void Input::add ( char  ch)
inline

Add charactor to end of input buffer.

Parameters
chCharacter to add to end of buffer.
void Input::add ( const std::string &  s)
inline

Add string to end of input buffer.

Parameters
sString to add to end of buffer.
void Input::calcOrig ( UI::Graphics &  gc,
int  x,
int  y 
)
privatevirtual

Calculate origin of this node offset from the point (x,y) given it.

Parameters
gcGraphics context.
xHorizontal origin.
yVertical origin.

Implements Node.

Node::Frame Input::calcSize ( UI::Graphics &  gc)
privatevirtual

Calculate size of this node in given graphics context.

Parameters
gcGraphics context.
Returns
Return frame containing size of this node.

Implements Node.

bool Input::checkSN ( int  sn)
inline

Check if serial number matches this node.

Parameters
snSerial number to check.
Returns
True if serial number matches.
void Input::clear ( )
inline

Clear input buffer.

void Input::drawNode ( UI::Graphics &  gc) const
privatevirtual

Draw this node in the given graphical context.

Parameters
gcGraphical context.

Implements Node.

bool Input::empty ( ) const
inline

Check if input buffer is empty.

Returns
True if input buffer is empty
FactorIterator Input::emptyBuffer ( )

Parse and empty the conents of the input buffer. Parse the contents of the buffer and insert them before the Input object. Clear the contents of the buffer and return iterator to new position of Input object.

Returns
Iterator to current position of this object.
const std::string& Input::getBuffer ( )
inline

Get input buffer.

Returns
Reference to input buffer.
bool Input::getCurrent ( )
inline

Get state of this node being the active input.

Returns
If true, this is the current input.
const std::string& Input::getName ( ) const
inlinevirtual

Get name of this class.

Returns
Name of this class.

Implements Node.

Complex Input::getNodeValue ( ) const
privatevirtual

Throw an error if this is called.

Returns
Nothing is ever returned.

Implements Node.

std::type_index Input::getType ( ) const
inlinevirtual

Get type of this class.

Returns
Type of this class.

Implements Node.

void Input::makeCurrent ( )
inline

Make this node the current input.

int Input::numFactors ( ) const
inlinevirtual

Get number of factors in this node.

Returns
Number of factors.

Reimplemented from Node.

Input * Input::parse ( Parser &  p,
Node *  parent = nullptr 
)
static

Static helper function to parse Input class. Parser class object should be pointing to a string representation of an input node.

Parameters
pParser class object.
parentParent of return Input class object.
Returns
Newly created Input class object.
void Input::remove ( )
inline

Remove character from end of input buffer.

void Input::setCurrent ( bool  current)
inline

Set state of this node being the active input.

Parameters
currentTrue, if current active input.
string Input::toString ( ) const
virtual

Output text repesentation of input node. If empty output a '?' or a '#' if active. Otherwise '[typed_text]'.

Returns
String containing text representation.

Implements Node.

bool Input::unremovable ( )
inline

Determine if input is to be removed when deactivated. Input nodes that are empy and the only factor in their term should not be removed when deactivated. All others are.

Returns
True if input node should be removed when deactivated.
void Input::xml_out ( XML::Stream &  xml) const
privatevirtual

Output XML of this node.

Parameters
xmlXML output stream.

Implements Node.


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