added header bookend includes

This commit is contained in:
Mark Gillard 2021-10-24 13:21:32 +03:00
parent ca76e5d571
commit 0f589ceba8
31 changed files with 210 additions and 69 deletions

View File

@ -5,6 +5,7 @@
#pragma once
#include "value.h"
#include "header_start.h"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -1114,3 +1115,5 @@ TOML_NAMESPACE_START
};
}
TOML_NAMESPACE_END;
#include "header_end.h"

View File

@ -12,7 +12,7 @@
//# }}
#include "array.h"
#include "header_start.h"
/// \cond
TOML_NAMESPACE_START
@ -281,3 +281,4 @@ TOML_NAMESPACE_START
TOML_NAMESPACE_END;
/// \endcond
#include "header_end.h"

View File

@ -5,6 +5,7 @@
#pragma once
#include "preprocessor.h"
#include "header_start.h"
//#====================================================================================================================
//# INCLUDES
@ -1287,3 +1288,5 @@ TOML_NAMESPACE_START
/// \endcond
}
TOML_NAMESPACE_END;
#include "header_end.h"

View File

@ -5,6 +5,7 @@
#pragma once
#include "common.h"
#include "header_start.h"
TOML_NAMESPACE_START
{
@ -416,3 +417,5 @@ TOML_NAMESPACE_START
#endif
}
TOML_NAMESPACE_END;
#include "header_end.h"

View File

@ -8,9 +8,7 @@
#include "table.h"
#include "array.h"
#include "utf8.h"
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#include "header_start.h"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -456,4 +454,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
#include "header_end.h"

View File

@ -12,11 +12,9 @@
//# }}
#include "default_formatter.h"
#include "header_start.h"
/// \cond
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -282,6 +280,5 @@ TOML_IMPL_NAMESPACE_END;
#endif // TOML_WINDOWS_COMPAT
TOML_POP_WARNINGS;
/// \endcond
#include "header_end.h"

View File

@ -2,16 +2,14 @@
//# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
/// \cond
#pragma once
#include "print_to_stream.h"
#if TOML_PARSER && !TOML_EXCEPTIONS
#include "parse_result.h"
#endif
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#include "header_start.h"
/// \cond
TOML_IMPL_NAMESPACE_START
{
@ -34,6 +32,7 @@ TOML_IMPL_NAMESPACE_START
{
return *source_;
}
TOML_NODISCARD
std::basic_ostream<Char>& stream() const noexcept
{
@ -290,6 +289,5 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
/// \endcond
#include "header_end.h"

View File

@ -0,0 +1,6 @@
//# {{
#ifdef __INTELLISENSE__
#include "preprocessor.h"
#endif
//# }}
TOML_POP_WARNINGS;

View File

@ -0,0 +1,8 @@
//# {{
#ifdef __INTELLISENSE__
#include "preprocessor.h"
#endif
//# }}
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;

View File

@ -7,9 +7,7 @@
#include "formatter.h"
#include "table.h"
#include "array.h"
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#include "header_start.h"
TOML_NAMESPACE_START
{
@ -192,4 +190,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
#include "header_end.h"

View File

@ -12,12 +12,9 @@
//# }}
#include "json_formatter.h"
#include "header_start.h"
/// \cond
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
template <typename Char>
@ -60,6 +57,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
/// \endcond
#include "header_end.h"

View File

@ -5,6 +5,7 @@
#pragma once
#include "common.h"
#include "header_start.h"
TOML_NAMESPACE_START
{
@ -995,3 +996,5 @@ TOML_NAMESPACE_START
};
}
TOML_NAMESPACE_END;
#include "header_end.h"

View File

@ -12,6 +12,8 @@
//# }}
#include "node.h"
#include "header_start.h"
/// \cond
TOML_NAMESPACE_START
{
@ -60,3 +62,6 @@ TOML_NAMESPACE_START
}
}
TOML_NAMESPACE_END;
/// \endcond
#include "header_end.h"

View File

@ -7,8 +7,8 @@
#include "table.h"
#include "array.h"
#include "value.h"
#include "header_start.h"
TOML_PUSH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_NAMESPACE_START
@ -812,4 +812,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_ARITHMETIC_WARNINGS
#include "header_end.h"

View File

@ -11,7 +11,7 @@
#endif
//# }}
TOML_PUSH_WARNINGS;
#include "header_start.h"
TOML_DISABLE_INIT_WARNINGS;
TOML_NAMESPACE_START
@ -147,4 +147,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_INIT_WARNINGS
#include "header_end.h"

View File

@ -12,6 +12,7 @@
//# }}
#include "table.h"
#include "parse_error.h"
#include "header_start.h"
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
TOML_NAMESPACE_START
@ -387,3 +388,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#endif // !TOML_EXCEPTIONS
#include "header_end.h"

View File

@ -14,6 +14,7 @@
#include "parse_error.h"
#include "parse_result.h"
#include "utf8_streams.h"
#include "header_start.h"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -442,3 +443,5 @@ TOML_NAMESPACE_START
}
}
TOML_NAMESPACE_END;
#include "header_end.h"

View File

@ -21,13 +21,11 @@ TOML_DISABLE_WARNINGS;
using namespace std::string_view_literals;
#endif
TOML_ENABLE_WARNINGS;
#include "header_start.h"
/// \cond
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_INIT_WARNINGS;
#if TOML_MSVC
#pragma warning(disable : 6001) // using uninitialized memory (false positive)
#endif
@ -3186,6 +3184,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
/// \endcond
#include "header_end.h"

View File

@ -162,8 +162,8 @@
#endif
#define TOML_DISABLE_SWITCH_WARNINGS \
__pragma(warning(disable: 4061)) \
__pragma(warning(disable: 4062)) \
__pragma(warning(disable: 4061)) /* enumerator 'identifier' is not explicitly handled by a case label */ \
__pragma(warning(disable: 4062)) /* enumerator 'identifier' is not handled */ \
__pragma(warning(disable: 4063)) \
__pragma(warning(disable: 26819)) \
static_assert(true)

View File

@ -5,9 +5,8 @@
#pragma once
#include "date_time.h"
#include "header_start.h"
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -463,4 +462,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
#include "header_end.h"

View File

@ -5,6 +5,7 @@
#pragma once
#include "array.h"
#include "header_start.h"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -1331,3 +1332,5 @@ TOML_NAMESPACE_START
#endif // !DOXYGEN
}
TOML_NAMESPACE_END;
#include "header_end.h"

View File

@ -13,7 +13,7 @@
#include "table.h"
#include "node_view.h"
#include "header_start.h"
/// \cond
TOML_NAMESPACE_START
@ -208,3 +208,4 @@ TOML_NAMESPACE_START
TOML_NAMESPACE_END;
/// \endcond
#include "header_end.h"

View File

@ -25,6 +25,8 @@ TOML_ENABLE_WARNINGS;
#if TOML_PARSER
#include "parser.h"
#endif
#include "header_start.h"
/// \cond
// internal implementation namespace
TOML_IMPL_NAMESPACE_START
@ -146,3 +148,6 @@ TOML_NAMESPACE_START
#endif // TOML_PARSER
}
TOML_NAMESPACE_END;
/// \endcond
#include "header_end.h"

View File

@ -5,9 +5,7 @@
#pragma once
#include "preprocessor.h"
TOML_PUSH_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#include "header_start.h"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -954,4 +952,4 @@ TOML_IMPL_NAMESPACE_START
TOML_IMPL_NAMESPACE_END;
/// \endcond
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
#include "header_end.h"

View File

@ -12,7 +12,7 @@
//# }}
#include "utf8.h"
#include "parse_error.h"
#include "header_start.h"
/// \cond
#if TOML_EXCEPTIONS
@ -397,3 +397,4 @@ TOML_IMPL_NAMESPACE_END;
#undef TOML_ERROR
/// \endcond
#include "header_end.h"

View File

@ -15,7 +15,7 @@
//# }}
#include "utf8_streams.h"
#include "header_start.h"
/// \cond
#if !TOML_EXCEPTIONS
@ -114,3 +114,4 @@ TOML_IMPL_NAMESPACE_END;
#undef TOML_ERROR_CHECK
/// \endcond
#include "header_end.h"

View File

@ -6,6 +6,7 @@
#pragma once
#include "node.h"
#include "print_to_stream.h"
#include "header_start.h"
/// \cond
// clang-format off
@ -69,10 +70,8 @@
// clang-format on
/// \endcond
TOML_PUSH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_DISABLE_INIT_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
/// \cond
TOML_IMPL_NAMESPACE_START
@ -1161,4 +1160,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
#include "header_end.h"

View File

@ -42,6 +42,8 @@
<ClInclude Include="include\toml++\impl\default_formatter.h" />
<ClInclude Include="include\toml++\impl\default_formatter_impl.h" />
<ClInclude Include="include\toml++\impl\formatter.h" />
<ClInclude Include="include\toml++\impl\header_end.h" />
<ClInclude Include="include\toml++\impl\header_start.h" />
<ClInclude Include="include\toml++\impl\json_formatter.h" />
<ClInclude Include="include\toml++\impl\json_formatter_impl.h" />
<ClInclude Include="include\toml++\impl\node.h" />

View File

@ -82,6 +82,12 @@
<ClInclude Include="include\toml++\impl\version.h">
<Filter>include\impl</Filter>
</ClInclude>
<ClInclude Include="include\toml++\impl\header_start.h">
<Filter>include\impl</Filter>
</ClInclude>
<ClInclude Include="include\toml++\impl\header_end.h">
<Filter>include\impl</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="toml++.props" />

118
toml.hpp
View File

@ -192,8 +192,8 @@
#endif
#define TOML_DISABLE_SWITCH_WARNINGS \
__pragma(warning(disable: 4061)) \
__pragma(warning(disable: 4062)) \
__pragma(warning(disable: 4061)) /* enumerator 'identifier' is not explicitly handled by a case label */ \
__pragma(warning(disable: 4062)) /* enumerator 'identifier' is not handled */ \
__pragma(warning(disable: 4063)) \
__pragma(warning(disable: 26819)) \
static_assert(true)
@ -856,6 +856,10 @@ TOML_DISABLE_SPAM_WARNINGS;
//******** impl/common.h *********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_WARNINGS;
#include <cstdint>
#include <cstddef>
@ -1932,8 +1936,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/date_time.h ******************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
struct TOML_TRIVIAL_ABI date
@ -2236,10 +2246,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/print_to_stream.h ************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -2659,6 +2673,10 @@ TOML_POP_WARNINGS;
//******** impl/node.h ***********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
class TOML_ABSTRACT_BASE TOML_API node
@ -3261,8 +3279,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/value.h **********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
// clang-format off
#if TOML_WINDOWS_COMPAT
@ -3323,10 +3347,8 @@ TOML_NAMESPACE_END;
// clang-format on
TOML_PUSH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_DISABLE_INIT_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
{
@ -4281,6 +4303,10 @@ TOML_POP_WARNINGS;
//******** impl/array.h **********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
{
template <bool IsConst>
@ -4929,8 +4955,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/table.h **********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
{
template <bool IsConst>
@ -5663,9 +5695,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/node_view.h ******************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_NAMESPACE_START
@ -6171,11 +6208,12 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_ARITHMETIC_WARNINGS
TOML_POP_WARNINGS;
//******** impl/utf8.h ***********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -7114,13 +7152,16 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
TOML_POP_WARNINGS;
#if TOML_PARSER
//******** impl/parse_error.h ****************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_INIT_WARNINGS;
TOML_NAMESPACE_START
@ -7225,10 +7266,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_INIT_WARNINGS
TOML_POP_WARNINGS;
//******** impl/parse_result.h ***************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
TOML_NAMESPACE_START
{
@ -7501,8 +7546,14 @@ TOML_NAMESPACE_START
TOML_NAMESPACE_END;
#endif // !TOML_EXCEPTIONS
TOML_POP_WARNINGS;
//******** impl/utf8_streams.h ***************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#if TOML_EXCEPTIONS
#define TOML_ERROR_CHECK (void)0
#define TOML_ERROR throw parse_error
@ -7884,8 +7935,14 @@ TOML_IMPL_NAMESPACE_END;
#undef TOML_ERROR_CHECK
#undef TOML_ERROR
TOML_POP_WARNINGS;
//******** impl/parser.h *********************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
{
TOML_ABI_NAMESPACE_BOOL(TOML_EXCEPTIONS, ex, noex);
@ -8017,6 +8074,8 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
#endif // TOML_PARSER
//******** impl/formatter.h ******************************************************************************************
@ -8026,6 +8085,7 @@ TOML_NAMESPACE_END;
#endif
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -8049,6 +8109,7 @@ TOML_IMPL_NAMESPACE_START
{
return *source_;
}
TOML_NODISCARD
std::basic_ostream<Char>& stream() const noexcept
{
@ -8305,11 +8366,12 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
TOML_POP_WARNINGS;
//******** impl/default_formatter.h **********************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -8694,11 +8756,12 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
TOML_POP_WARNINGS;
//******** impl/json_formatter.h *************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
@ -8817,12 +8880,16 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
TOML_POP_WARNINGS;
#if TOML_IMPLEMENTATION
//******** impl/node_impl.h ******************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
TOML_EXTERNAL_LINKAGE
@ -8871,8 +8938,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/array_impl.h *****************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
TOML_EXTERNAL_LINKAGE
@ -9138,8 +9211,14 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
//******** impl/table_impl.h *****************************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
TOML_EXTERNAL_LINKAGE
@ -9331,10 +9410,16 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
#if TOML_PARSER
//******** impl/utf8_streams_impl.h **********************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
#if !TOML_EXCEPTIONS
#undef TOML_ERROR_CHECK
#define TOML_ERROR_CHECK \
@ -9430,6 +9515,8 @@ TOML_IMPL_NAMESPACE_END;
#undef TOML_ERROR_CHECK
TOML_POP_WARNINGS;
//******** impl/parser_impl.h ****************************************************************************************
TOML_DISABLE_WARNINGS;
@ -9442,7 +9529,9 @@ TOML_ENABLE_WARNINGS;
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_INIT_WARNINGS;
#if TOML_MSVC
#pragma warning(disable : 6001) // using uninitialized memory (false positive)
#endif
@ -12607,7 +12696,9 @@ TOML_POP_WARNINGS;
//******** impl/default_formatter_impl.h *****************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_IMPL_NAMESPACE_START
@ -12878,6 +12969,7 @@ TOML_POP_WARNINGS;
//******** impl/json_formatter_impl.h ********************************************************************************
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
@ -12937,6 +13029,10 @@ TOML_ENABLE_WARNINGS;
#endif
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
// internal implementation namespace
TOML_IMPL_NAMESPACE_START
{
@ -13058,6 +13154,8 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
TOML_POP_WARNINGS;
#endif // !TOML_HEADER_ONLY
#endif // TOML_IMPLEMENTATION

View File

@ -16,9 +16,13 @@ from io import StringIO
class Preprocessor:
__re_includes = re.compile(r'^\s*#\s*include\s+"(.+?)"', re.I | re.M)
__multiples_allowed = [
r'impl/header_start.h',
r'impl/header_end.h'
]
def __init__(self, file):
self.__processed_includes = []
self.__processed_includes = set()
self.__current_level = 0
self.__directory_stack = [ Path.cwd() ]
self.__entry_root = ''
@ -32,12 +36,17 @@ class Preprocessor:
incl = Path(incl.strip().replace('\\',r'/'))
if not incl.is_absolute():
incl = Path(self.__directory_stack[-1], incl).resolve()
if incl in self.__processed_includes:
return ''
if self.__current_level == 0 and self.__entry_root == '':
self.__entry_root = str(incl.parent).replace('\\',r'/')
self.__processed_includes.append(incl)
relative_path = str(incl).replace('\\',r'/')
if relative_path.startswith(self.__entry_root):
relative_path = relative_path[len(self.__entry_root):].strip('/')
if incl in self.__processed_includes and relative_path not in self.__multiples_allowed:
return ''
self.__processed_includes.add(incl)
self.__directory_stack.append(incl.parent)
text = utils.read_all_text_from_file(incl, logger=True).strip() + '\n'
@ -47,10 +56,7 @@ class Preprocessor:
self.__current_level -= 1
if self.__current_level == 1:
header = str(incl).replace('\\',r'/')
if header.startswith(self.__entry_root):
header = header[len(self.__entry_root):].strip('/')
header = utils.make_divider(header, 10, pattern = r'*')
header = utils.make_divider(relative_path, 10, pattern = r'*')
text = f'{header}\n\n{text}'
self.__directory_stack.pop()