From 523ac005077ebf59d5e472bb031c0669454720e5 Mon Sep 17 00:00:00 2001 From: zhao Date: Tue, 20 Jun 2023 21:59:32 +0800 Subject: [PATCH] =?UTF-8?q?1.0.0=20=E7=89=88=E6=9C=AC=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- README-Chinese.md | 183 ++++++++++++++++ README.md | 199 ++++++++++++++++++ ...=> codemodel-v2-7e80536f24c15f75c9fe.json} | 2 +- ...on => index-2023-06-20T12-01-21-0089.json} | 4 +- ...ssion_cpp-Debug-de9e497ce9a268e158d7.json} | 28 ++- cmake-build-debug/.ninja_deps | Bin 28244 -> 285824 bytes cmake-build-debug/.ninja_log | 105 +++++++-- .../Testing/Temporary/LastTest.log | 4 +- cmake-build-debug/build.ninja | 18 +- include/BracketsCalculation.h | 26 ++- include/BracketsCalculationTwo.h | 30 +++ include/CalculationResults.h | 14 +- include/NumberCalculation.h | 2 + include/mathematical_expression.h | 42 +++- src/core/calculation/BracketsCalculation.cpp | 81 +++++-- .../calculation/BracketsCalculationTwo.cpp | 70 ++++++ src/core/calculation/NumberCalculation.cpp | 2 + .../calculation/PrefixExpressionOperation.cpp | 3 + src/core/mathematical_expression.cpp | 12 ++ 20 files changed, 767 insertions(+), 60 deletions(-) rename cmake-build-debug/.cmake/api/v1/reply/{codemodel-v2-6d84c0b554fbbd6d0972.json => codemodel-v2-7e80536f24c15f75c9fe.json} (91%) rename cmake-build-debug/.cmake/api/v1/reply/{index-2023-06-20T07-09-44-0558.json => index-2023-06-20T12-01-21-0089.json} (93%) rename cmake-build-debug/.cmake/api/v1/reply/{target-mathematical_expression_cpp-Debug-fb69ca80b85b0034f92d.json => target-mathematical_expression_cpp-Debug-de9e497ce9a268e158d7.json} (90%) create mode 100644 include/BracketsCalculationTwo.h create mode 100644 src/core/calculation/BracketsCalculationTwo.cpp create mode 100644 src/core/mathematical_expression.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index cc4fc46..d489252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,5 +13,5 @@ add_library( src/core/manager/CalculationManagement.cpp include/CalculationManagement.h src/core/calculation/PrefixExpressionOperation.cpp src/exceptional/MExceptional.cpp include/MExceptional.h - src/utils/NumberUtils.cpp src/utils/StrUtils.cpp src/dataContainer/MEStack.cpp include/MEStack.h include/PrefixExpressionOperation.h src/core/calculation/NumberCalculation.cpp include/NumberCalculation.h src/core/calculation/Calculation.cpp include/Calculation.h include/mathematical_expression.h src/core/calculation/BracketsCalculation.cpp include/BracketsCalculation.h) + src/utils/NumberUtils.cpp src/utils/StrUtils.cpp src/dataContainer/MEStack.cpp include/MEStack.h include/PrefixExpressionOperation.h src/core/calculation/NumberCalculation.cpp include/NumberCalculation.h src/core/calculation/Calculation.cpp include/Calculation.h include/mathematical_expression.h src/core/calculation/BracketsCalculation.cpp include/BracketsCalculation.h src/core/calculation/BracketsCalculationTwo.cpp include/BracketsCalculationTwo.h src/core/mathematical_expression.cpp) diff --git a/README-Chinese.md b/README-Chinese.md index b1f301f..e105ce2 100644 --- a/README-Chinese.md +++ b/README-Chinese.md @@ -5,3 +5,186 @@ ## 介绍 本框架是一种针对数学公式解析的有效工具,能够通过C++的API解析包含嵌套函数,包含函数,数列步长累加等数学公式,返回值是一个数值的结果对象,同时也可以进行比较运算的操作,再进行比较的时候,返回值是一个布尔值结果对象。 +如果您是一位 Java 或 python爱好者,可以专门前往 [JavaAPI](https://github.com/BeardedManZhao/mathematical-expression.git) +或 [PythonAPI](https://github.com/BeardedManZhao/mathematical-expression-Py) 中进行相关资料的查阅。 + +### 如何使用库? + +在项目中有一个 include 文件目录,其中存储的就是库需要的所有头文件,您可以将其中的库文件导入到您的项目中,然后再集成本框架编译好的dll,下面是cmake的配置文件实例。 + +```cmake +cmake_minimum_required(VERSION 3.23) +project(MyCpp) + +set(CMAKE_CXX_STANDARD 14) + +# 设置头文件目录(可以自定义) +include_directories(${PROJECT_SOURCE_DIR}/head) +add_executable(MyCpp main.cpp) +# 与项目进行链接(将库链接到编译之后的目标中) +target_link_libraries(${PROJECT_NAME} D:\\liming\\Project\\Clion\\MyCpp\\cmake-build-debug\\mathematical_expression_cpp.dll) +``` + +集成操作完毕之后,您可以尝试输入以下代码来判断库的功能是否正常,下面是该库的一个测试代码,如果其运行之后的程序main函数返回值为0 +代表程序正常退出,意味着库装载完毕。 + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // 打印 mathematical_expression 的版本信息 + cout << mathematical_expression::getVERSION() << endl; +} +``` + +### 通过 mathematical-expression 库直接获取到计算组件并进行计算 + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // 构建需要计算的两种表达式 + string s1 = "1 + 20 - 2 + 4", s2 = "1 + 20 - (2 + 4)"; + // 获取到 me 门户类 + mathematical_expression me; + // 获取到 无括号表达式计算组件 + ME::PrefixExpressionOperation prefixExpressionOperation = me.getPrefixExpressionOperation(); + // 获取到 有括号表达式计算组件 + ME::BracketsCalculationTwo bracketsCalculationTwo = me.getBracketsCalculation2(); + // 开始检查表达式 + prefixExpressionOperation.check(s1); + bracketsCalculationTwo.check(s2); + // 开始计算两个表达式 可以使用左移运算符将表达式送给计算组件 获取到结果对象 + ME::CalculationNumberResults r1 = prefixExpressionOperation << s1; + ME::CalculationNumberResults r2 = bracketsCalculationTwo << s2; + // 开始进行结果查看 + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r1 << "\t计算来源:" << r1.getCalculationSourceName() << endl; + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r2 << "\t计算来源:" << r1.getCalculationSourceName() << endl; +} +``` + +- 运行结果 + +``` +Active code page: 65001 +计算层数:1 计算结果:23 计算来源:PrefixExpressionOperation +计算层数:1 计算结果:15 计算来源:PrefixExpressionOperation + +进程已结束,退出代码0 +``` + +## 框架架构 + +### 门户类 + +我们可以通过指定的门户类对象获取到相关的各个计算组件,这里与 JavaAPI 和 PythonAPI 的实现有些不同,这里是使用的get函数获取到指定计算组件对象,而非使用 +Hash 缓冲池。 + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // 获取到 me 门户类 + mathematical_expression me; + // 获取到 无括号表达式计算组件 + ME::PrefixExpressionOperation prefixExpressionOperation = me.getPrefixExpressionOperation(); + // 获取到 有括号表达式计算组件 + ME::BracketsCalculationTwo bracketsCalculationTwo = me.getBracketsCalculation2(); +} +``` + +## 计算组件 + +### 无括号表达式 + +- 类组件:core.calculation.number.PrefixExpressionOperation +- 介绍 + + 针对一个没有括号,但是有加减乘除以及取余等运算操作的数学表达式而设计的组件,该组件可以实现带有优先级计算的功能,其中通过前缀表达式解析计算,将操作数与操作符一同存储到栈,在存储的同时配有计算优先级比较,如果当下的优先级较小,就先将上一个操作数与操作符与当前操作数进行运算,形成一个新的数值,然后再入栈。 +- API使用示例 + + 该组件支持的运算符有: a+b a-b a*b a/b a%b + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // 获取到 me 门户类 + mathematical_expression me; + // 获取到 无括号表达式计算组件 + ME::PrefixExpressionOperation prefixExpressionOperation = me.getPrefixExpressionOperation(); + // 构建一个表达式 + string s = "1 + 2 + 4 * 10 - 3"; + // 开始检查表达式 + prefixExpressionOperation.check(s); + // 开始计算两个表达式 可以使用左移运算符将表达式送给计算组件 获取到结果对象 + ME::CalculationNumberResults r1 = prefixExpressionOperation << s; + // 开始进行结果查看 + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r1 << "\t计算来源:" << r1.getCalculationSourceName() << endl; +} +``` + +- 运行结果 + + 在API调用中,对函数的运行结果进行了打印,可以看到,组件计算的返回值是一个结果集对象,在该对象中存储的就是很多有关计算结果相关的信息。 + +``` +Active code page: 65001 +计算层数:1 计算结果:40 计算来源:PrefixExpressionOperation + +进程已结束,退出代码0 +``` + +### 嵌套括号表达式 + +- 类组件:core.calculation.number.BracketsCalculation2 +- 介绍: + + 嵌套括号表达式解析组件,能够针对带有多个括号的数学表达式进行解析与结果计算,针对嵌套括号进行优先级的解析与计算,该组件依赖于“core.calculation.number.PrefixExpressionOperation”,在该组件中采用递归进行括号的解析,然后将最内层面的表达式提供给“core.calculation.number.PrefixExpressionOperation”进行计算。 +- API使用示例 + + 该组件支持的运算符有: a+b a-b a*b a/b a%b ( ) + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // 获取到 me 门户类 + mathematical_expression me; + // 获取到 无括号表达式计算组件 + ME::BracketsCalculationTwo bracketsCalculationTwo = me.getBracketsCalculation2(); + // 构建一个表达式 + string s = "1 + 2 + 4 * (10 - 3)"; + // 开始检查表达式 + bracketsCalculationTwo.check(s); + // 开始计算两个表达式 可以使用左移运算符将表达式送给计算组件 获取到结果对象 + ME::CalculationNumberResults r1 = bracketsCalculationTwo << s; + // 开始进行结果查看 + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r1 << "\t计算来源:" << r1.getCalculationSourceName() << endl; +} +``` + +- 运行结果 + + 在API调用中,对表达式的计算结果进行了打印,可以看到,组件计算的返回值是一个数值结果对象,在该对象中存储的就是很多有关计算结果相关的信息。 + +``` +Active code page: 65001 +计算层数:2 计算结果:31 计算来源:BracketsCalculation + +进程已结束,退出代码0 +``` + +
+ +更多信息 + +- date: 2023-06-20 +- Switch to [English Document](https://github.com/BeardedManZhao/mathematical-expression/blob/main/README.md) +- [mathematical-expression-Java](https://github.com/BeardedManZhao/mathematical-expression.git) +- [mathematical-expression-py](https://github.com/BeardedManZhao/mathematical-expression-Py) diff --git a/README.md b/README.md index 1e68a92..ec36291 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,202 @@ ## introduce +This framework is an effective tool for Formula parsing. It can parse Formula including nested functions, including +functions, and sequence step accumulation through the C++API. The return value is a numerical result object. At the same +time, you can also perform comparison operations. When you compare again, the return value is a Boolean result object. +If you are a Java or Python enthusiast, you can specifically +visit [JavaAPI](https://github.com/BeardedManZhao/mathematical-expression.git) +Or [Python API](https://github.com/BeardedManZhao/mathematical-expression-Py) Search for relevant information in. + +### How to use the library? + +There is an include file directory in the project, where all the Header file required by the library are stored. You can +import the library files into your project, and then assemble the dll compiled by this framework. The following is an +example of the configuration file for cmake. + +```cmake +cmake_minimum_required(VERSION 3.23) +project(MyCpp) + +set(CMAKE_CXX_STANDARD 14) + +# Set Header file directory (can be customized) +include_directories(${PROJECT_SOURCE_DIR}/include) +add_executable(MyCpp main.cpp) +# Link to the project (link the library to the compiled target) +target_link_libraries(${PROJECT_NAME} D:\\liming\\Project\\Clion\\MyCpp\\cmake-build-debug\\mathematical_expression_cpp.dll) +``` + +After the integration operation is completed, you can try to enter the following code to determine whether the function +of the library is normal. The following is a test code of the library. If the return value of the main function of the +program after it runs is 0, it means the program exits normally, which means the library is loaded. + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // 打印 mathematical_expression 的版本信息 + cout << mathematical_expression::getVERSION() << endl; +} +``` + +### Obtain calculation components directly through the mathematical expression library and perform calculations + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // Build two expressions that need to be evaluated + string s1 = "1 + 20 - 2 + 4", s2 = "1 + 20 - (2 + 4)"; + // Obtain me portal class + mathematical_expression me; + // Obtaining an expression evaluation component without parentheses + ME::PrefixExpressionOperation prefixExpressionOperation = me.getPrefixExpressionOperation(); + // Obtaining parenthesized expression evaluation component + ME::BracketsCalculationTwo bracketsCalculationTwo = me.getBracketsCalculation2(); + // + prefixExpressionOperation.check(s1); + bracketsCalculationTwo.check(s2); + // To start calculating two expressions, you can use the left shift operator to send the expression to the calculation component and obtain the result object + ME::CalculationNumberResults r1 = prefixExpressionOperation << s1; + ME::CalculationNumberResults r2 = bracketsCalculationTwo << s2; + // Start viewing results + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r1 << "\t计算来源:" << r1.getCalculationSourceName() << endl; + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r2 << "\t计算来源:" << r1.getCalculationSourceName() << endl; +} +``` + +- Running results + +``` +Active code page: 65001 +计算层数:1 计算结果:23 计算来源:PrefixExpressionOperation +计算层数:1 计算结果:15 计算来源:PrefixExpressionOperation + +进程已结束,退出代码0 +``` + +## Framework architecture + +### Portal class + +We can obtain the relevant computing components through the specified portal class object, which is slightly different +from the implementation of Java API and Python API. Here, we use the get function to obtain the specified computing +component object, rather than using a hash buffer pool. + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // Obtain me portal class + mathematical_expression me; + // Obtaining an expression evaluation component without parentheses + ME::PrefixExpressionOperation prefixExpressionOperation = me.getPrefixExpressionOperation(); + // Obtaining parenthesized expression evaluation component + ME::BracketsCalculationTwo bracketsCalculationTwo = me.getBracketsCalculation2(); +} +``` + +## Computing Components + +### Parenthesis free expression + +- Class component:ME::PrefixExpressionOperation + +- Introduction + A component designed for a mathematical expression without parentheses, but with operations such as addition, + subtraction, multiplication, division, and remainder. This component can implement a function with priority + calculation. Through prefix expression parsing and calculation, the operand and operator are stored on the stack, and + at the same time, there is a calculation priority comparison. If the current priority is smaller, Just perform an + operation on the previous operand and operator with the current operand to form a new value, and then push it onto the + stack. + +- API usage examples + The operators supported by this component are: a+b a-b a * b a/b a% b + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // Obtain me portal class + mathematical_expression me; + // Obtaining an expression evaluation component without parentheses + ME::PrefixExpressionOperation prefixExpressionOperation = me.getPrefixExpressionOperation(); + // 构建一个表达式 + string s = "1 + 2 + 4 * 10 - 3"; + // Start checking expression + prefixExpressionOperation.check(s); + // To start calculating two expressions, you can use the left shift operator to send the expression to the calculation component and obtain the result object + ME::CalculationNumberResults r1 = prefixExpressionOperation << s; + // Start viewing results + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r1 << "\t计算来源:" << r1.getCalculationSourceName() << endl; +} +``` + +- Running results + + In the API call, the Running results of the function were printed, and it can be seen that the return value calculated + by the component is a result set object, which stores a lot of information related to the calculation results. + +``` +Active code page: 65001 +计算层数:1 计算结果:40 计算来源:PrefixExpressionOperation + +进程已结束,退出代码0 +``` + +### 嵌套括号表达式 + +- Class component:ME::BracketsCalculationTwo +- 介绍: + + 嵌套括号表达式解析组件,能够针对带有多个括号的数学表达式进行解析与结果计算,针对嵌套括号进行优先级的解析与计算,该组件依赖于“core.calculation.number.PrefixExpressionOperation”,在该组件中采用递归进行括号的解析,然后将最内层面的表达式提供给“core.calculation.number.PrefixExpressionOperation”进行计算。 +- API使用示例 + + 该组件支持的运算符有: a+b a-b a*b a/b a%b ( ) + +```c++ +#include "mathematical_expression.h" + +int main(){ + system("chcp 65001"); + // Obtain me portal class + mathematical_expression me; + // Obtaining an expression evaluation component without parentheses + ME::BracketsCalculationTwo bracketsCalculationTwo = me.getBracketsCalculation2(); + // Build an expression + string s = "1 + 2 + 4 * (10 - 3)"; + // Start checking expression + bracketsCalculationTwo.check(s); + // To start calculating two expressions, you can use the left shift operator to send the expression to the calculation component and obtain the result object + ME::CalculationNumberResults r1 = bracketsCalculationTwo << s; + // Start viewing results + cout << "计算层数:" << r1.getResultLayers() << "\t计算结果:" << r1 << "\t计算来源:" << r1.getCalculationSourceName() << endl; +} +``` + +- Running results + + In the API call, the Running results of the function were printed, and it can be seen that the return value calculated + by the component is a result set object, which stores a lot of information related to the calculation results. + +``` +Active code page: 65001 +计算层数:2 计算结果:31 计算来源:BracketsCalculation + +进程已结束,退出代码0 +``` + +
+ +更多信息 + +- date: 2023-06-20 +- 切换至 [中文文档](https://github.com/BeardedManZhao/mathematical-expression/blob/main/README-Chinese.md) +- [mathematical-expression-Java](https://github.com/BeardedManZhao/mathematical-expression.git) +- [mathematical-expression-py](https://github.com/BeardedManZhao/mathematical-expression-Py) + diff --git a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-6d84c0b554fbbd6d0972.json b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-7e80536f24c15f75c9fe.json similarity index 91% rename from cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-6d84c0b554fbbd6d0972.json rename to cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-7e80536f24c15f75c9fe.json index ee0d151..11739b6 100644 --- a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-6d84c0b554fbbd6d0972.json +++ b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-7e80536f24c15f75c9fe.json @@ -39,7 +39,7 @@ { "directoryIndex" : 0, "id" : "mathematical_expression_cpp::@6890427a1f51a3e7e1df", - "jsonFile" : "target-mathematical_expression_cpp-Debug-fb69ca80b85b0034f92d.json", + "jsonFile" : "target-mathematical_expression_cpp-Debug-de9e497ce9a268e158d7.json", "name" : "mathematical_expression_cpp", "projectIndex" : 0 } diff --git a/cmake-build-debug/.cmake/api/v1/reply/index-2023-06-20T07-09-44-0558.json b/cmake-build-debug/.cmake/api/v1/reply/index-2023-06-20T12-01-21-0089.json similarity index 93% rename from cmake-build-debug/.cmake/api/v1/reply/index-2023-06-20T07-09-44-0558.json rename to cmake-build-debug/.cmake/api/v1/reply/index-2023-06-20T12-01-21-0089.json index 686e05e..bbed4b9 100644 --- a/cmake-build-debug/.cmake/api/v1/reply/index-2023-06-20T07-09-44-0558.json +++ b/cmake-build-debug/.cmake/api/v1/reply/index-2023-06-20T12-01-21-0089.json @@ -26,7 +26,7 @@ "objects" : [ { - "jsonFile" : "codemodel-v2-6d84c0b554fbbd6d0972.json", + "jsonFile" : "codemodel-v2-7e80536f24c15f75c9fe.json", "kind" : "codemodel", "version" : { @@ -86,7 +86,7 @@ }, "codemodel-v2" : { - "jsonFile" : "codemodel-v2-6d84c0b554fbbd6d0972.json", + "jsonFile" : "codemodel-v2-7e80536f24c15f75c9fe.json", "kind" : "codemodel", "version" : { diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-mathematical_expression_cpp-Debug-fb69ca80b85b0034f92d.json b/cmake-build-debug/.cmake/api/v1/reply/target-mathematical_expression_cpp-Debug-de9e497ce9a268e158d7.json similarity index 90% rename from cmake-build-debug/.cmake/api/v1/reply/target-mathematical_expression_cpp-Debug-fb69ca80b85b0034f92d.json rename to cmake-build-debug/.cmake/api/v1/reply/target-mathematical_expression_cpp-Debug-de9e497ce9a268e158d7.json index 45fdc65..de3b1de 100644 --- a/cmake-build-debug/.cmake/api/v1/reply/target-mathematical_expression_cpp-Debug-fb69ca80b85b0034f92d.json +++ b/cmake-build-debug/.cmake/api/v1/reply/target-mathematical_expression_cpp-Debug-de9e497ce9a268e158d7.json @@ -87,7 +87,9 @@ 11, 14, 16, - 19 + 19, + 21, + 23 ] } ], @@ -129,7 +131,9 @@ 11, 14, 16, - 19 + 19, + 21, + 23 ] }, { @@ -146,7 +150,8 @@ 15, 17, 18, - 20 + 20, + 22 ] } ], @@ -266,6 +271,23 @@ "backtrace" : 1, "path" : "include/BracketsCalculation.h", "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/core/calculation/BracketsCalculationTwo.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "path" : "include/BracketsCalculationTwo.h", + "sourceGroupIndex" : 1 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/core/mathematical_expression.cpp", + "sourceGroupIndex" : 0 } ], "type" : "SHARED_LIBRARY" diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 4f215524428872b284781e748d1d6b4ff686061b..c6d56be874038354e6f47b78a85bdc61f75b8ba8 100644 GIT binary patch delta 15642 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 VMlt>L;3^n!Oo^Wtk<&9w{|BBkXWIY( delta 149 zcmZqJDR|`$dWHITPEDw>}`LeU--;Hw&c4FtR4?NCnCjX5=%m xN%toK<+lI($asu#@|v6ztjc-9{OcxH<{lRjU|?u?#=yX^>?=?NX#H~_8vq!?I9&h$ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index 4ca57ea..38e29a1 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -1,14 +1,93 @@ # ninja log v5 -3611 5307 7089299093397978 libmathematical_expression_cpp.dll d1b9feb7337dec20 -3611 5307 7089299093397978 libmathematical_expression_cpp.dll.a d1b9feb7337dec20 -33 837 7089299048717140 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 -0 15 0 clean d89ebacede60e116 -17 3611 7089299076337510 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a -495 928 7089299049663397 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 -7 672 7089299047095601 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 -13 495 7089299045281272 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 -115 652 7089299046905954 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 -120 631 7089299046698779 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 -0 227 7089481845205276 build.ninja d0b2cba23a09252f -23 114 7089299041512995 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a -28 119 7089299041547686 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +3443 6227 7089720074288156 libmathematical_expression_cpp.dll 2c8bdf5ed1ee9701 +381 1126 7089720023281528 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 +3443 6227 7089720074288156 libmathematical_expression_cpp.dll.a 2c8bdf5ed1ee9701 +11 3315 7089720045175658 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a +0 11 0 clean 34793d755d65561a +431 959 7089720021224777 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 +8 381 7089720015819287 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 +5 607 7089720017753060 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 +20 430 7089720016265355 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 +607 3137 7089720043399761 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj b70a71edf49c2e1 +63 481 7089720016642065 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 +0 227 7089656810557089 build.ninja d0b2cba23a09252f +14 63 7089720012717595 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a +17 448 7089720016409387 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +448 3443 7089720046448132 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj 8022348c09ad224a +481 3044 7089720042478499 CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj 4562fbbd066a4849 +0 10 0 clean 34793d755d65561a +15 75 7089721343449552 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a +11 446 7089721346946351 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 +22 455 7089721347154902 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 +18 482 7089721347373978 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +75 535 7089721347708295 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 +5 708 7089721349304470 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 +482 963 7089721352193449 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 +446 1149 7089721354167227 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 +535 3212 7089721374735366 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj b70a71edf49c2e1 +708 3263 7089721375262181 CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj 4562fbbd066a4849 +8 3442 7089721377043296 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a +455 3525 7089721377894006 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj 8022348c09ad224a +3525 6315 7089721405791349 libmathematical_expression_cpp.dll 2c8bdf5ed1ee9701 +3525 6315 7089721405791349 libmathematical_expression_cpp.dll.a 2c8bdf5ed1ee9701 +0 13 0 clean 34793d755d65561a +7 56 7089722154114466 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a +9 439 7089722157290059 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 +14 453 7089722157906226 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 +18 511 7089722158503002 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +56 554 7089722158670970 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 +4 593 7089722159115915 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 +453 827 7089722161807469 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 +439 1052 7089722164064378 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 +554 2937 7089722182862109 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj b70a71edf49c2e1 +593 2973 7089722183252107 CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj 4562fbbd066a4849 +11 3164 7089722185129987 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a +511 3295 7089722186442863 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj 8022348c09ad224a +3295 6125 7089722214744891 libmathematical_expression_cpp.dll 2c8bdf5ed1ee9701 +3295 6125 7089722214744891 libmathematical_expression_cpp.dll.a 2c8bdf5ed1ee9701 +0 11 0 clean 34793d755d65561a +18 103 7089723048004349 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a +10 463 7089723051651673 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 +27 548 7089723052404997 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 +23 576 7089723052754445 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +104 651 7089723053464461 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 +6 686 7089723053754100 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 +548 866 7089723055702103 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 +463 1063 7089723057664313 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 +687 2807 7089723075056480 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj b70a71edf49c2e1 +651 2896 7089723075953720 CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj 4562fbbd066a4849 +14 3094 7089723077918481 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a +576 3231 7089723079299872 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj 8022348c09ad224a +3231 6023 7089723107197579 libmathematical_expression_cpp.dll 2c8bdf5ed1ee9701 +3231 6023 7089723107197579 libmathematical_expression_cpp.dll.a 2c8bdf5ed1ee9701 +0 17 0 clean 34793d755d65561a +12 64 7089724064143003 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a +10 446 7089724067872732 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 +19 509 7089724068084453 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 +4 625 7089724069631566 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 +65 675 7089724070083161 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +15 684 7089724070163154 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 +447 1006 7089724073215676 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 +625 1019 7089724073486433 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 +676 3043 7089724093868247 CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj 4562fbbd066a4849 +685 3112 7089724094546026 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj b70a71edf49c2e1 +7 3346 7089724096888539 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a +509 3440 7089724097820994 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj 8022348c09ad224a +3440 6233 7089724125769444 libmathematical_expression_cpp.dll 2c8bdf5ed1ee9701 +3440 6233 7089724125769444 libmathematical_expression_cpp.dll.a 2c8bdf5ed1ee9701 +1 14 0 clean 34793d755d65561a +9 58 7089724707732723 CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj 1b9abf3e3487eb9a +7 415 7089724711201323 CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj ffab181a5b901ce8 +15 475 7089724711588023 CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj 6749be0fdab379e1 +18 501 7089724711701981 CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj 3c6fa15b8eb9ea39 +3 633 7089724713042270 CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj 57aa060842d0a313 +59 653 7089724713491359 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj 47f603a81c0f0c68 +475 1052 7089724717230241 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj f1c5978a3b4dd467 +415 1299 7089724720002094 CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj deebcf13c45868e2 +654 3433 7089724741421590 CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj 4562fbbd066a4849 +633 3445 7089724741541583 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj b70a71edf49c2e1 +12 3634 7089724743415197 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj 770700c4540eed4a +501 3763 7089724744696735 CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj 8022348c09ad224a +3763 6640 7089724773464236 libmathematical_expression_cpp.dll 2c8bdf5ed1ee9701 +3763 6640 7089724773464236 libmathematical_expression_cpp.dll.a 2c8bdf5ed1ee9701 +0 11 0 clean 34793d755d65561a diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 8c915e2..2307dae 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Jun 20 15:09 ?D1??? +Start testing: Jun 20 21:59 ?D1??? ---------------------------------------------------------- -End testing: Jun 20 15:09 ?D1??? +End testing: Jun 20 21:59 ?D1??? diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja index 2f756c4..f28beb8 100644 --- a/cmake-build-debug/build.ninja +++ b/cmake-build-debug/build.ninja @@ -129,6 +129,22 @@ build CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCa OBJECT_DIR = CMakeFiles\mathematical_expression_cpp.dir OBJECT_FILE_DIR = CMakeFiles\mathematical_expression_cpp.dir\src\core\calculation +build CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj: CXX_COMPILER__mathematical_expression_cpp_Debug D$:/MyGithub/mathematical-expression-cpp/src/core/calculation/BracketsCalculationTwo.cpp || cmake_object_order_depends_target_mathematical_expression_cpp + DEFINES = -Dmathematical_expression_cpp_EXPORTS + DEP_FILE = CMakeFiles\mathematical_expression_cpp.dir\src\core\calculation\BracketsCalculationTwo.cpp.obj.d + FLAGS = -g -std=gnu++11 + INCLUDES = -ID:/MyGithub/mathematical-expression-cpp/include + OBJECT_DIR = CMakeFiles\mathematical_expression_cpp.dir + OBJECT_FILE_DIR = CMakeFiles\mathematical_expression_cpp.dir\src\core\calculation + +build CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj: CXX_COMPILER__mathematical_expression_cpp_Debug D$:/MyGithub/mathematical-expression-cpp/src/core/mathematical_expression.cpp || cmake_object_order_depends_target_mathematical_expression_cpp + DEFINES = -Dmathematical_expression_cpp_EXPORTS + DEP_FILE = CMakeFiles\mathematical_expression_cpp.dir\src\core\mathematical_expression.cpp.obj.d + FLAGS = -g -std=gnu++11 + INCLUDES = -ID:/MyGithub/mathematical-expression-cpp/include + OBJECT_DIR = CMakeFiles\mathematical_expression_cpp.dir + OBJECT_FILE_DIR = CMakeFiles\mathematical_expression_cpp.dir\src\core + # ============================================================================= # Link build statements for SHARED_LIBRARY target mathematical_expression_cpp @@ -137,7 +153,7 @@ build CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCa ############################################# # Link the shared library libmathematical_expression_cpp.dll -build libmathematical_expression_cpp.dll libmathematical_expression_cpp.dll.a: CXX_SHARED_LIBRARY_LINKER__mathematical_expression_cpp_Debug CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj +build libmathematical_expression_cpp.dll libmathematical_expression_cpp.dll.a: CXX_SHARED_LIBRARY_LINKER__mathematical_expression_cpp_Debug CMakeFiles/mathematical_expression_cpp.dir/src/core/container/CalculationResults.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/manager/CalculationManagement.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/PrefixExpressionOperation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/exceptional/MExceptional.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/utils/NumberUtils.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/utils/StrUtils.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/dataContainer/MEStack.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/NumberCalculation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/Calculation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculation.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/calculation/BracketsCalculationTwo.cpp.obj CMakeFiles/mathematical_expression_cpp.dir/src/core/mathematical_expression.cpp.obj LANGUAGE_COMPILE_FLAGS = -g LINK_LIBRARIES = -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 OBJECT_DIR = CMakeFiles\mathematical_expression_cpp.dir diff --git a/include/BracketsCalculation.h b/include/BracketsCalculation.h index f511bf6..39a9201 100644 --- a/include/BracketsCalculation.h +++ b/include/BracketsCalculation.h @@ -7,6 +7,7 @@ #include #include "PrefixExpressionOperation.h" +#include "ConstantRegion.h" namespace ME { @@ -19,18 +20,31 @@ namespace ME { * * @author zhao */ - class BracketsCalculation : public PrefixExpressionOperation { + class BracketsCalculation : public Calculation { public: string formatStr(std::string string) override; - /** - * 计算一个带有两个操作数 一个操作符的计算公式的结果 + void check(std::string string) override; + + string getName() override; + + virtual /** + * 计算一个数学表达式,并将计算细节与计算结果存储到数值结果集中。 + *

+ * Compute a mathematical expression and store the calculation details and results in the numerical result set. * - * @param BinaryFormula 公式 例如 1 + 2 - * @return 计算结果数值 + * @param Formula 被计算的表达式,要求返回值是一个数值。 + *

+ * The returned value of the evaluated expression is required to be a numeric value. + * @param formatRequired 是否需要被格式化,用于确保公式格式正确。 + *

+ * Whether it needs to be formatted to ensure that the formula format is correct. + * @return 数值结果集对象,其中保存着每一步的操作数据,以及最终结果数值 + *

+ * Numerical result set object, which stores the operation data of each step and the final result value */ - static double calculation2(std::string Formula); + CalculationNumberResults calculation(std::string Formula, bool formatRequired) = 0; }; } diff --git a/include/BracketsCalculationTwo.h b/include/BracketsCalculationTwo.h new file mode 100644 index 0000000..2e265cb --- /dev/null +++ b/include/BracketsCalculationTwo.h @@ -0,0 +1,30 @@ +// +// Created by Liming on 2023/6/20. +// + +#ifndef MATHEMATICAL_EXPRESSION_CPP_BRACKETSCALCULATIONTWO_H +#define MATHEMATICAL_EXPRESSION_CPP_BRACKETSCALCULATIONTWO_H + +#include "regex" +#include "BracketsCalculation.h" + +namespace ME { + class BracketsCalculationTwo : public BracketsCalculation { + + public: + string formatStr(std::string string) override; + + void check(std::string string) override; + + ME::CalculationNumberResults operator>>(std::string &format); + + ME::CalculationNumberResults operator<<(std::string &format); + + string getName() override; + + CalculationNumberResults calculation(std::string Formula, bool formatRequired) override; + }; +} + + +#endif //MATHEMATICAL_EXPRESSION_CPP_BRACKETSCALCULATIONTWO_H diff --git a/include/CalculationResults.h b/include/CalculationResults.h index 51f4b29..ed8ce80 100644 --- a/include/CalculationResults.h +++ b/include/CalculationResults.h @@ -202,10 +202,6 @@ namespace ME { size_t operator()(const CalculationBooleanResults &person) const; }; - ostream &operator<<(ostream &out, const CalculationBooleanResults *rhs); - - ostream &operator<<(ostream &out, const CalculationBooleanResults &rhs); - CalculationNumberResults operator+(CalculationNumberResults v1, CalculationNumberResults v2); CalculationNumberResults operator-(CalculationNumberResults v1, CalculationNumberResults v2); @@ -217,10 +213,14 @@ namespace ME { CalculationNumberResults operator<<(CalculationNumberResults v1, CalculationNumberResults v2); CalculationNumberResults operator>>(CalculationNumberResults v1, CalculationNumberResults v2); +} - ostream &operator<<(ostream &out, const CalculationNumberResults *rhs); +ostream &operator<<(ostream &out, const ME::CalculationBooleanResults *rhs); - ostream &operator<<(ostream &out, const CalculationNumberResults &rhs); -} +ostream &operator<<(ostream &out, const ME::CalculationBooleanResults &rhs); + +ostream &operator<<(ostream &out, const ME::CalculationNumberResults *rhs); + +ostream &operator<<(ostream &out, const ME::CalculationNumberResults &rhs); #endif //MATHEMATICAL_EXPRESSION_CPP_CALCULATIONRESULTS_H diff --git a/include/NumberCalculation.h b/include/NumberCalculation.h index 3cedef3..a4110cd 100644 --- a/include/NumberCalculation.h +++ b/include/NumberCalculation.h @@ -26,6 +26,8 @@ class NumberCalculation : public Calculation { */ virtual ME::CalculationNumberResults calculation(std::string Formula, bool formatRequired) = 0; +private: + virtual /** * 计算一个数学表达式,并将计算细节与计算结果存储到数值结果集中。 *

diff --git a/include/mathematical_expression.h b/include/mathematical_expression.h index 4c2300f..eb2c954 100644 --- a/include/mathematical_expression.h +++ b/include/mathematical_expression.h @@ -6,11 +6,47 @@ #define MATHEMATICAL_EXPRESSION_CPP_MATHEMATICAL_EXPRESSION_H #include "PrefixExpressionOperation.h" +#include "BracketsCalculationTwo.h" -namespace ME { - PrefixExpressionOperation prefixExpressionOperation; +#define VERSION "1.0.0-mathematical_expression-C++"; -} +/** + * 数学表达式解析计算库中的门户类,由该类获取到数学表达式计算库中的相关数据对象。 + * + * The portal class in the mathematical expression analysis and calculation library, which obtains the relevant data objects in the mathematical expression calculation library. + */ +class mathematical_expression { +protected: + ME::PrefixExpressionOperation prefixExpressionOperation; + ME::BracketsCalculationTwo bracketsCalculation2; +public: + + /** + * + * @return 此库的版本信息。 + * + * The version information of this library. + */ + static string getVERSION() { + return VERSION + } + + /** + * + * @return 无括号表达式计算组件对象。 + * + * An expression without parentheses evaluates a component object. + */ + ME::PrefixExpressionOperation getPrefixExpressionOperation(); + + /** + * + * @return 数学表达式计算组件,该组件能够解析并计算一个带有括号的表达式。 + * + * Mathematical expression calculation component, which can parse and evaluate an expression with parentheses. + */ + ME::BracketsCalculationTwo getBracketsCalculation2(); +}; #endif //MATHEMATICAL_EXPRESSION_CPP_MATHEMATICAL_EXPRESSION_H diff --git a/src/core/calculation/BracketsCalculation.cpp b/src/core/calculation/BracketsCalculation.cpp index 60dedb0..9661327 100644 --- a/src/core/calculation/BracketsCalculation.cpp +++ b/src/core/calculation/BracketsCalculation.cpp @@ -13,31 +13,70 @@ namespace ME { return std::regex_replace(string, ME::ALL_INVISIBLE_CHARACTERS_PATTERN, NO_CHAR); } - double BracketsCalculation::calculation2(std::string Formula) { - std::string a; - std::string b; - bool isOk = false; - char Operator = 0; - for (const auto &c: Formula) { - if (!isOk) { - if (StrUtils::IsAnOperator(c)) { - Operator = c; - isOk = true; + string BracketsCalculation::getName() { + return "BracketsCalculation"; + } + + void BracketsCalculation::check(std::string string) { + if (string.empty()) { + throw ME::WrongFormat("您传入的表达式为null 无法进行计算。"); + } + unsigned int lastIndex = string.length() - 1; + // 左括号出现数量 + int LeftCount = 0; + // 右括号出现数量 + int RightCount = 0; + { + char lastChar = string[lastIndex]; + while (lastChar == EMPTY) { + lastChar = string[--lastIndex]; + } + if (!StrUtils::IsANumber(lastChar)) { + if (lastChar != RIGHT_BRACKET) { + throw ME::WrongFormat( + &"您传入的表达式格式有误,最后一个字符不是一个数值!!!\nThe format of the expression you passed in is incorrect. The last character is not a numeric value!!!\nERROR => "[lastChar] + ); + } + } + } + // 上一个字符是否是运算符 + bool is = false; + int index = 0; + for (const auto &c: string) { + if (c == LEFT_BRACKET) { + ++LeftCount; + } else if (c == RIGHT_BRACKET) { + ++RightCount; + } else if (!(StrUtils::IsANumber(c) || c == DECIMAL_POINT || c == EMPTY)) { + if (!StrUtils::IsAnOperator(c)) { + std::string data = "解析表达式的时候出现了未知符号!!!\nUnknown symbol appears when parsing expression!!!\nWrong format => ["; + data += c; + throw ME::WrongFormat(data.append("] from " + string)); } else { - b += c; + if (is && c != MINUS_SIGN && c != PLUS_SIGN) + throw ME::WrongFormat( + "您的数学表达式不正确,缺失了一个运算数值或多出了一个运算符。ERROR => " + string); + is = true; + continue; } - } else { - a += c; } + if (++index > lastIndex) { + break; + } + is = false; } - if (Operator != 0) { - return NumberUtils::calculation( - Operator, StrUtils::stringToDouble(a), StrUtils::stringToDouble(b) - ); - } else { - throw ME::AbnormalOperation("您的公式格式错误,未解析成功,请您检查您的格式哦!\n" + - "The format of your formula is wrong, and it was not parsed successfully. Please check your format!\n" + - "error format => " + Formula); + if (LeftCount != RightCount) { + int absV = abs(LeftCount - RightCount); + std::string data = + "您的格式不正确,出现了数学表达式中不正确的括号对数,请您检查是否缺少或者多出了[" + + to_string(absV); + data + .append(data + "]个括号。\n") + .append("Your format is incorrect. There are incorrect parenthesis logarithms in the mathematical expression. Please check whether [") + .append(to_string(absV)) + .append("] parentheses are missing or extra.\n") + .append("Wrong from [" + string + "]"); + throw ME::WrongFormat(data); } } } diff --git a/src/core/calculation/BracketsCalculationTwo.cpp b/src/core/calculation/BracketsCalculationTwo.cpp new file mode 100644 index 0000000..34a9cf7 --- /dev/null +++ b/src/core/calculation/BracketsCalculationTwo.cpp @@ -0,0 +1,70 @@ +// +// Created by Liming on 2023/6/20. +// + +#include "BracketsCalculationTwo.h" +#include "ConstantRegion.h" + +static ME::PrefixExpressionOperation operation; + +ME::CalculationNumberResults ME::BracketsCalculationTwo::calculation(std::string Formula, bool formatRequired) { + unsigned int length = Formula.length(); + // 公式存储区 + std::string stringBuilder; + // 括号内数据的起始索引 + int start = 0; + bool setok = false; + int layer = 0; + // 括号内的括号均衡数量,为了确定是一对括号 + int count = 0; + for (int i = 0; i < length; i++) { + char aChar = Formula[i]; + if (aChar == LEFT_BRACKET) { + // 如果当前字符是一个左括号,那么说明括号开始了,这个时候需要将起始点记录 + if (!setok) { + setok = true; + start = i + 1; + } + ++count; + } else if (aChar == RIGHT_BRACKET && --count == 0) { + setok = false; + // 如果当前字符是一个右括号,那么就将括号中的字符进行递归计算,计算之后将该参数作为公式的一部分 + CalculationNumberResults calculation = operation.calculation( + Formula.substr(start, i - start + 1), formatRequired + ); + stringBuilder.append(to_string(calculation.getResult())); + ++layer; + } else if (!setok && aChar != EMPTY) { + // 如果不是一个括号就将字符提供给字符串缓冲区 + stringBuilder += aChar; + } + } + // 将此字符串的结果计算出来 + CalculationNumberResults calculationNumberResults = operation.calculation(stringBuilder, + formatRequired); + return { + calculationNumberResults.getResultLayers() + layer, + calculationNumberResults.getResult(), + this->getName() + }; +} + +string ME::BracketsCalculationTwo::formatStr(std::string string) { + return BracketsCalculation::formatStr(string); +} + +void ME::BracketsCalculationTwo::check(std::string string) { + BracketsCalculation::check(string); +} + +string ME::BracketsCalculationTwo::getName() { + return BracketsCalculation::getName(); +} + +ME::CalculationNumberResults ME::BracketsCalculationTwo::operator>>(string &format) { + return this->calculation(format, true); +} + +ME::CalculationNumberResults ME::BracketsCalculationTwo::operator<<(string &format) { + return this->calculation(format, true); +} diff --git a/src/core/calculation/NumberCalculation.cpp b/src/core/calculation/NumberCalculation.cpp index 9dc9e6d..d4ab3ce 100644 --- a/src/core/calculation/NumberCalculation.cpp +++ b/src/core/calculation/NumberCalculation.cpp @@ -2,3 +2,5 @@ // Created by Liming on 2023/6/19. // +#include +#include "NumberCalculation.h" diff --git a/src/core/calculation/PrefixExpressionOperation.cpp b/src/core/calculation/PrefixExpressionOperation.cpp index 94c21e5..42f0e02 100644 --- a/src/core/calculation/PrefixExpressionOperation.cpp +++ b/src/core/calculation/PrefixExpressionOperation.cpp @@ -49,6 +49,9 @@ namespace ME { } is = false; } + } else { + string data = "数学表达式的最后一个字符应是一个数值。\nThe last character of a mathematical expression should be a numeric value.\nERROR => "; + throw WrongFormat(data + lastChar); } } diff --git a/src/core/mathematical_expression.cpp b/src/core/mathematical_expression.cpp new file mode 100644 index 0000000..d8bdb5e --- /dev/null +++ b/src/core/mathematical_expression.cpp @@ -0,0 +1,12 @@ +// +// Created by Liming on 2023/6/20. +// +#include "mathematical_expression.h" + +ME::PrefixExpressionOperation mathematical_expression::getPrefixExpressionOperation() { + return mathematical_expression::prefixExpressionOperation; +} + +ME::BracketsCalculationTwo mathematical_expression::getBracketsCalculation2() { + return mathematical_expression::bracketsCalculation2; +}