Explorar el Código

Added a operator< method to ctkVersion.

Sascha Zelzer hace 13 años
padre
commit
951c9bdfa9
Se han modificado 2 ficheros con 18 adiciones y 0 borrados
  1. 6 0
      Libs/PluginFramework/ctkVersion.cpp
  2. 12 0
      Libs/PluginFramework/ctkVersion.h

+ 6 - 0
Libs/PluginFramework/ctkVersion.cpp

@@ -263,6 +263,12 @@ int ctkVersion::compare(const ctkVersion& other) const
 }
 
 //----------------------------------------------------------------------------
+bool ctkVersion::operator <(const ctkVersion &object) const
+{
+  return this->compare(object) < 0;
+}
+
+//----------------------------------------------------------------------------
 QDebug operator<<(QDebug dbg, const ctkVersion& v)
 {
   dbg << v.toString();

+ 12 - 0
Libs/PluginFramework/ctkVersion.h

@@ -244,6 +244,18 @@ public:
    */
   int compare(const ctkVersion& object) const;
 
+  /**
+   * Compares this <code>ctkVersion</code> object to another object.
+   *
+   * This is a convenience function for use in ordered containers. It relies on
+   * the compare(const ctkVersion&) method.
+   *
+   * @param object The <code>ctkVersion</code> object to be compared.
+   * @return <code>true</code> if this object is less then the specified
+   *         <code>ctkVersion</code> object, <code>false</code> otherwise.
+   */
+  bool operator<(const ctkVersion& object) const;
+
 };
 
 /**