diff --git a/include/fintamath/config/Config.hpp b/include/fintamath/config/Config.hpp index 75712109f..a08956ab2 100644 --- a/include/fintamath/config/Config.hpp +++ b/include/fintamath/config/Config.hpp @@ -1,6 +1,6 @@ #pragma once -namespace fintamath { +namespace fintamath::detail { struct Config final { Config(); diff --git a/include/fintamath/core/Cache.hpp b/include/fintamath/core/Cache.hpp index 113a4cc45..3829f60dd 100644 --- a/include/fintamath/core/Cache.hpp +++ b/include/fintamath/core/Cache.hpp @@ -3,7 +3,7 @@ #include #include -namespace fintamath { +namespace fintamath::detail { template class Cache final { diff --git a/include/fintamath/core/Converter.hpp b/include/fintamath/core/Converter.hpp index ca9b9a616..370ad0778 100644 --- a/include/fintamath/core/Converter.hpp +++ b/include/fintamath/core/Converter.hpp @@ -10,6 +10,8 @@ namespace fintamath { class IMathObject; +namespace detail { + class Converter final { template To, std::derived_from From> using ConverterFunction = std::function(const To &to, const From &from)>; @@ -34,9 +36,11 @@ class Converter final { static ConverterMultiMethod &getConverter(); }; +} + template To, std::derived_from From> std::unique_ptr convert(const To &to, const From &from) { - return cast(Converter::convert(to, from)); + return cast(detail::Converter::convert(to, from)); } template To, std::derived_from From> @@ -47,13 +51,13 @@ std::unique_ptr convert(const From &from) { template To, std::derived_from From> bool isConvertible(const To &to, const From &from) { - return Converter::isConvertible(to, from); + return detail::Converter::isConvertible(to, from); } template To, std::derived_from From> bool isConvertible(const From &from) { static const To to; - return Converter::isConvertible(to, from); + return detail::Converter::isConvertible(to, from); } } diff --git a/include/fintamath/core/IArithmetic.hpp b/include/fintamath/core/IArithmetic.hpp index 806470d19..a2af15782 100644 --- a/include/fintamath/core/IArithmetic.hpp +++ b/include/fintamath/core/IArithmetic.hpp @@ -13,7 +13,7 @@ namespace fintamath { class IArithmetic : public IMathObject { - using ArithmeticParser = Parser()>; + using ArithmeticParser = detail::Parser()>; public: friend std::unique_ptr operator+(const IArithmetic &lhs, const IArithmetic &rhs) { diff --git a/include/fintamath/core/IComparable.hpp b/include/fintamath/core/IComparable.hpp index e3ab55292..5b1698d50 100644 --- a/include/fintamath/core/IComparable.hpp +++ b/include/fintamath/core/IComparable.hpp @@ -14,7 +14,7 @@ namespace fintamath { class IComparable : public IArithmetic { - using ComparableParser = Parser()>; + using ComparableParser = detail::Parser()>; public: friend std::strong_ordering operator<=>(const IComparable &lhs, const IComparable &rhs) { diff --git a/include/fintamath/core/IMathObject.hpp b/include/fintamath/core/IMathObject.hpp index cec983392..17ab94ecb 100644 --- a/include/fintamath/core/IMathObject.hpp +++ b/include/fintamath/core/IMathObject.hpp @@ -14,7 +14,7 @@ namespace fintamath { class IMathObject { - using MathObjectParser = Parser()>; + using MathObjectParser = detail::Parser()>; public: virtual ~IMathObject() = default; diff --git a/include/fintamath/core/MathObjectTypes.hpp b/include/fintamath/core/MathObjectTypes.hpp index 3946c68aa..caea9df95 100644 --- a/include/fintamath/core/MathObjectTypes.hpp +++ b/include/fintamath/core/MathObjectTypes.hpp @@ -194,13 +194,15 @@ class MathObjectType final { size_t id; private: - [[maybe_unused]] inline static const Config config; + [[maybe_unused]] inline static const detail::Config config; }; inline size_t hash_value(const MathObjectType &rhs) noexcept { return boost::hash{}(rhs); } +namespace detail { + class MathObjectBoundTypes final { using enum MathObjectType::Id; @@ -236,8 +238,10 @@ class MathObjectBoundTypes final { } }; +} + inline bool isBaseOf(const MathObjectType &toType, const MathObjectType &fromType) { - const auto &typeToTypeMap = MathObjectBoundTypes::get(); + const auto &typeToTypeMap = detail::MathObjectBoundTypes::get(); if (const auto toTypeBoundaries = typeToTypeMap.find(toType); toTypeBoundaries != typeToTypeMap.end()) { return fromType >= toTypeBoundaries->first && fromType < toTypeBoundaries->second; diff --git a/include/fintamath/core/MultiMethod.hpp b/include/fintamath/core/MultiMethod.hpp index 0bc75af2d..e35a6a9fa 100644 --- a/include/fintamath/core/MultiMethod.hpp +++ b/include/fintamath/core/MultiMethod.hpp @@ -9,7 +9,7 @@ #include "fintamath/core/CoreUtils.hpp" #include "fintamath/core/MathObjectTypes.hpp" -namespace fintamath { +namespace fintamath::detail { template class MultiMethod; diff --git a/include/fintamath/core/Parser.hpp b/include/fintamath/core/Parser.hpp index bc8ac309f..83cff37fa 100644 --- a/include/fintamath/core/Parser.hpp +++ b/include/fintamath/core/Parser.hpp @@ -12,7 +12,7 @@ #include "fintamath/core/Tokenizer.hpp" #include "fintamath/exceptions/InvalidInputException.hpp" -namespace fintamath { +namespace fintamath::detail { template concept StringConstructable = requires(const std::string &str, Args &&...args) { diff --git a/include/fintamath/core/Tokenizer.hpp b/include/fintamath/core/Tokenizer.hpp index e36e60e7d..f2f3dc44b 100644 --- a/include/fintamath/core/Tokenizer.hpp +++ b/include/fintamath/core/Tokenizer.hpp @@ -3,7 +3,7 @@ #include #include -namespace fintamath { +namespace fintamath::detail { using Token = std::string; using TokenVector = std::vector; diff --git a/include/fintamath/expressions/Expression.hpp b/include/fintamath/expressions/Expression.hpp index 4cf1ebe61..5d5dbda12 100644 --- a/include/fintamath/expressions/Expression.hpp +++ b/include/fintamath/expressions/Expression.hpp @@ -20,6 +20,8 @@ namespace fintamath { +namespace detail { + struct Term final { Token name; @@ -34,12 +36,14 @@ struct Term final { } }; -using TermVector = std::vector>; +using TermVector = std::vector>; using OperandStack = std::stack>; +} + class Expression final : public IExpressionCRTP { - using TermParser = Parser()>; - using ExpressionParser = Parser(ArgumentPtrVector &&)>; + using TermParser = detail::Parser()>; + using ExpressionParser = detail::Parser(ArgumentPtrVector &&)>; using ExpressionMaker = std::function(ArgumentPtrVector &&)>; public: @@ -94,23 +98,23 @@ class Expression final : public IExpressionCRTP { void updateStringMutable() const; - static TermVector tokensToTerms(const TokenVector &tokens); + static detail::TermVector tokensToTerms(const detail::TokenVector &tokens); - static OperandStack termsToOperands(TermVector &terms); + static detail::OperandStack termsToOperands(detail::TermVector &terms); - static std::unique_ptr operandsToObject(OperandStack &operands); + static std::unique_ptr operandsToObject(detail::OperandStack &operands); static ArgumentPtrVector unwrapComma(const ArgumentPtr &child); - static void insertMultiplications(TermVector &terms); + static void insertMultiplications(detail::TermVector &terms); - static void fixOperatorTypes(const TermVector &terms); + static void fixOperatorTypes(const detail::TermVector &terms); - static void collapseFactorials(TermVector &terms); + static void collapseFactorials(detail::TermVector &terms); - static bool canNextTermBeBinaryOperator(const Term &term); + static bool canNextTermBeBinaryOperator(const detail::Term &term); - static bool canPrevTermBeBinaryOperator(const Term &term); + static bool canPrevTermBeBinaryOperator(const detail::Term &term); static bool isBinaryOperator(const IMathObject *val); @@ -126,7 +130,7 @@ class Expression final : public IExpressionCRTP { static ArgumentPtr compress(const ArgumentPtr &child); - friend std::unique_ptr makeExpr(const IFunction &func, ArgumentPtrVector args); + friend std::unique_ptr detail::makeExpr(const IFunction &func, ArgumentPtrVector args); friend std::unique_ptr parseFintamath(const std::string &str); diff --git a/include/fintamath/expressions/ExpressionComparator.hpp b/include/fintamath/expressions/ExpressionComparator.hpp index 12f8c3295..c40667723 100644 --- a/include/fintamath/expressions/ExpressionComparator.hpp +++ b/include/fintamath/expressions/ExpressionComparator.hpp @@ -4,7 +4,7 @@ #include "fintamath/functions/FunctionArguments.hpp" -namespace fintamath { +namespace fintamath::detail { struct ComparatorOptions final { bool constantGreaterThanVariable = false; diff --git a/include/fintamath/expressions/ExpressionUtils.hpp b/include/fintamath/expressions/ExpressionUtils.hpp index 154700fa9..6edb3f49d 100644 --- a/include/fintamath/expressions/ExpressionUtils.hpp +++ b/include/fintamath/expressions/ExpressionUtils.hpp @@ -13,7 +13,7 @@ #include "fintamath/literals/Variable.hpp" #include "fintamath/literals/constants/Undefined.hpp" -namespace fintamath { +namespace fintamath::detail { template ... Args, std::invocable SimplifyFunction> ArgumentPtr useSimplifyFunctions(const std::vector &simplFuncs, @@ -98,4 +98,4 @@ std::string prefixUnaryOperatorToString(const IOperator &oper, const ArgumentPtr std::string postfixUnaryOperatorToString(const IOperator &oper, const ArgumentPtr &rhs); -} \ No newline at end of file +} diff --git a/include/fintamath/expressions/IExpression.hpp b/include/fintamath/expressions/IExpression.hpp index cab983195..b4c1802cf 100644 --- a/include/fintamath/expressions/IExpression.hpp +++ b/include/fintamath/expressions/IExpression.hpp @@ -19,7 +19,7 @@ namespace fintamath { class IExpression : public IArithmetic { - using ExpressionParser = Parser()>; + using ExpressionParser = detail::Parser()>; public: virtual const std::shared_ptr &getFunction() const = 0; diff --git a/include/fintamath/functions/FunctionUtils.hpp b/include/fintamath/functions/FunctionUtils.hpp index 983458ba5..e7325e694 100644 --- a/include/fintamath/functions/FunctionUtils.hpp +++ b/include/fintamath/functions/FunctionUtils.hpp @@ -6,16 +6,17 @@ #include "fintamath/core/IMathObject.hpp" #include "fintamath/functions/FunctionArguments.hpp" -#define FINTAMATH_FUNCTION_EXPRESSION(Function, name) \ - std::unique_ptr name(auto &&...args) { \ - static const Function f; \ - return makeExpr(f, std::forward(args)...); \ +#define FINTAMATH_FUNCTION_EXPRESSION(Function, name) \ + std::unique_ptr name(auto &&...args) { \ + static const Function f; \ + return detail::makeExpr(f, std::forward(args)...); \ } namespace fintamath { - class IFunction; +namespace detail { + extern bool isExpression(const IMathObject &arg); extern std::unique_ptr makeExpr(const IFunction &func, ArgumentPtrVector args); @@ -31,3 +32,5 @@ std::unique_ptr makeExpr(const IFunction &func, std::convertible_to } } + +} diff --git a/include/fintamath/functions/IFunction.hpp b/include/fintamath/functions/IFunction.hpp index ddcf8104e..4347207d8 100644 --- a/include/fintamath/functions/IFunction.hpp +++ b/include/fintamath/functions/IFunction.hpp @@ -18,7 +18,7 @@ namespace fintamath { class IFunction : public IMathObject { using FunctionOrderMap = std::unordered_map; - using FunctionParser = Parser()>; + using FunctionParser = detail::Parser()>; public: virtual const ArgumentTypeVector &getArgumentTypes() const = 0; diff --git a/include/fintamath/functions/IFunctionCRTP.hpp b/include/fintamath/functions/IFunctionCRTP.hpp index b110aa754..05c2d80c1 100644 --- a/include/fintamath/functions/IFunctionCRTP.hpp +++ b/include/fintamath/functions/IFunctionCRTP.hpp @@ -68,20 +68,20 @@ class IFunctionCRTP_ : public IFunction { return res; } - return makeExpr(*this, argVect); + return detail::makeExpr(*this, argVect); } catch (const UndefinedException &) { - return makeExpr(*this, argVect); + return detail::makeExpr(*this, argVect); } } - return makeExpr(*this, argVect)->toMinimalObject(); + return detail::makeExpr(*this, argVect)->toMinimalObject(); } private: template bool doArgsMatch(const ArgumentRefVector &argVect) const { - if (!is(argVect[i]) || isExpression(argVect[i])) { + if (!is(argVect[i]) || detail::isExpression(argVect[i])) { return false; } diff --git a/include/fintamath/functions/IOperator.hpp b/include/fintamath/functions/IOperator.hpp index b2c957632..93b99a253 100644 --- a/include/fintamath/functions/IOperator.hpp +++ b/include/fintamath/functions/IOperator.hpp @@ -13,7 +13,7 @@ namespace fintamath { class IOperator : public IFunction { - using OperatorParser = Parser()>; + using OperatorParser = detail::Parser()>; public: enum class Priority : uint8_t { diff --git a/include/fintamath/literals/ILiteral.hpp b/include/fintamath/literals/ILiteral.hpp index 01d0843b1..0b9562380 100644 --- a/include/fintamath/literals/ILiteral.hpp +++ b/include/fintamath/literals/ILiteral.hpp @@ -12,7 +12,7 @@ namespace fintamath { class ILiteral : public IMathObject { - using LiteralParser = Parser()>; + using LiteralParser = detail::Parser()>; public: static std::unique_ptr parse(const std::string &str) { diff --git a/include/fintamath/literals/constants/IConstant.hpp b/include/fintamath/literals/constants/IConstant.hpp index b700cbf69..e1161e4d4 100644 --- a/include/fintamath/literals/constants/IConstant.hpp +++ b/include/fintamath/literals/constants/IConstant.hpp @@ -12,7 +12,7 @@ namespace fintamath { class IConstant : public ILiteral { - using ConstantParser = Parser()>; + using ConstantParser = detail::Parser()>; public: virtual MathObjectType getReturnType() const = 0; diff --git a/include/fintamath/numbers/IInteger.hpp b/include/fintamath/numbers/IInteger.hpp index fe4b3c2c8..33156a0ee 100644 --- a/include/fintamath/numbers/IInteger.hpp +++ b/include/fintamath/numbers/IInteger.hpp @@ -12,7 +12,7 @@ namespace fintamath { class IInteger : public INumber { - using IntegerParser = Parser()>; + using IntegerParser = detail::Parser()>; public: friend std::unique_ptr operator%(const IInteger &lhs, const IInteger &rhs) { diff --git a/include/fintamath/numbers/INumber.hpp b/include/fintamath/numbers/INumber.hpp index 92dce0631..afbc4a94b 100644 --- a/include/fintamath/numbers/INumber.hpp +++ b/include/fintamath/numbers/INumber.hpp @@ -14,7 +14,7 @@ namespace fintamath { class INumber : public IComparable { - using NumberParser = Parser()>; + using NumberParser = detail::Parser()>; public: virtual bool isPrecise() const { diff --git a/include/fintamath/numbers/NumberUtils.hpp b/include/fintamath/numbers/NumberUtils.hpp index 2b7c3ea83..740c5e579 100644 --- a/include/fintamath/numbers/NumberUtils.hpp +++ b/include/fintamath/numbers/NumberUtils.hpp @@ -2,7 +2,7 @@ #include -namespace fintamath { +namespace fintamath::detail { std::string removeLeadingZeroes(std::string str); diff --git a/src/fintamath/config/Config.cpp b/src/fintamath/config/Config.cpp index fd93013b4..b56723048 100644 --- a/src/fintamath/config/Config.cpp +++ b/src/fintamath/config/Config.cpp @@ -5,7 +5,7 @@ #include "fintamath/config/ParserConfig.hpp" #include "fintamath/config/PrecisionConfig.hpp" -namespace fintamath { +namespace fintamath::detail { Config::Config() { [[maybe_unused]] static const PrecisionConfig precisionConfig; diff --git a/src/fintamath/config/ConverterConfig.cpp b/src/fintamath/config/ConverterConfig.cpp index ac6f1b313..3e14d7fba 100644 --- a/src/fintamath/config/ConverterConfig.cpp +++ b/src/fintamath/config/ConverterConfig.cpp @@ -8,7 +8,7 @@ #include "fintamath/numbers/Rational.hpp" #include "fintamath/numbers/Real.hpp" -namespace fintamath { +namespace fintamath::detail { ConverterConfig::ConverterConfig() { Converter::add([](const Integer & /*type*/, const Integer &value) { diff --git a/src/fintamath/config/ConverterConfig.hpp b/src/fintamath/config/ConverterConfig.hpp index 14bc3c816..2977f3815 100644 --- a/src/fintamath/config/ConverterConfig.hpp +++ b/src/fintamath/config/ConverterConfig.hpp @@ -1,6 +1,6 @@ #pragma once -namespace fintamath { +namespace fintamath::detail { struct ConverterConfig final { ConverterConfig(); diff --git a/src/fintamath/config/ExpressionConfig.cpp b/src/fintamath/config/ExpressionConfig.cpp index 79f825120..33f7728da 100644 --- a/src/fintamath/config/ExpressionConfig.cpp +++ b/src/fintamath/config/ExpressionConfig.cpp @@ -95,7 +95,7 @@ #include "fintamath/literals/ILiteral.hpp" #include "fintamath/literals/constants/E.hpp" -namespace fintamath { +namespace fintamath::detail { namespace { diff --git a/src/fintamath/config/ExpressionConfig.hpp b/src/fintamath/config/ExpressionConfig.hpp index dce1dfbd3..f188f01fd 100644 --- a/src/fintamath/config/ExpressionConfig.hpp +++ b/src/fintamath/config/ExpressionConfig.hpp @@ -1,6 +1,6 @@ #pragma once -namespace fintamath { +namespace fintamath::detail { struct ExpressionConfig final { ExpressionConfig(); diff --git a/src/fintamath/config/ParserConfig.cpp b/src/fintamath/config/ParserConfig.cpp index b33ceadd9..f37e33f3f 100644 --- a/src/fintamath/config/ParserConfig.cpp +++ b/src/fintamath/config/ParserConfig.cpp @@ -95,7 +95,7 @@ #include "fintamath/numbers/Integer.hpp" #include "fintamath/numbers/Rational.hpp" -namespace fintamath { +namespace fintamath::detail { ParserConfig::ParserConfig() { IMathObject::registerType(&ILiteral::parse); diff --git a/src/fintamath/config/ParserConfig.hpp b/src/fintamath/config/ParserConfig.hpp index 98ca99f68..b4140e18d 100644 --- a/src/fintamath/config/ParserConfig.hpp +++ b/src/fintamath/config/ParserConfig.hpp @@ -1,6 +1,6 @@ #pragma once -namespace fintamath { +namespace fintamath::detail { struct ParserConfig final { ParserConfig(); diff --git a/src/fintamath/config/PrecisionConfig.cpp b/src/fintamath/config/PrecisionConfig.cpp index 8e9aa0dd2..a787376da 100644 --- a/src/fintamath/config/PrecisionConfig.cpp +++ b/src/fintamath/config/PrecisionConfig.cpp @@ -2,7 +2,7 @@ #include "fintamath/numbers/Real.hpp" -namespace fintamath { +namespace fintamath::detail { PrecisionConfig::PrecisionConfig() { constexpr unsigned defaultPrecision = 20; diff --git a/src/fintamath/config/PrecisionConfig.hpp b/src/fintamath/config/PrecisionConfig.hpp index d79a15b1b..c5ef5a16b 100644 --- a/src/fintamath/config/PrecisionConfig.hpp +++ b/src/fintamath/config/PrecisionConfig.hpp @@ -1,6 +1,6 @@ #pragma once -namespace fintamath { +namespace fintamath::detail { struct PrecisionConfig final { PrecisionConfig(); diff --git a/src/fintamath/core/Converter.cpp b/src/fintamath/core/Converter.cpp index d9beabae9..526d81840 100644 --- a/src/fintamath/core/Converter.cpp +++ b/src/fintamath/core/Converter.cpp @@ -2,7 +2,7 @@ #include "fintamath/core/IMathObject.hpp" -namespace fintamath { +namespace fintamath::detail { Converter::ConverterMultiMethod &Converter::getConverter() { static ConverterMultiMethod converter; diff --git a/src/fintamath/core/Tokenizer.cpp b/src/fintamath/core/Tokenizer.cpp index 45a59a755..b5302dd89 100644 --- a/src/fintamath/core/Tokenizer.cpp +++ b/src/fintamath/core/Tokenizer.cpp @@ -6,7 +6,7 @@ #include "fintamath/core/CoreUtils.hpp" -namespace fintamath { +namespace fintamath::detail { TokenVector Tokenizer::tokenize(std::string str) { handleSpaces(str); diff --git a/src/fintamath/expressions/Expression.cpp b/src/fintamath/expressions/Expression.cpp index 62d814d45..e2af018ea 100644 --- a/src/fintamath/expressions/Expression.cpp +++ b/src/fintamath/expressions/Expression.cpp @@ -38,6 +38,8 @@ namespace fintamath { +using namespace detail; + struct TermWithPriority final { std::unique_ptr term; @@ -461,21 +463,6 @@ Expression::ExpressionParser &Expression::getExpressionParser() { return parser; } -std::unique_ptr makeExpr(const IFunction &func, ArgumentPtrVector args) { - stdr::transform(args, args.begin(), &Expression::compress); - Expression::validateFunctionArgs(func, args); - - if (auto expr = Expression::getExpressionParser().parse(func.toString(), std::move(args))) { - return expr; - } - - return FunctionExpression(func, std::move(args)).clone(); -} - -std::unique_ptr makeExpr(const IFunction &func, const ArgumentRefVector &args) { - return makeExpr(func, argumentRefVectorToArgumentPtrVector(args)); -} - void Expression::validateFunctionArgs(const IFunction &func, const ArgumentPtrVector &args) { const ArgumentTypeVector &expectedArgTypes = func.getArgumentTypes(); @@ -577,4 +564,23 @@ Expression operator/(const Variable &lhs, const Expression &rhs) { return Expression(divExpr(lhs, rhs)); } +namespace detail { + +std::unique_ptr makeExpr(const IFunction &func, ArgumentPtrVector args) { + stdr::transform(args, args.begin(), &Expression::compress); + Expression::validateFunctionArgs(func, args); + + if (auto expr = Expression::getExpressionParser().parse(func.toString(), std::move(args))) { + return expr; + } + + return FunctionExpression(func, std::move(args)).clone(); +} + +std::unique_ptr makeExpr(const IFunction &func, const ArgumentRefVector &args) { + return makeExpr(func, argumentRefVectorToArgumentPtrVector(args)); +} + +} + } diff --git a/src/fintamath/expressions/ExpressionComparator.cpp b/src/fintamath/expressions/ExpressionComparator.cpp index 3cb46ec22..c98c463c0 100644 --- a/src/fintamath/expressions/ExpressionComparator.cpp +++ b/src/fintamath/expressions/ExpressionComparator.cpp @@ -19,7 +19,7 @@ #include "fintamath/literals/ILiteral.hpp" #include "fintamath/literals/Variable.hpp" -namespace fintamath { +namespace fintamath::detail { using ExpressionTreePathStack = std::stack, size_t>>; diff --git a/src/fintamath/expressions/ExpressionUtils.cpp b/src/fintamath/expressions/ExpressionUtils.cpp index 815c99241..b3530322c 100644 --- a/src/fintamath/expressions/ExpressionUtils.cpp +++ b/src/fintamath/expressions/ExpressionUtils.cpp @@ -30,7 +30,7 @@ #include "fintamath/numbers/Rational.hpp" #include "fintamath/numbers/Real.hpp" -namespace fintamath { +namespace fintamath::detail { const ArgumentPtr one = Integer(1).clone(); diff --git a/src/fintamath/expressions/FunctionExpression.cpp b/src/fintamath/expressions/FunctionExpression.cpp index 56ee00eeb..3cd53e225 100644 --- a/src/fintamath/expressions/FunctionExpression.cpp +++ b/src/fintamath/expressions/FunctionExpression.cpp @@ -12,6 +12,8 @@ namespace fintamath { +using namespace detail; + FunctionExpression::FunctionExpression(const IFunction &inFunc, ArgumentPtrVector inChildren) : func(cast(inFunc.clone())) { diff --git a/src/fintamath/expressions/IExpression.cpp b/src/fintamath/expressions/IExpression.cpp index 587dfb71f..9ef0388ac 100644 --- a/src/fintamath/expressions/IExpression.cpp +++ b/src/fintamath/expressions/IExpression.cpp @@ -24,6 +24,8 @@ namespace fintamath { +using namespace detail; + std::vector IExpression::getVariables() const { std::vector vars; diff --git a/src/fintamath/expressions/binary/CompExpression.cpp b/src/fintamath/expressions/binary/CompExpression.cpp index e3718e73d..67de6e6e8 100644 --- a/src/fintamath/expressions/binary/CompExpression.cpp +++ b/src/fintamath/expressions/binary/CompExpression.cpp @@ -34,6 +34,8 @@ namespace fintamath { +using namespace detail; + CompExpression::CompExpression(const IOperator &inOper, ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(inOper, std::move(inLhsChild), std::move(inRhsChild)) { } diff --git a/src/fintamath/expressions/binary/DerivativeExpression.cpp b/src/fintamath/expressions/binary/DerivativeExpression.cpp index d94de7325..cafd8289b 100644 --- a/src/fintamath/expressions/binary/DerivativeExpression.cpp +++ b/src/fintamath/expressions/binary/DerivativeExpression.cpp @@ -55,6 +55,8 @@ namespace fintamath { +using namespace detail; + using DerivativeSimplifyMap = std::unordered_map< std::string, std::function(inFunc.clone())), lhsChild(std::move(lhs)), diff --git a/src/fintamath/expressions/interfaces/IPolynomExpression.cpp b/src/fintamath/expressions/interfaces/IPolynomExpression.cpp index 31ed8846e..ec8a3978f 100644 --- a/src/fintamath/expressions/interfaces/IPolynomExpression.cpp +++ b/src/fintamath/expressions/interfaces/IPolynomExpression.cpp @@ -21,6 +21,8 @@ namespace fintamath { +using namespace detail; + IPolynomExpression::IPolynomExpression(const IFunction &inFunc, ArgumentPtrVector args) : func(cast(inFunc.clone())), children(std::move(args)) { diff --git a/src/fintamath/expressions/interfaces/IUnaryExpression.cpp b/src/fintamath/expressions/interfaces/IUnaryExpression.cpp index 44fd13c59..ffbf50912 100644 --- a/src/fintamath/expressions/interfaces/IUnaryExpression.cpp +++ b/src/fintamath/expressions/interfaces/IUnaryExpression.cpp @@ -12,6 +12,8 @@ namespace fintamath { +using namespace detail; + IUnaryExpression::IUnaryExpression(const IFunction &inFunc, ArgumentPtr rhs) : func(cast(inFunc.clone())), child(std::move(rhs)) { @@ -20,13 +22,13 @@ IUnaryExpression::IUnaryExpression(const IFunction &inFunc, ArgumentPtr rhs) std::string IUnaryExpression::toString() const { if (const auto oper = cast(func)) { if (oper->getPriority() == IOperator::Priority::PostfixUnary) { - return postfixUnaryOperatorToString(*oper, child); + return detail::postfixUnaryOperatorToString(*oper, child); } - return prefixUnaryOperatorToString(*oper, child); + return detail::prefixUnaryOperatorToString(*oper, child); } - return functionToString(*func, {child}); + return detail::functionToString(*func, {child}); } const std::shared_ptr &IUnaryExpression::getFunction() const { diff --git a/src/fintamath/expressions/polynomial/AddExpression.cpp b/src/fintamath/expressions/polynomial/AddExpression.cpp index 78a10a428..babb21fce 100644 --- a/src/fintamath/expressions/polynomial/AddExpression.cpp +++ b/src/fintamath/expressions/polynomial/AddExpression.cpp @@ -33,6 +33,8 @@ namespace fintamath { +using namespace detail; + AddExpression::AddExpression(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(Add{}, std::move(inChildren)) { } diff --git a/src/fintamath/expressions/polynomial/MulExpression.cpp b/src/fintamath/expressions/polynomial/MulExpression.cpp index df73453f5..ad50eb319 100644 --- a/src/fintamath/expressions/polynomial/MulExpression.cpp +++ b/src/fintamath/expressions/polynomial/MulExpression.cpp @@ -29,6 +29,8 @@ namespace fintamath { +using namespace detail; + MulExpression::MulExpression(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(Mul{}, std::move(inChildren)) { } diff --git a/src/fintamath/expressions/polynomial/OrExpression.cpp b/src/fintamath/expressions/polynomial/OrExpression.cpp index 62042cb9b..a34bdf31c 100644 --- a/src/fintamath/expressions/polynomial/OrExpression.cpp +++ b/src/fintamath/expressions/polynomial/OrExpression.cpp @@ -18,6 +18,8 @@ namespace fintamath { +using namespace detail; + OrExpression::OrExpression(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(Or{}, std::move(inChildren)) { } diff --git a/src/fintamath/expressions/unary/AbsExpression.cpp b/src/fintamath/expressions/unary/AbsExpression.cpp index 566b03c58..fe0f717da 100644 --- a/src/fintamath/expressions/unary/AbsExpression.cpp +++ b/src/fintamath/expressions/unary/AbsExpression.cpp @@ -12,6 +12,8 @@ namespace fintamath { +using namespace detail; + AbsExpression::AbsExpression(ArgumentPtr inChild) : IUnaryExpressionCRTP(Abs{}, std::move(inChild)) { } diff --git a/src/fintamath/expressions/unary/FloorCeilExpression.cpp b/src/fintamath/expressions/unary/FloorCeilExpression.cpp index 860f5e156..2cc0ea974 100644 --- a/src/fintamath/expressions/unary/FloorCeilExpression.cpp +++ b/src/fintamath/expressions/unary/FloorCeilExpression.cpp @@ -18,6 +18,8 @@ namespace fintamath { +using namespace detail; + FloorCeilExpression::FloorCeilExpression(const IFunction &inFunc, ArgumentPtr inChild) : IUnaryExpressionCRTP(inFunc, std::move(inChild)) { } diff --git a/src/fintamath/expressions/unary/HyperbExpression.cpp b/src/fintamath/expressions/unary/HyperbExpression.cpp index 14c3f5408..b50bc6814 100644 --- a/src/fintamath/expressions/unary/HyperbExpression.cpp +++ b/src/fintamath/expressions/unary/HyperbExpression.cpp @@ -29,6 +29,8 @@ namespace fintamath { +using namespace detail; + using SimplifyFunctionMap = std::unordered_map>; HyperbExpression::HyperbExpression(const IFunction &inFunc, ArgumentPtr inChild) diff --git a/src/fintamath/expressions/unary/NotExpression.cpp b/src/fintamath/expressions/unary/NotExpression.cpp index a6399e9e1..0b1e22cbb 100644 --- a/src/fintamath/expressions/unary/NotExpression.cpp +++ b/src/fintamath/expressions/unary/NotExpression.cpp @@ -24,6 +24,8 @@ namespace fintamath { +using namespace detail; + NotExpression::NotExpression(ArgumentPtr inChild) : IUnaryExpressionCRTP(Not{}, std::move(inChild)) { } diff --git a/src/fintamath/expressions/unary/SignExpression.cpp b/src/fintamath/expressions/unary/SignExpression.cpp index 04d40c676..d8af5b2a8 100644 --- a/src/fintamath/expressions/unary/SignExpression.cpp +++ b/src/fintamath/expressions/unary/SignExpression.cpp @@ -16,6 +16,8 @@ namespace fintamath { +using namespace detail; + SignExpression::SignExpression(ArgumentPtr inChild) : IUnaryExpressionCRTP(Sign{}, std::move(inChild)) { } diff --git a/src/fintamath/expressions/unary/TrigExpression.cpp b/src/fintamath/expressions/unary/TrigExpression.cpp index 6a6d943fa..1dbd35992 100644 --- a/src/fintamath/expressions/unary/TrigExpression.cpp +++ b/src/fintamath/expressions/unary/TrigExpression.cpp @@ -36,6 +36,8 @@ namespace fintamath { +using namespace detail; + using SimplifyFunctionMap = std::unordered_map>; using TrigonometryFunctionMap = std::unordered_map>; diff --git a/src/fintamath/functions/arithmetic/Abs.cpp b/src/fintamath/functions/arithmetic/Abs.cpp index 4c113b5d7..081dd1825 100644 --- a/src/fintamath/functions/arithmetic/Abs.cpp +++ b/src/fintamath/functions/arithmetic/Abs.cpp @@ -18,6 +18,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Abs::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/arithmetic/Sign.cpp b/src/fintamath/functions/arithmetic/Sign.cpp index efb366eb8..13e65beb1 100644 --- a/src/fintamath/functions/arithmetic/Sign.cpp +++ b/src/fintamath/functions/arithmetic/Sign.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Sign::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/calculus/Derivative.cpp b/src/fintamath/functions/calculus/Derivative.cpp index 63bc689a7..fd45423f4 100644 --- a/src/fintamath/functions/calculus/Derivative.cpp +++ b/src/fintamath/functions/calculus/Derivative.cpp @@ -8,6 +8,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Derivative::call(const ArgumentRefVector &argVect) const { return makeExpr(*this, argVect)->toMinimalObject(); } diff --git a/src/fintamath/functions/calculus/Integral.cpp b/src/fintamath/functions/calculus/Integral.cpp index a825dac0f..874a2f1ea 100644 --- a/src/fintamath/functions/calculus/Integral.cpp +++ b/src/fintamath/functions/calculus/Integral.cpp @@ -8,6 +8,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Integral::call(const ArgumentRefVector &argVect) const { return makeExpr(*this, argVect)->toMinimalObject(); } diff --git a/src/fintamath/functions/hyperbolic/Acosh.cpp b/src/fintamath/functions/hyperbolic/Acosh.cpp index af13a2b2f..7c6cb8436 100644 --- a/src/fintamath/functions/hyperbolic/Acosh.cpp +++ b/src/fintamath/functions/hyperbolic/Acosh.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Acosh::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Acoth.cpp b/src/fintamath/functions/hyperbolic/Acoth.cpp index f92af6902..91066f91c 100644 --- a/src/fintamath/functions/hyperbolic/Acoth.cpp +++ b/src/fintamath/functions/hyperbolic/Acoth.cpp @@ -17,6 +17,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Acoth::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Acsch.cpp b/src/fintamath/functions/hyperbolic/Acsch.cpp index 98cadb03e..9fc0de718 100644 --- a/src/fintamath/functions/hyperbolic/Acsch.cpp +++ b/src/fintamath/functions/hyperbolic/Acsch.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Acsch::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Asech.cpp b/src/fintamath/functions/hyperbolic/Asech.cpp index 067c366b4..9092e970d 100644 --- a/src/fintamath/functions/hyperbolic/Asech.cpp +++ b/src/fintamath/functions/hyperbolic/Asech.cpp @@ -17,6 +17,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Asech::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Asinh.cpp b/src/fintamath/functions/hyperbolic/Asinh.cpp index f44dffc54..570804bf9 100644 --- a/src/fintamath/functions/hyperbolic/Asinh.cpp +++ b/src/fintamath/functions/hyperbolic/Asinh.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Asinh::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Atanh.cpp b/src/fintamath/functions/hyperbolic/Atanh.cpp index 6a4f683c1..5dc53a579 100644 --- a/src/fintamath/functions/hyperbolic/Atanh.cpp +++ b/src/fintamath/functions/hyperbolic/Atanh.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Atanh::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Cosh.cpp b/src/fintamath/functions/hyperbolic/Cosh.cpp index 524844fc0..83b7b762c 100644 --- a/src/fintamath/functions/hyperbolic/Cosh.cpp +++ b/src/fintamath/functions/hyperbolic/Cosh.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Cosh::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Coth.cpp b/src/fintamath/functions/hyperbolic/Coth.cpp index 54b7c245e..06d15ecdd 100644 --- a/src/fintamath/functions/hyperbolic/Coth.cpp +++ b/src/fintamath/functions/hyperbolic/Coth.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Coth::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Csch.cpp b/src/fintamath/functions/hyperbolic/Csch.cpp index 809ef7be5..c9fbbc7f3 100644 --- a/src/fintamath/functions/hyperbolic/Csch.cpp +++ b/src/fintamath/functions/hyperbolic/Csch.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Csch::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Sech.cpp b/src/fintamath/functions/hyperbolic/Sech.cpp index 872e1f6b4..5872ff48b 100644 --- a/src/fintamath/functions/hyperbolic/Sech.cpp +++ b/src/fintamath/functions/hyperbolic/Sech.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Sech::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Sinh.cpp b/src/fintamath/functions/hyperbolic/Sinh.cpp index ad1d1ae56..5895b7767 100644 --- a/src/fintamath/functions/hyperbolic/Sinh.cpp +++ b/src/fintamath/functions/hyperbolic/Sinh.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Sinh::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/hyperbolic/Tanh.cpp b/src/fintamath/functions/hyperbolic/Tanh.cpp index cedfbefc3..8ba3ba820 100644 --- a/src/fintamath/functions/hyperbolic/Tanh.cpp +++ b/src/fintamath/functions/hyperbolic/Tanh.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Tanh::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/logarithms/Ln.cpp b/src/fintamath/functions/logarithms/Ln.cpp index 8c126e1f4..6163a6bdf 100644 --- a/src/fintamath/functions/logarithms/Ln.cpp +++ b/src/fintamath/functions/logarithms/Ln.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Ln::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/logarithms/Log.cpp b/src/fintamath/functions/logarithms/Log.cpp index 1de3da8d6..1aa6ca091 100644 --- a/src/fintamath/functions/logarithms/Log.cpp +++ b/src/fintamath/functions/logarithms/Log.cpp @@ -21,6 +21,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Log::call(const ArgumentRefVector &argVect) const { const auto &lhs = cast(argVect.front().get()); const auto &rhs = cast(argVect.back().get()); diff --git a/src/fintamath/functions/ntheory/Ceil.cpp b/src/fintamath/functions/ntheory/Ceil.cpp index 55615e6b2..ab7bb524b 100644 --- a/src/fintamath/functions/ntheory/Ceil.cpp +++ b/src/fintamath/functions/ntheory/Ceil.cpp @@ -18,6 +18,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Ceil::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/ntheory/Floor.cpp b/src/fintamath/functions/ntheory/Floor.cpp index 2154bdc39..662f9ba9c 100644 --- a/src/fintamath/functions/ntheory/Floor.cpp +++ b/src/fintamath/functions/ntheory/Floor.cpp @@ -18,6 +18,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Floor::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/ntheory/Mod.cpp b/src/fintamath/functions/ntheory/Mod.cpp index 074016510..ea9713015 100644 --- a/src/fintamath/functions/ntheory/Mod.cpp +++ b/src/fintamath/functions/ntheory/Mod.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Mod::call(const ArgumentRefVector &argVect) const { const auto &lhs = cast(argVect.front().get()); const auto &rhs = cast(argVect.back().get()); diff --git a/src/fintamath/functions/other/Factorial.cpp b/src/fintamath/functions/other/Factorial.cpp index d8bd5b07b..fcd9d1b1e 100644 --- a/src/fintamath/functions/other/Factorial.cpp +++ b/src/fintamath/functions/other/Factorial.cpp @@ -16,6 +16,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Factorial::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/powers/Pow.cpp b/src/fintamath/functions/powers/Pow.cpp index 83370e964..dae1e6ef7 100644 --- a/src/fintamath/functions/powers/Pow.cpp +++ b/src/fintamath/functions/powers/Pow.cpp @@ -20,6 +20,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Pow::call(const ArgumentRefVector &argVect) const { const auto &lhs = cast(argVect.front().get()); const auto &rhs = cast(argVect.back().get()); diff --git a/src/fintamath/functions/powers/Root.cpp b/src/fintamath/functions/powers/Root.cpp index f70243efb..dfc7bbb3c 100644 --- a/src/fintamath/functions/powers/Root.cpp +++ b/src/fintamath/functions/powers/Root.cpp @@ -17,6 +17,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Root::call(const ArgumentRefVector &argVect) const { const auto &lhs = cast(argVect.front().get()); const auto &rhs = cast(argVect.back().get()); diff --git a/src/fintamath/functions/trigonometry/Acos.cpp b/src/fintamath/functions/trigonometry/Acos.cpp index d89631db7..6a2305b6b 100644 --- a/src/fintamath/functions/trigonometry/Acos.cpp +++ b/src/fintamath/functions/trigonometry/Acos.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Acos::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Acot.cpp b/src/fintamath/functions/trigonometry/Acot.cpp index cbb5e8d9a..4333ad441 100644 --- a/src/fintamath/functions/trigonometry/Acot.cpp +++ b/src/fintamath/functions/trigonometry/Acot.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Acot::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Acsc.cpp b/src/fintamath/functions/trigonometry/Acsc.cpp index 2ad9b5006..5be9181a8 100644 --- a/src/fintamath/functions/trigonometry/Acsc.cpp +++ b/src/fintamath/functions/trigonometry/Acsc.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Acsc::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Asec.cpp b/src/fintamath/functions/trigonometry/Asec.cpp index 603b8a08e..1b8f96908 100644 --- a/src/fintamath/functions/trigonometry/Asec.cpp +++ b/src/fintamath/functions/trigonometry/Asec.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Asec::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Asin.cpp b/src/fintamath/functions/trigonometry/Asin.cpp index 53439e40e..df57242c0 100644 --- a/src/fintamath/functions/trigonometry/Asin.cpp +++ b/src/fintamath/functions/trigonometry/Asin.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Asin::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Atan.cpp b/src/fintamath/functions/trigonometry/Atan.cpp index 96494d685..5c3a258c1 100644 --- a/src/fintamath/functions/trigonometry/Atan.cpp +++ b/src/fintamath/functions/trigonometry/Atan.cpp @@ -15,6 +15,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Atan::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Cos.cpp b/src/fintamath/functions/trigonometry/Cos.cpp index 6b369c962..97ffe4119 100644 --- a/src/fintamath/functions/trigonometry/Cos.cpp +++ b/src/fintamath/functions/trigonometry/Cos.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Cos::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Cot.cpp b/src/fintamath/functions/trigonometry/Cot.cpp index c6357d42b..836dfaf82 100644 --- a/src/fintamath/functions/trigonometry/Cot.cpp +++ b/src/fintamath/functions/trigonometry/Cot.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Cot::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Csc.cpp b/src/fintamath/functions/trigonometry/Csc.cpp index b4765fa84..9f6eff367 100644 --- a/src/fintamath/functions/trigonometry/Csc.cpp +++ b/src/fintamath/functions/trigonometry/Csc.cpp @@ -14,6 +14,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Csc::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Sec.cpp b/src/fintamath/functions/trigonometry/Sec.cpp index 397e6eceb..fcf9ac1dc 100644 --- a/src/fintamath/functions/trigonometry/Sec.cpp +++ b/src/fintamath/functions/trigonometry/Sec.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Sec::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Sin.cpp b/src/fintamath/functions/trigonometry/Sin.cpp index 8793a7dbb..19941fd1a 100644 --- a/src/fintamath/functions/trigonometry/Sin.cpp +++ b/src/fintamath/functions/trigonometry/Sin.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Sin::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/functions/trigonometry/Tan.cpp b/src/fintamath/functions/trigonometry/Tan.cpp index 8d8ca5871..efa831732 100644 --- a/src/fintamath/functions/trigonometry/Tan.cpp +++ b/src/fintamath/functions/trigonometry/Tan.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + std::unique_ptr Tan::call(const ArgumentRefVector &argVect) const { const auto &rhs = cast(argVect.front().get()); diff --git a/src/fintamath/numbers/Integer.cpp b/src/fintamath/numbers/Integer.cpp index fd625efc4..52aba98eb 100644 --- a/src/fintamath/numbers/Integer.cpp +++ b/src/fintamath/numbers/Integer.cpp @@ -12,6 +12,8 @@ namespace fintamath { +using namespace detail; + Integer::Integer(Backend inBackend) : backend(std::move(inBackend)) { } diff --git a/src/fintamath/numbers/NumberUtils.cpp b/src/fintamath/numbers/NumberUtils.cpp index 1b15417cf..d83cc19a1 100644 --- a/src/fintamath/numbers/NumberUtils.cpp +++ b/src/fintamath/numbers/NumberUtils.cpp @@ -3,7 +3,7 @@ #include #include -namespace fintamath { +namespace fintamath::detail { std::string removeLeadingZeroes(std::string str) { size_t firstDigit = 0; diff --git a/src/fintamath/numbers/Real.cpp b/src/fintamath/numbers/Real.cpp index 8b68efc3a..165735ed3 100644 --- a/src/fintamath/numbers/Real.cpp +++ b/src/fintamath/numbers/Real.cpp @@ -19,6 +19,8 @@ namespace fintamath { +using namespace detail; + constexpr unsigned precisionMultiplier = 2; constexpr unsigned precisionDelta = 10; diff --git a/src/fintamath/numbers/RealFunctions.cpp b/src/fintamath/numbers/RealFunctions.cpp index 0a5998ceb..f978b009e 100644 --- a/src/fintamath/numbers/RealFunctions.cpp +++ b/src/fintamath/numbers/RealFunctions.cpp @@ -13,6 +13,8 @@ namespace fintamath { +using namespace detail; + bool isOverflow(const Real &rhs) { static Cache cache([](const unsigned precision) { static const Real::Backend powBase = 10; diff --git a/tests/src/expressions/ExpressionComparatorTests.cpp b/tests/src/expressions/ExpressionComparatorTests.cpp index c109632de..a018920c1 100644 --- a/tests/src/expressions/ExpressionComparatorTests.cpp +++ b/tests/src/expressions/ExpressionComparatorTests.cpp @@ -4,6 +4,7 @@ #include "fintamath/expressions/ExpressionComparator.hpp" using namespace fintamath; +using namespace detail; TEST(ExpressionComparatorTests, comparatorTest) { EXPECT_EQ(compare(Variable("a").clone(), Expression("a").clone()), std::strong_ordering::equal); diff --git a/tests/src/expressions/ExpressionUtilsTests.cpp b/tests/src/expressions/ExpressionUtilsTests.cpp index 186287d50..3c81689ec 100644 --- a/tests/src/expressions/ExpressionUtilsTests.cpp +++ b/tests/src/expressions/ExpressionUtilsTests.cpp @@ -5,6 +5,7 @@ #include "fintamath/expressions/Expression.hpp" using namespace fintamath; +using namespace detail; TEST(ExpressionUtilsTests, putInBracketsTest) { EXPECT_EQ(putInBrackets(""), "()"); diff --git a/tests/src/expressions/FunctionExpressionTests.cpp b/tests/src/expressions/FunctionExpressionTests.cpp index aa7c8a897..d27a01372 100644 --- a/tests/src/expressions/FunctionExpressionTests.cpp +++ b/tests/src/expressions/FunctionExpressionTests.cpp @@ -5,6 +5,7 @@ #include "fintamath/functions/arithmetic/Abs.hpp" using namespace fintamath; +using namespace detail; namespace { diff --git a/tests/src/functions/FunctionUtilsTests.cpp b/tests/src/functions/FunctionUtilsTests.cpp index 007128a31..092b761cb 100644 --- a/tests/src/functions/FunctionUtilsTests.cpp +++ b/tests/src/functions/FunctionUtilsTests.cpp @@ -13,6 +13,7 @@ #include "fintamath/numbers/Rational.hpp" using namespace fintamath; +using namespace detail; TEST(FunctionUtilsTests, makeExpressionPtrsTest) { ArgumentPtr one = std::make_unique(1); diff --git a/tests/src/numbers/IIntegerTests.cpp b/tests/src/numbers/IIntegerTests.cpp index 2d7dd201d..6a67149ba 100644 --- a/tests/src/numbers/IIntegerTests.cpp +++ b/tests/src/numbers/IIntegerTests.cpp @@ -7,6 +7,7 @@ #include "fintamath/numbers/Rational.hpp" using namespace fintamath; +using namespace detail; namespace {