comparison base/PropertyContainer.cpp @ 1582:70e172e6cc59 fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:33:41 +0000
parents 48e9f538e6e9
children
comparison
equal deleted inserted replaced
1581:ad5f892c0c4d 1582:70e172e6cc59
66 } 66 }
67 67
68 RangeMapper * 68 RangeMapper *
69 PropertyContainer::getNewPropertyRangeMapper(const PropertyName &) const 69 PropertyContainer::getNewPropertyRangeMapper(const PropertyName &) const
70 { 70 {
71 return 0; 71 return nullptr;
72 } 72 }
73 73
74 void 74 void
75 PropertyContainer::setProperty(const PropertyName &name, int) 75 PropertyContainer::setProperty(const PropertyName &name, int)
76 { 76 {
78 } 78 }
79 79
80 Command * 80 Command *
81 PropertyContainer::getSetPropertyCommand(const PropertyName &name, int value) 81 PropertyContainer::getSetPropertyCommand(const PropertyName &name, int value)
82 { 82 {
83 int currentValue = getPropertyRangeAndValue(name, 0, 0, 0); 83 int currentValue = getPropertyRangeAndValue(name, nullptr, nullptr, nullptr);
84 if (value == currentValue) return 0; 84 if (value == currentValue) return nullptr;
85 return new SetPropertyCommand(this, name, value); 85 return new SetPropertyCommand(this, name, value);
86 } 86 }
87 87
88 void 88 void
89 PropertyContainer::setPropertyFuzzy(QString nameString, QString valueString) 89 PropertyContainer::setPropertyFuzzy(QString nameString, QString valueString)
108 if (!convertPropertyStrings(nameString, valueString, name, value)) { 108 if (!convertPropertyStrings(nameString, valueString, name, value)) {
109 cerr << "WARNING: PropertyContainer::getSetPropertyCommand(\"" 109 cerr << "WARNING: PropertyContainer::getSetPropertyCommand(\""
110 << nameString << "\", \"" 110 << nameString << "\", \""
111 << valueString 111 << valueString
112 << "\"): Name and value conversion failed" << endl; 112 << "\"): Name and value conversion failed" << endl;
113 return 0; 113 return nullptr;
114 } 114 }
115 return getSetPropertyCommand(name, value); 115 return getSetPropertyCommand(name, value);
116 } 116 }
117 117
118 bool 118 bool
179 case ValueProperty: 179 case ValueProperty:
180 case ColourProperty: 180 case ColourProperty:
181 case ColourMapProperty: 181 case ColourMapProperty:
182 { 182 {
183 int min, max; 183 int min, max;
184 getPropertyRangeAndValue(name, &min, &max, 0); 184 getPropertyRangeAndValue(name, &min, &max, nullptr);
185 for (int i = min; i <= max; ++i) { 185 for (int i = min; i <= max; ++i) {
186 if (valueString == getPropertyValueLabel(name, i)) { 186 if (valueString == getPropertyValueLabel(name, i)) {
187 value = i; 187 value = i;
188 success = true; 188 success = true;
189 break; 189 break;
204 } 204 }
205 205
206 if (success) return true; 206 if (success) return true;
207 207
208 int min, max; 208 int min, max;
209 getPropertyRangeAndValue(name, &min, &max, 0); 209 getPropertyRangeAndValue(name, &min, &max, nullptr);
210 210
211 bool ok = false; 211 bool ok = false;
212 int i = valueString.toInt(&ok); 212 int i = valueString.toInt(&ok);
213 if (!ok) { 213 if (!ok) {
214 cerr << "PropertyContainer::convertPropertyStrings: Unable to parse value string \"" << valueString << "\"" << endl; 214 cerr << "PropertyContainer::convertPropertyStrings: Unable to parse value string \"" << valueString << "\"" << endl;
233 } 233 }
234 234
235 void 235 void
236 PropertyContainer::SetPropertyCommand::execute() 236 PropertyContainer::SetPropertyCommand::execute()
237 { 237 {
238 m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, 0, 0, 0); 238 m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, nullptr, nullptr, nullptr);
239 m_pc->setProperty(m_pn, m_value); 239 m_pc->setProperty(m_pn, m_value);
240 } 240 }
241 241
242 void 242 void
243 PropertyContainer::SetPropertyCommand::unexecute() 243 PropertyContainer::SetPropertyCommand::unexecute()