File tree 2 files changed +8
-4
lines changed
tests/vendor/cget/pkg/pqrs-org__cpp-json/install/include/pqrs
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
- // pqrs::json v1.6
3
+ // pqrs::json v1.7
4
4
5
5
// (C) Copyright Takayama Fumihiko 2019.
6
6
// Distributed under the Boost Software License, Version 1.0.
Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ namespace pqrs_formatter {
61
61
// ```
62
62
63
63
struct options {
64
- int indent_size;
64
+ std::optional<int > indent_size;
65
+ std::optional<nlohmann::json::error_handler_t > error_handler;
65
66
std::unordered_set<std::string> force_multi_line_array_object_keys;
66
67
};
67
68
@@ -116,7 +117,7 @@ inline bool multi_line(const T& json,
116
117
inline void indent (std::ostringstream& ss,
117
118
const options& options,
118
119
int indent_level) {
119
- for (int i = 0 ; i < options.indent_size * indent_level; ++i) {
120
+ for (int i = 0 ; i < options.indent_size . value_or ( 4 ) * indent_level; ++i) {
120
121
ss << ' ' ;
121
122
}
122
123
}
@@ -243,7 +244,10 @@ inline void format(std::ostringstream& ss,
243
244
ss << ' ]' ;
244
245
}
245
246
} else {
246
- ss << json;
247
+ ss << json.dump (0 ,
248
+ ' ' ,
249
+ false ,
250
+ options.error_handler .value_or (nlohmann::json::error_handler_t ::strict));
247
251
}
248
252
}
249
253
You can’t perform that action at this time.
0 commit comments