MCPcopy Create free account
hub / github.com/couchbase/fleece / FLMutableArray_NewFromJSON

Function FLMutableArray_NewFromJSON

Fleece/API_Impl/Fleece.cc:232–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232FLMutableArray FLMutableArray_NewFromJSON(FLString json, FLError* outError) FLAPI {
233 if (outError != nullptr) {
234 *outError = kFLNoError;
235 }
236
237 FLDoc doc = FLDoc_FromJSON(json, outError);
238 if (doc == nullptr) {
239 return nullptr;
240 }
241
242 FLValue val = FLDoc_GetRoot(doc);
243 if (val == nullptr || val->type() != kArray) {
244 if (outError != nullptr) {
245 *outError = kFLInvalidData;
246 }
247 FLDoc_Release(doc);
248 return nullptr;
249 }
250
251 FLArray array = val->asArray();
252 FLMutableArray ret = _newMutableArray(array, kFLDeepCopyImmutables);
253 FLDoc_Release(doc);
254 return ret;
255}
256
257FLMutableArray FLArray_MutableCopy(FLArray a, FLCopyFlags flags) FLAPI {
258 return a ? _newMutableArray(a, flags) : nullptr;

Callers 1

MutableTests.ccFile · 0.85

Calls 6

FLDoc_FromJSONFunction · 0.85
FLDoc_GetRootFunction · 0.85
FLDoc_ReleaseFunction · 0.85
_newMutableArrayFunction · 0.85
typeMethod · 0.45
asArrayMethod · 0.45

Tested by

no test coverage detected