Logo Search packages:      
Sourcecode: massxpert version File versions

int massXpert::CleaveSpec::isNameInList ( const QString &  str,
const QList< CleaveSpec * > &  refList,
CleaveSpec other = 0 
) [static]

Searches a cleavage specification in a list.

Searches for a cleavage specification having a name identical to argument str in refList. If such cleavage specification is found, and if other is non-0, the found cleavage specification's data are copied into other.

Parameters:
str name.
refList list of cleavage specifications.
other cleavage specification to be updated with data in the found cleavage specification. Defaults to 0, in which case no update occurs.
Returns:
the int index of the found cleavage specification or -1 if none is found or if str is empty.

Definition at line 250 of file cleaveSpec.cpp.

References clone(), and massXpert::PolChemDefEntity::m_name.

  {
    CleaveSpec *cleaveSpec = 0;

    if (str.isEmpty())
      return -1;
  
    for (int iter = 0; iter < refList.size(); ++iter)
      {
      cleaveSpec = refList.at(iter);
      Q_ASSERT(cleaveSpec);

      if(cleaveSpec->m_name == str)
        {
          if (other)
            cleaveSpec->clone(other);
        
          return iter;
        }
      }
  
    return -1;
  }


Generated by  Doxygen 1.6.0   Back to index