Changeset 950 for cpp/frams/param/param.cpp
- Timestamp:
- 06/20/20 01:02:20 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r914 r950 331 331 } 332 332 333 SString ParamInterface::nameDotProperty(int prop) 334 { 335 SString ret = getName(); 336 ret+="."; 337 ret+=id(prop); 338 return ret; 339 } 340 341 SString ParamInterface::nameDotPropertyForMessages(int prop) 342 { 343 SString name_dot_prop = nameDotProperty(prop); 344 if (strcmp(getName(),getLongName())==0) 345 { 346 if (strcmp(id(prop),name(prop))==0) 347 return name_dot_prop; 348 else 349 return SString("'")+name(prop)+"': "+name_dot_prop; 350 } 351 else 352 return SString("'")+name(prop)+"' in '"+getLongName()+"': "+name_dot_prop; 353 } 333 354 334 355 int SimpleAbstractParam::isequal(int i, void* defdata) … … 421 442 SString field; 422 443 if (field_index >= 0) 423 field = SString::sprintf("'%s.%s'", pi->getName(), pi->id(field_index));444 field = pi->nameDotPropertyForMessages(field_index); 424 445 else 425 446 field = SString::sprintf("unknown property of '%s'", pi->getName()); … … 445 466 bool show_length = valuetoset.getType() == TString; 446 467 const char* quote = (valuetoset.getType() == TString) ? "\"" : "'"; 447 logPrintf("Param", "set", LOG_WARN, "Setting %s .%s= %s exceeded allowed range (too %s). %s to %s.",448 getName(), id(i),468 logPrintf("Param", "set", LOG_WARN, "Setting %s = %s exceeded allowed range (too %s). %s to %s.", 469 nameDotPropertyForMessages(i).c_str(), 449 470 ::sstringDelimitAndShorten(svaluetoset, 30, show_length, quote, quote).c_str(), 450 471 (setflags&PSET_HITMAX) ? (s_type ? "long" : "big") : "small", s_type ? "Truncated" : "Adjusted", … … 674 695 case 'o': ret.setObject(getObject(i)); break; 675 696 case 'x': ret = getExtValue(i); break; 676 default: logPrintf("ParamInterface", "get", LOG_ERROR, " '%s.%s' is not a property", getName(), id(i));697 default: logPrintf("ParamInterface", "get", LOG_ERROR, "%s is not a property", nameDotPropertyForMessages(i).c_str()); 677 698 } 678 699 } … … 718 739 if (v.type == TObj) 719 740 { 720 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting int '%s.%s' from object reference (%s)", getName(), id(i), v.getString().c_str());741 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting int %s from object reference (%s)", nameDotPropertyForMessages(i).c_str(), v.getString().c_str()); 721 742 return 0; 722 743 } … … 730 751 if (v.type == TObj) 731 752 { 732 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting float '%s.%s' from object reference (%s)", getName(), id(i), v.getString().c_str());753 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting float %s from object reference (%s)", nameDotPropertyForMessages(i).c_str(), v.getString().c_str()); 733 754 return 0; 734 755 } … … 739 760 case 'o': 740 761 if ((v.type != TUnknown) && (v.type != TObj)) 741 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting object '%s.%s' from %s", getName(), id(i), v.typeAndValue().c_str());762 logPrintf("ParamInterface", "set", LOG_ERROR, "Setting object %s from %s", nameDotPropertyForMessages(i).c_str(), v.typeAndValue().c_str()); 742 763 else 743 764 return setObject(i, v.getObject()); 744 765 break; 745 766 case 'x': return setExtValue(i, v); 746 default: logPrintf("ParamInterface", "set", LOG_ERROR, " '%s.%s' is not a property", getName(), id(i));767 default: logPrintf("ParamInterface", "set", LOG_ERROR, "%s is not a property", nameDotPropertyForMessages(i).c_str()); 747 768 } 748 769 return 0; … … 922 943 if (err != NULL) 923 944 logPrintf("SimpleAbstractParam", "sanityCheck", LOG_ERROR, 924 "Invalid ParamEntry for %s.%s (%s)", getName(), pe->id, err);945 "Invalid ParamEntry for %s (%s)", nameDotPropertyForMessages(i).c_str(), err); 925 946 } 926 947 #endif … … 1156 1177 else 1157 1178 logPrintf("SimpleAbstractParam", "setObject", LOG_ERROR, 1158 " '%s.%s' is PARAM_OBJECTSET but no 'assign()' in %s", getName(), pe->id, o.interfaceName());1179 "%s is PARAM_OBJECTSET but no 'assign()' in %s", nameDotPropertyForMessages(i).c_str(), o.interfaceName()); 1159 1180 return PSET_CHANGED; 1160 1181 } … … 1205 1226 { 1206 1227 logPrintf("SimpleAbstractParam", "call", LOG_ERROR, 1207 (*pe->type != 'p') ? " '%s.%s' is not a function" : "Internal error - undefined function pointer for '%s.%s'", getName(), pe->id);1228 (*pe->type != 'p') ? "%s is not a function" : "Internal error - undefined function pointer for %s", nameDotPropertyForMessages(i).c_str()); 1208 1229 ret->setInvalid(); 1209 1230 }
Note: See TracChangeset
for help on using the changeset viewer.