pVersion.sip 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*!
  2. \file pVersion.h
  3. \brief This class is an helper for comparing string based application versions.
  4. \author Filipe Azevedo aka Nox P\@sNox <pasnox@gmail.com>
  5. */
  6. /*!
  7. \ingroup Core
  8. \class pVersion
  9. \brief This class is an helper for comparing string based application versions.
  10. The pVersion class help you to compare string based versions number like "1.5.0b", "1.6.0rc" etc.
  11. All kind of operators or available like <, >, !=, == etc.
  12. \code
  13. const pVersion v1( "1.5.0" );
  14. const pVersion v2( "1.5.1" );
  15. if ( v1 < v2 ) {
  16. qWarning( "v1 is smaller version than v2 !" );
  17. }
  18. else {
  19. qWarning( "v1 is bigger than v2 !" );
  20. }
  21. \endcode
  22. */
  23. class pVersion
  24. {
  25. %TypeHeaderCode
  26. #include <../src/core/pVersion.h>
  27. %End
  28. public:
  29. /*!
  30. \brief Create a pVersion initialized with the string version \a version.
  31. \param version A QString representing the version number.
  32. */
  33. pVersion( const QString& version );
  34. /*!
  35. \brief Return the string based version number.
  36. \return A QString containing the string version number.
  37. */
  38. QString toString() const;
  39. /*!
  40. \brief Check if this version is equal to \a other.
  41. \param other The version to compare to.
  42. \return Return true if this version is equal to \a other else false.
  43. */
  44. bool operator==( const pVersion& other ) const;
  45. /*!
  46. \brief Check if this version is different from \a other.
  47. \param other The version to compare to.
  48. \return Return true if this version is different from \a other else false.
  49. */
  50. bool operator!=( const pVersion& other ) const;
  51. /*!
  52. \brief Check if this version is smaller than \a other.
  53. \param other The version to compare to.
  54. \return Return true if this version is smaller than \a other else false.
  55. */
  56. bool operator<( const pVersion& other ) const;
  57. /*!
  58. \brief Check if this version is bigger than \a other.
  59. \param other The version to compare to.
  60. \return Return true if this version is bigger than \a other else false.
  61. */
  62. bool operator>( const pVersion& other ) const;
  63. /*!
  64. \brief Check if this version is smaller or equal to \a other.
  65. \param other The version to compare to.
  66. \return Return true if this version is smaller or equal to \a other else false.
  67. */
  68. bool operator<=( const pVersion& other ) const;
  69. /*!
  70. \brief Check if this version is bigger or equal to \a other.
  71. \param other The version to compare to.
  72. \return Return true if this version is bigger or equal to \a other else false.
  73. */
  74. bool operator>=( const pVersion& other ) const;
  75. };