File tree 3 files changed +22
-6
lines changed
3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,19 @@ JsonReader::GetChildNodeName(SizeT childIndex)
323
323
return " " ;
324
324
}
325
325
326
+ // ------------------------------------------------------------------------------
327
+ /* *
328
+
329
+ */
330
+ bool
331
+ JsonReader::IsString () const
332
+ {
333
+ n_assert (this ->IsOpen ());
334
+ n_assert (0 != this ->curNode );
335
+ return this ->curNode ->is_string ();
336
+ }
337
+
338
+
326
339
// ------------------------------------------------------------------------------
327
340
/* *
328
341
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ class JsonReader : public StreamReader
60
60
// / gets the childname of the child at index, or empty string if no child exists or has no name.
61
61
Util::String GetChildNodeName (SizeT childIndex);
62
62
63
+ // / check if current node is a string
64
+ bool IsString () const ;
63
65
// / check if current node is an array
64
66
bool IsArray () const ;
65
67
// / check if current node is an object (can have keys)
Original file line number Diff line number Diff line change @@ -200,22 +200,23 @@ ProjectInfo::ParseProjectInfoFile(const IO::URI & path)
200
200
201
201
if (jsonReader->SetToFirstChild ()) do
202
202
{
203
- if (!jsonReader->HasChildren ())
204
- {
205
- this ->attrs .Add (jsonReader->GetCurrentNodeName (), jsonReader->GetString ());
206
- }
207
- else
203
+ String thing = jsonReader->GetCurrentNodeName ();
204
+ if (jsonReader->HasChildren ())
208
205
{
209
206
String currentKey = jsonReader->GetCurrentNodeName ();
210
207
Dictionary<String, String> values;
211
208
jsonReader->SetToFirstChild ();
212
209
do
213
210
{
214
211
values.Add (jsonReader->GetString (" Name" ), jsonReader->GetString (" Value" ));
215
- }
212
+ }
216
213
while (jsonReader->SetToNextChild ());
217
214
this ->listAttrs .Add (currentKey, values);
218
215
}
216
+ else if (jsonReader->IsString ())
217
+ {
218
+ this ->attrs .Add (jsonReader->GetCurrentNodeName (), jsonReader->GetString ());
219
+ }
219
220
}
220
221
while (jsonReader->SetToNextChild ());
221
222
return Success;
You can’t perform that action at this time.
0 commit comments