Compare commits

...

2 Commits

6 changed files with 14 additions and 1 deletions
+2
View File
@@ -1,3 +1,5 @@
#pragma once
enum class OpType
{
Addition, Subtraction, Multiplication, Division, Modulo, Special
+2
View File
@@ -1,3 +1,5 @@
#pragma once
#include "Operation.h"
class BaseCalculator
{
+2
View File
@@ -1,3 +1,5 @@
#pragma once
class Command
{
public:
+4 -1
View File
@@ -1,6 +1,7 @@
#include "input_resolver.h"
#include <string>
#include <iostream>
#include <sstream>
#define delimiter " "
@@ -63,7 +64,9 @@ Command resolveCommand()
auto validation_result = validate_token(token);
if (!validation_result.ok())
{
throw std::runtime_error{"invalid token " + validation_result.incorrect_token()};
std::ostringstream os;
os << "invalid token "<< validation_result.incorrect_token();
throw std::runtime_error{os.str()};
}
bool shouldQuit = token.find("q") != token.npos;
+2
View File
@@ -1,2 +1,4 @@
#pragma once
#include "command.h"
Command resolveCommand();
+2
View File
@@ -1,3 +1,5 @@
#pragma once
#include "basecalc.h"
class SpecialCalculator: public BaseCalculator