/src/gdal/frmts/pds/json_utils.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef JSON_UTILS_H_INCLUDED |
2 | | #define JSON_UTILS_H_INCLUDED |
3 | | |
4 | | #include "cpl_json.h" |
5 | | |
6 | | /** |
7 | | * Get or create CPLJSONObject. |
8 | | * @param oParent Parent CPLJSONObject. |
9 | | * @param osKey Key name. |
10 | | * @return CPLJSONObject class instance. |
11 | | */ |
12 | | static CPLJSONObject GetOrCreateJSONObject(CPLJSONObject &oParent, |
13 | | const std::string &osKey) |
14 | 0 | { |
15 | 0 | CPLJSONObject oChild = oParent[osKey]; |
16 | 0 | if (oChild.IsValid() && oChild.GetType() != CPLJSONObject::Type::Object) |
17 | 0 | { |
18 | 0 | oParent.Delete(osKey); |
19 | 0 | oChild.Deinit(); |
20 | 0 | } |
21 | |
|
22 | 0 | if (!oChild.IsValid()) |
23 | 0 | { |
24 | 0 | oChild = CPLJSONObject(); |
25 | 0 | oParent.Add(osKey, oChild); |
26 | 0 | } |
27 | 0 | return oChild; |
28 | 0 | } Unexecuted instantiation: isis3dataset.cpp:GetOrCreateJSONObject(CPLJSONObject&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: vicardataset.cpp:GetOrCreateJSONObject(CPLJSONObject&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) |
29 | | |
30 | | #endif /* JSON_UTILS_H_INCLUDED */ |