Skip to content

Commit 51a3487

Browse files
committed
[cleanup] Remove parameter of JSONItem::createArray
1 parent 82ef04d commit 51a3487

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

CodeLite/JSON.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,9 @@ void JSONItem::arrayAppend(const JSONItem& element)
376376
}
377377
}
378378

379-
JSONItem JSONItem::createArray(const wxString& name)
379+
JSONItem JSONItem::createArray()
380380
{
381381
JSONItem arr(cJSON_CreateArray());
382-
arr.SetPropertyName(name);
383382
arr.setType(cJSON_Array);
384383
return arr;
385384
}
@@ -501,11 +500,11 @@ JSONItem& JSONItem::addProperty(const wxString& name, long value)
501500

502501
JSONItem& JSONItem::addProperty(const wxString& name, const wxArrayString& arr)
503502
{
504-
JSONItem arrEle = JSONItem::createArray(name);
503+
JSONItem arrEle = JSONItem::createArray();
505504
for (const auto& s : arr) {
506505
arrEle.arrayAppend(s);
507506
}
508-
append(arrEle);
507+
addProperty(name, arrEle);
509508
return *this;
510509
}
511510

@@ -621,14 +620,14 @@ JSONItem& JSONItem::addProperty(const wxString& name, const wxStringMap_t& strin
621620
if (!m_json)
622621
return *this;
623622

624-
JSONItem arr = JSONItem::createArray(name);
623+
JSONItem arr = JSONItem::createArray();
625624
for (const auto& [key, value] : stringMap) {
626625
JSONItem obj = JSONItem::createObject();
627626
obj.addProperty("key", key);
628627
obj.addProperty("value", value);
629628
arr.arrayAppend(obj);
630629
}
631-
append(arr);
630+
addProperty(name, arr);
632631
return *this;
633632
}
634633
#endif
@@ -753,8 +752,8 @@ JSONItem& JSONItem::addProperty(const wxString& name, const wxFileName& filename
753752

754753
JSONItem JSONItem::AddArray(const wxString& name)
755754
{
756-
JSONItem json = createArray(name);
757-
append(json);
755+
JSONItem json = createArray();
756+
addProperty(name, json);
758757
return json;
759758
}
760759

CodeLite/JSON.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ class WXDLLIMPEXP_CL JSONItem
171171
*/
172172
static JSONItem createObject(const wxString& name = wxT(""));
173173
/**
174-
* @brief create new named array and append it to this json element
174+
* @brief create new array
175175
* @return the newly created array
176176
*/
177-
static JSONItem createArray(const wxString& name = wxT(""));
177+
static JSONItem createArray();
178178

179179
/**
180180
* @brief add array to this json and return a reference to the newly added array

0 commit comments

Comments
 (0)