Skip to content

Commit 42871d4

Browse files
committed
wip
1 parent f0cd8f7 commit 42871d4

7 files changed

Lines changed: 31 additions & 16 deletions

File tree

samples/quickstart-ints.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,24 @@
66
// ryml can be used as a single header, or as a simple library:
77
#if defined(RYML_SINGLE_HEADER) // using the single header directly in the executable
88
#define RYML_SINGLE_HDR_DEFINE_NOW
9-
#include <ryml_all.hpp>
9+
#ifndef RYML_SINGLE_HEADER_INTS
10+
#include <ryml_all.hpp>
11+
#else
12+
#include <ryml_ints.hpp>
13+
#endif
1014
#elif defined(RYML_SINGLE_HEADER_LIB) // using the single header from a library
11-
#include <ryml_all.hpp>
15+
#ifndef RYML_SINGLE_HEADER_INTS
16+
#include <ryml_all.hpp>
17+
#else
18+
#include <ryml_ints.hpp>
19+
#endif
1220
#else
1321
#include <c4/yml/parse_engine.def.hpp>
1422
#endif
23+
24+
#ifndef RYML_SINGLE_HEADER_INTS
1525
#include <c4/yml/extra/event_handler_ints.hpp>
26+
#endif
1627

1728

1829
// NOLINTBEGIN(hicpp-signed-bitwise)

samples/singleheader-ints/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ amalgamate_ryml(SINGLE_HEADER_DIR SINGLE_HEADER)
99
add_executable(ryml-quickstart-ints ../quickstart-ints.cpp ${SINGLE_HEADER})
1010
target_compile_features(ryml-quickstart-ints PUBLIC cxx_std_11)
1111
target_compile_definitions(ryml-quickstart-ints PUBLIC -DRYML_SINGLE_HEADER)
12+
target_compile_definitions(ryml-quickstart-ints PUBLIC -DRYML_SINGLE_HEADER_INTS)
1213
target_include_directories(ryml-quickstart-ints PUBLIC "${SINGLE_HEADER_DIR}")
1314

1415
add_custom_target(run ryml-quickstart-ints

samples/singleheaderlib-ints/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ target_include_directories(ryml PUBLIC "${SINGLE_HEADER_DIR}")
1414
add_executable(ryml-quickstart-ints ../quickstart-ints.cpp)
1515
target_link_libraries(ryml-quickstart-ints PRIVATE ryml)
1616
target_compile_definitions(ryml-quickstart-ints PUBLIC -DRYML_SINGLE_HEADER_LIB)
17+
target_compile_definitions(ryml-quickstart-ints PUBLIC -DRYML_SINGLE_HEADER_INTS)
1718

1819
# adjustments for shared library
1920
if(BUILD_SHARED_LIBS)

src_extra/c4/yml/extra/event_handler_ints.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
#ifndef RYML_SINGLE_HEADER
1+
2+
#ifdef RYML_SINGLE_HEADER_INTS
3+
#include <ryml_ints.hpp>
4+
#elif defined(RYML_SINGLE_HEADER)
5+
#include <ryml_all.hpp>
6+
#else
27
#include <c4/yml/parse_engine.def.hpp>
38
#endif
9+
#ifndef RYML_SINGLE_HEADER_INTS
410
#include "c4/yml/extra/event_handler_ints.hpp"
11+
#endif
512

613
namespace c4 {
714
namespace yml {

src_extra/c4/yml/extra/event_handler_ints.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
* @see c4::yml::extra::EventHandlerInts
1010
* */
1111

12-
#ifdef RYML_SINGLE_HEADER
13-
#include <ryml_all.hpp>
14-
#else
12+
#ifndef RYML_SINGLE_HEADER
1513
#ifndef _C4_YML_NODE_TYPE_HPP_
1614
#include <c4/yml/node_type.hpp>
1715
#endif
@@ -26,7 +24,6 @@
2624
#endif
2725
#endif
2826

29-
3027
namespace c4 {
3128
namespace yml {
3229
namespace extra {
@@ -84,7 +81,7 @@ typedef enum : DataType {
8481
///< is set not to filter)
8582
UNFILT = (1 << 24),
8683
// Utility flags/masks
87-
LAST = UNFILT, ///< the last flag defined above
84+
LAST = UNFILT, ///< the last flag defined above
8885
MASK = (LAST << 1) - 1, ///< a mask of all bits in this enumeration
8986
WSTR = SCLR|ALIA|ANCH|TAG_, ///< with string: mask of all the events that encode a string
9087
///< following the event. in the event has a string. the next two
@@ -110,9 +107,9 @@ namespace extra {
110107
* the number of events without undergoing a full parse. This
111108
* estimation is meant to exceed the actual number of required events.
112109
*
113-
* @note This function overpredicts (as intended) for every case in
114-
* the hundreds/thousands of extensive tests of rapidyaml (both for
115-
* the YAML test suite and the internal cases). If you find a case
110+
* @note This function must overpredict. It does so for every case in
111+
* the hundreds/thousands of extensive tests of rapidyaml -- both for
112+
* the YAML test suite and the internal cases. If you find a case
116113
* where that does not hold, it is a bug. Please report it at
117114
* https://github.com/biojppm/rapidyaml/issues! */
118115
RYML_EXPORT int32_t estimate_events_ints_size(csubstr src);

src_extra/c4/yml/extra/event_handler_ints_utils.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#endif
88

99
C4_SUPPRESS_WARNING_GCC_WITH_PUSH("-Wold-style-cast")
10+
C4_SUPPRESS_WARNING_CLANG_WITH_PUSH("-Wold-style-cast")
1011
// NOLINTBEGIN(hicpp-signed-bitwise)
1112

1213
namespace c4 {
@@ -213,4 +214,5 @@ size_t emit_events_test_suite_from_ints(csubstr parsed_yaml,
213214
} // namespace c4
214215

215216
// NOLINTEND(hicpp-signed-bitwise)
217+
C4_SUPPRESS_WARNING_CLANG_POP
216218
C4_SUPPRESS_WARNING_GCC_POP

src_extra/c4/yml/extra/string.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#ifndef _C4_YML_EXTRA_STRING_HPP_
22
#define _C4_YML_EXTRA_STRING_HPP_
33

4-
#ifdef RYML_SINGLE_HEADER
5-
#ifndef _RYML_SINGLE_HEADER_AMALGAMATED_HPP_
6-
#include <ryml_all.hpp>
7-
#endif
8-
#else
4+
#ifndef RYML_SINGLE_HEADER
95
#ifndef _C4_YML_COMMON_HPP_
106
#include "c4/yml/common.hpp"
117
#endif

0 commit comments

Comments
 (0)