Skip to content

Commit 9764a83

Browse files
committed
Update for the rule of 5
1 parent c842d1d commit 9764a83

File tree

6 files changed

+18
-39
lines changed

6 files changed

+18
-39
lines changed

Calculator.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Calculator.h"
22

33

4-
int main(int argc, char** argv)
4+
int main()
55
{
66
std::string folder = "plugins";
77
std::string extension = ".dll";
@@ -20,7 +20,6 @@ int main(int argc, char** argv)
2020
std::cerr << error_message.what() << std::endl;
2121
}
2222
}
23-
2423
return 0;
2524

2625
}

Calculator.h

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ class Calculator
88
std::unique_ptr<Parser> parser;
99
std::string input;
1010
std::string output;
11-
11+
1212
public:
13-
Calculator(const std::string& folder, const std::string& extension) :
13+
Calculator(const std::string& folder, const std::string& extension) :
1414
parser(std::make_unique<Parser>(folder, extension)), input(""), output("") {};
1515

16-
~Calculator() = default;
17-
1816
void setInput(const std::string& input_)
1917
{
2018
input = input_;
@@ -25,4 +23,4 @@ class Calculator
2523
parser->evaluate(output);
2624
}
2725

28-
};
26+
};

Loader.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ class Loader
1616

1717
public:
1818
Loader(const std::string& folder, const std::string& extension) : libraries({}), folder(folder), extension(extension) {};
19+
1920
Loader() = default;
21+
Loader(const Loader&) = default;
22+
Loader(Loader&&) = default;
23+
Loader& operator = (const Loader&) = default;
24+
Loader& operator = (Loader&&) = default;
2025

2126
~Loader()
2227
{
@@ -26,5 +31,4 @@ class Loader
2631
}
2732
void getOperatorFromDll(std::map<std::string, std::unique_ptr<Operator>>& operations, const HINSTANCE& load);
2833
void loadDll(std::map<std::string, std::unique_ptr<Operator>>& operations, const std::string& folder, const std::string& extension);
29-
30-
};
34+
};

Operations.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ class Operations
3131
std::cerr << std::endl << "Folder for extra operations is not download" << std::endl;
3232
};
3333

34+
~Operations() = default;
35+
Operations(const Operations&) = default;
36+
Operations(Operations&&) = default;
37+
Operations& operator = (const Operations&) = default;
38+
Operations& operator = (Operations&&) = default;
39+
3440
int getPriority(const std::string& symbol);
3541
bool getAssociativity(const std::string& symbol);
3642
int getBinary(const std::string& symbol);
3743

3844
double calculation(const std::string& symbol, double a, double b);
39-
~Operations() = default;
40-
4145

42-
};
46+
};

Parser.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class Parser
2929
Parser(const std::string& folder, const std::string& extension) :
3030
operations(std::make_unique<Operations>(folder, extension)) {};
3131

32-
~Parser() = default;
33-
3432
};
3533

3634

35+

README.md

-25
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,6 @@ Output:
3939
14. Result : (11) = 70.9154
4040
```
4141

42-
## Example of input expression
43-
44-
Input:
45-
```
46-
(4! - sin(3.25 + 4^(1+2!) - sin(2.12)) - 9/4) * 3.2
47-
```
48-
49-
Output:
50-
```
51-
1. (4! - sin(3.25 + 4^(1+2!) - sin(2.12)) - 9/4) * 3.2
52-
2. (0) = 4 ! = 24
53-
3. (1) = 2 ! = 2
54-
4. (2) = 1 + (1) = 3
55-
5. (3) = 4 ^ (2) = 64
56-
6. (4) = 3.25 + (3) = 67.25
57-
7. (5) = sin 2.12 = 0.85294
58-
8. (6) = (4) - (5) = 66.3971
59-
9. (7) = sin (6) = -0.411057
60-
10. (8) = (0) - (7) = 24.4111
61-
11. (9) = 9 / 4 = 2.25
62-
12. (10) = (8) - (9) = 22.1611
63-
13. (11) = (10) * 3.2 = 70.9154
64-
14. Result : (11) = 70.9154
65-
```
66-
6742
## Examples of exceptions
6843
```
6944
Input: 2.5!

0 commit comments

Comments
 (0)