Audio plugin host https://kx.studio/carla
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.

47 lines
1.2KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. version.cpp - implementation of version_type class
  4. Copyright (C) 2016 Johannes Lorenz
  5. Author: Johannes Lorenz
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #include <iostream>
  12. #include "version.h"
  13. constexpr int version_type::v_strcmp(const version_type& v2, int i) const
  14. {
  15. return (i == sizeof(version))
  16. ? 0
  17. : ((version[i] == v2.version[i])
  18. ? v_strcmp(v2, i+1)
  19. : (version[i] - v2.version[i]));
  20. }
  21. constexpr bool version_type::operator<(const version_type& other) const
  22. {
  23. return v_strcmp(other, 0) < 0;
  24. }
  25. std::ostream& operator<< (std::ostream& os,
  26. const version_type& v)
  27. {
  28. return os << v.major() << '.'
  29. << v.minor() << '.'
  30. << v.revision();
  31. }
  32. static_assert(!(version_type(3,1,1) < version_type(1,3,3)),
  33. "version operator failed");
  34. static_assert(version_type(2,9,9) < version_type(3,4,3),
  35. "version operator failed");
  36. static_assert(!(version_type(2,4,3) < version_type(2,4,3)),
  37. "version operator failed");