mpr-version.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. mpr-version.h -- Header for the Embedthis Version Library
  3. Copyright (c) All Rights Reserved. See copyright notice at the bottom of the file.
  4. */
  5. #ifndef _h_VERSION
  6. #define _h_VERSION 1
  7. /********************************* Includes ***********************************/
  8. #include "mpr.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /********************************** Defines ***********************************/
  13. /**
  14. Version object
  15. @description The Version class provides the ability to manage SemVer version numbers
  16. @defgroup Version Version
  17. @stability Prototype
  18. */
  19. typedef struct MprVersion {
  20. cchar *full; /**< Original version string */
  21. cchar *baseVersion; /**< Base version portion without pre-release suffix */
  22. cchar *preVersion; /**< Pre-release version suffix */
  23. uint64 numberVersion; /**< Version string as a number (excludes prerelease suffix) */
  24. int major;
  25. int minor;
  26. int patch;
  27. bool ok; /**< Version is a valid a SemVer */
  28. } MprVersion;
  29. PUBLIC cchar *mprBumpVersion(cchar *version);
  30. MprVersion *mprCreateVersion(cchar *version);
  31. PUBLIC cchar *mprGetCompatibleVersion(cchar *version);
  32. PUBLIC int mprGetMajorVersion(cchar *version);
  33. PUBLIC int mprGetMinorVersion(cchar *version);
  34. PUBLIC int mprGetPatchVersion(cchar *version);
  35. PUBLIC cchar *mprGetPrereleaseVersion(cchar *version);
  36. PUBLIC cchar *mprGetVersionBase(cchar *version);
  37. PUBLIC int64 mprGetVersionNumber(cchar *version);
  38. PUBLIC bool mprIsVersionAcceptable(cchar *version, cchar *criteria);
  39. PUBLIC bool mprIsVersionSame(cchar *version, cchar *other);
  40. PUBLIC bool mprIsVersionValid(cchar *version);
  41. PUBLIC void mprSortVersions(MprVersion **versions, ssize nelt, int direction);
  42. PUBLIC bool mprIsVersionObjAcceptable(MprVersion *vp, cchar *criteria);
  43. #ifdef __cplusplus
  44. } /* extern C */
  45. #endif
  46. #endif /* _h_VERSION */
  47. /*
  48. Copyright (c) Embedthis Software. All Rights Reserved.
  49. This software is distributed under a commercial license. Consult the LICENSE.md
  50. distributed with this software for full details and copyrights.
  51. */