MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / set_type

Method set_type

include/chaiscript/utility/json.hpp:166–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 }
165
166 void set_type( Class type ) {
167 if( type == Type ) {
168 return;
169 }
170
171 Map.reset();
172 List.reset();
173 String.reset();
174
175 switch( type ) {
176 case Class::Object: Map = std::make_unique<QuickFlatMap>(); break;
177 case Class::Array: List = std::make_unique<std::vector<JSON>>(); break;
178 case Class::String: String = std::make_unique<std::string>(); break;
179 case Class::Floating: Float = 0.0; break;
180 case Class::Integral: Int = 0; break;
181 case Class::Boolean: Bool = false; break;
182 case Class::Null: break;
183 }
184
185 Type = type;
186 }
187
188 Internal(Internal &&) = default;
189 Internal &operator=(Internal &&) = default;

Callers 1

JSONClass · 0.80

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected