The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. #pragma once
  18. namespace juce
  19. {
  20. /**
  21. Represents the version number of a block device.
  22. @tags{Blocks}
  23. */
  24. struct BlocksVersion
  25. {
  26. public:
  27. /** The main value in a version number x.0.0 */
  28. int major = 0;
  29. /** The secondary value in a version number 1.x.0 */
  30. int minor = 0;
  31. /** The tertiary value in a version number 1.0.x */
  32. int patch = 0;
  33. /** The release tag for this version, such as "beta", "alpha", "rc", etc */
  34. String releaseType;
  35. /** A numerical value associated with the release tag, such as "beta 4" */
  36. int releaseCount = 0;
  37. /** The associated git commit that generated this firmware version */
  38. String commit;
  39. /** Identify "forced" firmware builds **/
  40. bool forced = false;
  41. String toString (bool extended = false) const;
  42. /** Constructs a version number from an formatted String */
  43. BlocksVersion (const String&);
  44. /** Constructs a version number from another BlocksVersion */
  45. BlocksVersion (const BlocksVersion& other) = default;
  46. /** Creates an empty version number **/
  47. BlocksVersion() = default;
  48. /** Returns true if string format is valid */
  49. static bool isValidVersion (const String& versionString);
  50. bool operator == (const BlocksVersion&) const;
  51. bool operator != (const BlocksVersion&) const;
  52. bool operator < (const BlocksVersion&) const;
  53. bool operator > (const BlocksVersion&) const;
  54. bool operator <= (const BlocksVersion&) const;
  55. bool operator >= (const BlocksVersion&) const;
  56. private:
  57. /** @internal */
  58. bool evaluate (const String& versionString);
  59. bool releaseTypeGreaterThan (const BlocksVersion& otherReleaseType) const;
  60. bool isGreaterThan (const BlocksVersion& other) const;
  61. bool isEqualTo (const BlocksVersion& other) const;
  62. };
  63. } // namespace juce