configurationnode.cpp
27 ConfigurationNode::ConfigurationNode(ConfigurationNode *parent, QString name, bool caseSensitive) :
30 m_name(((name == ConfigurationParameters::GroupSeparator()) || (name == ConfigurationParameters::ParentGroup())) ? QString() : name),
77 // If we have a parent, calling its getAncestorsNames and appending us to the result, otherwise returning the
105 // Not adding the node if its name is NULL, the group separator or the parent node or if this is a null node
106 if ((isNull()) || (name.isEmpty()) || (name == ConfigurationParameters::GroupSeparator()) || (name == ConfigurationParameters::ParentGroup())) {
113 if ( child.compare( name, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
129 return const_cast<ConfigurationNode*>((const_cast<const ConfigurationNode*>(this))->getNode(path));
139 QString firstNode = path.section(ConfigurationParameters::GroupSeparator(), 0, 0, QString::SectionSkipEmpty);
142 // If the first node is the empty string (i.e. the whole path is the empty string) returning this
150 // Getting the first node from the list of my children and, if it exists, calling its getNode function
152 if ( child.compare( firstNode, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
153 QString remainingPath = path.section(ConfigurationParameters::GroupSeparator(), 1, -1, QString::SectionSkipEmpty);
171 if ( child.compare( name, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
184 if (isNull() || (newName.isEmpty()) || (newName == ConfigurationParameters::GroupSeparator()) || (newName == ConfigurationParameters::ParentGroup())) {
191 if ( child.compare( oldName, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
224 bool ConfigurationNode::setObjectForNode(QString path, ParameterSettable* object, ObjectCreationStatus status)
262 // Not adding the property if its name is NULL, the group separator, the parent group or if this is a null node
263 if ((isNull()) || (name.isEmpty()) || (name == ConfigurationParameters::GroupSeparator()) || (name == ConfigurationParameters::ParentGroup())) {
269 if ( parameter.compare( name, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
289 QString firstPart = path.section(ConfigurationParameters::GroupSeparator(), 0, 0, QString::SectionSkipEmpty);
290 QString remainingPath = path.section(ConfigurationParameters::GroupSeparator(), 1, -1, QString::SectionSkipEmpty);
295 if ( parameter.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
301 // Calling the function in parent group (calling it again on ourself if we don't have any parent group)
311 QString parameterName = path.section(ConfigurationParameters::GroupSeparator(), -1, -1, QString::SectionSkipEmpty);
313 if ( parameter.compare( parameterName, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
320 // Getting the first node from the list of my children and, if it exists, calling its getValue function
322 if ( child.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
324 // If we also have to match the parameter in parents and the parameter wasn't found in children,
336 ConfigurationNode::ObjectAndStatus ConfigurationNode::getObject(QString path, bool alsoMatchParents) const
346 QString firstPart = path.section(ConfigurationParameters::GroupSeparator(), 0, 0, QString::SectionSkipEmpty);
347 QString remainingPath = path.section(ConfigurationParameters::GroupSeparator(), 1, -1, QString::SectionSkipEmpty);
351 if ( parameter.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
357 // Calling the function in parent group (calling it again on ourself if we don't have any parent group)
367 QString parameterName = path.section(ConfigurationParameters::GroupSeparator(), -1, -1, QString::SectionSkipEmpty);
369 if ( parameter.compare( parameterName, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
376 // Getting the first node from the list of my children and, if it exists, calling its getObject function
378 if ( child.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
380 // If we also have to match the parameter in parents and the parameter wasn't found in children,
400 QString firstPart = path.section(ConfigurationParameters::GroupSeparator(), 0, 0, QString::SectionSkipEmpty);
401 QString remainingPath = path.section(ConfigurationParameters::GroupSeparator(), 1, -1, QString::SectionSkipEmpty);
406 if ( parameter.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
413 // Calling the function in parent group (calling it again on ourself if we don't have any parent group)
418 // Getting the first node from the list of my children and, if it exists, calling its setValue function
420 if ( child.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
435 QString firstPart = path.section(ConfigurationParameters::GroupSeparator(), 0, 0, QString::SectionSkipEmpty);
436 QString remainingPath = path.section(ConfigurationParameters::GroupSeparator(), 1, -1, QString::SectionSkipEmpty);
441 if ( parameter.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
451 // Calling the function in parent group (calling it again on ourself if we don't have any parent group)
456 // Getting the first node from the list of my children and, if it exists, calling its setValue function
458 if ( child.compare( firstPart, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {
474 if ( parameter.compare( name, (m_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive) ) == 0 ) {