Skip to content

Commit 1dac132

Browse files
author
Joe Andolina
committed
More Work
1 parent 2058d1f commit 1dac132

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/JSONVar.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -415,17 +415,17 @@ void JSONVar::replaceJson(struct cJSON* json)
415415
//---------------------------------------------------------------------
416416

417417
bool JSONVar::hasPropertyEqualTo(const String& key, String& value) const{
418-
return hasPropertyEqualTo(key.c_str(), value.c_str());
418+
return this.hasPropertyEqualTo(key.c_str(), value.c_str());
419419
}
420420

421421
//---------------------------------------------------------------------
422422

423423
bool JSONVar::hasPropertyEqualTo(const char* key, const char* value) const {
424-
if(!hasProperty(sourceProperty)){
424+
if(!this.hasProperty(key)){
425425
return false;
426426
}
427427

428-
if(strcmp(targetValue, source[sourceProperty]) == 0){
428+
if(strcmp(value, this[key]) == 0){
429429
return true;
430430
}
431431

@@ -435,29 +435,29 @@ bool JSONVar::hasPropertyEqualTo(const char* key, const char* value) const {
435435
//---------------------------------------------------------------------
436436

437437
JSONVar JSONVar::getPropertyWithValue(const String& key, String& value, String child = "") const {
438-
return getPropertyWithValue(key..c_str(), value.c_str(), child.c_str());
438+
return this.getPropertyWithValue(key..c_str(), value.c_str(), child.c_str());
439439
}
440440

441441
//---------------------------------------------------------------------
442442

443443
JSONVar JSONVar::getPropertyWithValue(const char* key, const char* value, const char* child = '') const {
444444
if(this.hasOwnPropertyEqualTo(key, value)){
445-
if(source.hasOwnProperty(childName)){
446-
return source[childName];
445+
if(this.hasOwnProperty(child)){
446+
return this[child];
447447
}
448448
else {
449-
return source;
449+
return this;
450450
}
451451
}
452452

453-
if(JSON.typeof_(source) == "array"){
454-
for (int i = 0; i < source.length(); ++i) {
455-
if(_hasMatch(source[i], sourceProperty, targetValue)){
456-
if(source[i].hasOwnProperty(childName)){
457-
return source[i][childName];
453+
if(JSON.typeof_(this) == "array"){
454+
for (int i = 0; i < this.length(); ++i) {
455+
if(this.hasPropertyEqualTo(key, value)){
456+
if(this[i].hasOwnProperty(child)){
457+
return this[i][child];
458458
}
459459
else {
460-
return source[i];
460+
return this[i];
461461
}
462462
}
463463
}

0 commit comments

Comments
 (0)