File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
Expand file tree Collapse file tree 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)
323323 return " " ;
324324}
325325
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+
326339// ------------------------------------------------------------------------------
327340/* *
328341
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ class JsonReader : public StreamReader
6060 // / gets the childname of the child at index, or empty string if no child exists or has no name.
6161 Util::String GetChildNodeName (SizeT childIndex);
6262
63+ // / check if current node is a string
64+ bool IsString () const ;
6365 // / check if current node is an array
6466 bool IsArray () const ;
6567 // / 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)
200200
201201 if (jsonReader->SetToFirstChild ()) do
202202 {
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 ())
208205 {
209206 String currentKey = jsonReader->GetCurrentNodeName ();
210207 Dictionary<String, String> values;
211208 jsonReader->SetToFirstChild ();
212209 do
213210 {
214211 values.Add (jsonReader->GetString (" Name" ), jsonReader->GetString (" Value" ));
215- }
212+ }
216213 while (jsonReader->SetToNextChild ());
217214 this ->listAttrs .Add (currentKey, values);
218215 }
216+ else if (jsonReader->IsString ())
217+ {
218+ this ->attrs .Add (jsonReader->GetCurrentNodeName (), jsonReader->GetString ());
219+ }
219220 }
220221 while (jsonReader->SetToNextChild ());
221222 return Success;
You can’t perform that action at this time.
0 commit comments