@@ -22,6 +22,8 @@ namespace toon {
2222
2323enum class toon_delimiter_kind : char {comma=' ,' , tab=' \t ' , pipe=' |' };
2424
25+ enum class key_folding_kind {off, safe};
26+
2527class toon_options ;
2628
2729class toon_options_common
@@ -66,6 +68,7 @@ class toon_decode_options : public virtual toon_options_common
6668 using typename super_type::string_type;
6769private:
6870 bool strict_{true };
71+ key_folding_kind expand_paths_{key_folding_kind::off};
6972public:
7073 toon_decode_options () = default ;
7174
@@ -80,6 +83,7 @@ class toon_decode_options : public virtual toon_options_common
8083 toon_decode_options& operator =(toon_decode_options&&) = default ;
8184public:
8285 bool strict () const {return strict_;}
86+ key_folding_kind expand_paths () const {return expand_paths_;}
8387};
8488
8589class toon_encode_options : public virtual toon_options_common
@@ -92,6 +96,8 @@ class toon_encode_options : public virtual toon_options_common
9296private:
9397 toon_delimiter_kind delimiter_{toon_delimiter_kind::comma};
9498 jsoncons::optional<char > length_marker_;
99+ key_folding_kind key_folding_{key_folding_kind::off};
100+ std::size_t flatten_depth_{1024 };
95101public:
96102 toon_encode_options () = default ;
97103
@@ -117,6 +123,10 @@ class toon_encode_options : public virtual toon_options_common
117123 {
118124 return length_marker_;
119125 }
126+
127+ key_folding_kind key_folding () const {return key_folding_;}
128+
129+ std::size_t flatten_depth () const {return flatten_depth_;}
120130};
121131
122132class toon_options final : public toon_decode_options,
@@ -129,8 +139,11 @@ class toon_options final: public toon_decode_options,
129139 using toon_options_common::indent;
130140 using toon_options_common::max_nesting_depth;
131141 using toon_decode_options::strict;
142+ using toon_decode_options::expand_paths;
132143 using toon_encode_options::delimiter;
133144 using toon_encode_options::length_marker;
145+ using toon_encode_options::key_folding;
146+ using toon_encode_options::flatten_depth;
134147public:
135148
136149// Constructors
@@ -165,6 +178,24 @@ class toon_options final: public toon_decode_options,
165178 return *this ;
166179 }
167180
181+ toon_options& key_folding (key_folding_kind value)
182+ {
183+ this ->key_folding_ = value;
184+ return *this ;
185+ }
186+
187+ toon_options& flatten_depth (std::size_t value)
188+ {
189+ this ->flatten_depth_ = value;
190+ return *this ;
191+ }
192+
193+ toon_options& expand_paths (key_folding_kind value)
194+ {
195+ this ->expand_paths_ = value;
196+ return *this ;
197+ }
198+
168199 toon_options& max_nesting_depth (int value)
169200 {
170201 this ->max_nesting_depth_ = value;
0 commit comments