~aleteoryx/muditaos

ref: 0823d82e5141f44812c54debf07245d0ca746124 muditaos/module-apps/application-calculator/data/CalculatorUtility.hpp -rw-r--r-- 587 bytes
0823d82e — Radoslaw Wicik [EGD-3743] Update copyrights in fies - add empty line after license 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once
#include <string>

struct Result
{
    std::string equation;
    std::string value;
    bool isError;
};

class Calculator
{
    /// @param from: string which is going to be replaced
    /// @param to: string which is going to replace the old one
    /// @return: new string with replaced all occurrences of given string to the new one in whole input
    std::string replaceAllOccurrences(std::string input, const std::string &from, const std::string &to);
    std::string prepareEquationForParser(std::string input);

  public:
    Result calculate(std::string source);
};