Fix: Remove circular dependencies in headers (#295)

* Remove circular dependencies in headers

* Fix unit test includes and test data directory location
This commit is contained in:
Vladislav Navrocky
2025-02-11 11:03:42 +03:00
committed by GitHub
parent 17ba53cb9e
commit 384a6bef3f
17 changed files with 97 additions and 69 deletions
+26 -12
View File
@@ -25,6 +25,10 @@ SOFTWARE.
#ifndef INCLUDE_INJA_INJA_HPP_
#define INCLUDE_INJA_INJA_HPP_
// #include "json.hpp"
#ifndef INCLUDE_INJA_JSON_HPP_
#define INCLUDE_INJA_JSON_HPP_
#include <nlohmann/json.hpp>
namespace inja {
@@ -35,6 +39,12 @@ using json = INJA_DATA_TYPE;
#endif
} // namespace inja
#endif // INCLUDE_INJA_JSON_HPP_
// #include "throw.hpp"
#ifndef INCLUDE_INJA_THROW_HPP_
#define INCLUDE_INJA_THROW_HPP_
#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(INJA_NOEXCEPTION)
#ifndef INJA_THROW
#define INJA_THROW(exception) throw exception
@@ -42,15 +52,17 @@ using json = INJA_DATA_TYPE;
#else
#include <cstdlib>
#ifndef INJA_THROW
#define INJA_THROW(exception) \
std::abort(); \
std::ignore = exception
#define INJA_THROW(exception) \
std::abort(); \
std::ignore = exception
#endif
#ifndef INJA_NOEXCEPTION
#define INJA_NOEXCEPTION
#endif
#endif
#endif // INCLUDE_INJA_THROW_HPP_
// #include "environment.hpp"
#ifndef INCLUDE_INJA_ENVIRONMENT_HPP_
#define INCLUDE_INJA_ENVIRONMENT_HPP_
@@ -61,6 +73,8 @@ using json = INJA_DATA_TYPE;
#include <string>
#include <string_view>
// #include "json.hpp"
// #include "config.hpp"
#ifndef INCLUDE_INJA_CONFIG_HPP_
#define INCLUDE_INJA_CONFIG_HPP_
@@ -98,7 +112,7 @@ using json = INJA_DATA_TYPE;
#include <utility>
#include <vector>
// #include "inja.hpp"
// #include "json.hpp"
namespace inja {
@@ -235,8 +249,6 @@ public:
#endif // INCLUDE_INJA_FUNCTION_STORAGE_HPP_
// #include "inja.hpp"
// #include "utils.hpp"
#ifndef INCLUDE_INJA_UTILS_HPP_
#define INCLUDE_INJA_UTILS_HPP_
@@ -358,6 +370,8 @@ inline void replace_substring(std::string& s, const std::string& f, const std::s
#endif // INCLUDE_INJA_UTILS_HPP_
// #include "json.hpp"
namespace inja {
@@ -904,8 +918,6 @@ struct RenderConfig {
// #include "function_storage.hpp"
// #include "inja.hpp"
// #include "parser.hpp"
#ifndef INCLUDE_INJA_PARSER_HPP_
#define INCLUDE_INJA_PARSER_HPP_
@@ -926,8 +938,6 @@ struct RenderConfig {
// #include "function_storage.hpp"
// #include "inja.hpp"
// #include "lexer.hpp"
#ifndef INCLUDE_INJA_LEXER_HPP_
#define INCLUDE_INJA_LEXER_HPP_
@@ -1448,6 +1458,8 @@ public:
// #include "template.hpp"
// #include "throw.hpp"
// #include "token.hpp"
@@ -2108,12 +2120,12 @@ public:
// #include "function_storage.hpp"
// #include "inja.hpp"
// #include "node.hpp"
// #include "template.hpp"
// #include "throw.hpp"
// #include "utils.hpp"
@@ -2764,6 +2776,8 @@ public:
// #include "template.hpp"
// #include "throw.hpp"
namespace inja {