EMath++
Classes for mathematical concepts
Loading...
Searching...
No Matches
emthp::Parser Class Reference

Class that wraps a std::string and parses it as a Monomial or as a Polynomial. More...

#include <eparser.h>

Public Member Functions

 Parser (const std::string &input) noexcept
 Standalone constructor for the Parser class.
 
Parseroperator= (const Parser &ogn) noexcept
 Assigment operator for when called with an lvalue.
 
emth::Polynomial parse_polynomial () noexcept
 Function that parses the input as a Polynomial.
 
emth::Monomial parse_monomial () noexcept
 Function that parses the next Monomial in the input.
 

Detailed Description

Class that wraps a std::string and parses it as a Monomial or as a Polynomial.

The class consists of two public functions, one for parsing the entire input as a Polynomial and the other for parsing only the next Monomial.

Definition at line 125 of file eparser.h.

Constructor & Destructor Documentation

◆ Parser()

emthp::Parser::Parser ( const std::string &  input)
noexcept

Standalone constructor for the Parser class.

Parameters
inputA const reference to the std::string to parse when needed.

Definition at line 94 of file eparser.cpp.

Member Function Documentation

◆ operator=()

emthp::Parser & emthp::Parser::operator= ( const Parser ogn)
noexcept

Assigment operator for when called with an lvalue.

Parameters
ognThe lvalue Parser object.
Returns
(Parser&) A reference to the lvalue of the operation

Definition at line 100 of file eparser.cpp.

◆ parse_monomial()

emth::Monomial emthp::Parser::parse_monomial ( )
noexcept

Function that parses the next Monomial in the input.

Returns
(emth::Monomial) The next Monomial in the input

Definition at line 113 of file eparser.cpp.

References emth::Monomial::set_coeff(), emth::Monomial::set_degree(), emthp::T_EOF, emthp::T_EXPONENT, emthp::T_MINUS, emthp::T_NUMBER, emthp::T_PLUS, emthp::T_VARIABLE, and emthp::Token::type.

◆ parse_polynomial()

emth::Polynomial emthp::Parser::parse_polynomial ( )
noexcept

Function that parses the input as a Polynomial.

Returns
(emth::Polynomial) The input as a Polynomial

Definition at line 105 of file eparser.cpp.

References emth::Polynomial::push_monomial().


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