feat(lib): initialize libnextcloud C++17 library scaffolding (#25)

This commit is contained in:
2026-01-28 09:47:34 -08:00
parent e2d31dc053
commit bed4cc0121
8 changed files with 838 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
#ifndef NEXTCLOUD_VERSION_HPP
#define NEXTCLOUD_VERSION_HPP
#include <string>
namespace nextcloud {
// Semantic versioning
constexpr int VERSION_MAJOR = 0;
constexpr int VERSION_MINOR = 1;
constexpr int VERSION_PATCH = 0;
// Build metadata
constexpr const char* VERSION_STRING = "0.1.0";
constexpr const char* BUILD_DATE = __DATE__;
constexpr const char* BUILD_TIME = __TIME__;
/**
* @brief Get the library version as a string
* @return Version string in format "MAJOR.MINOR.PATCH"
*/
inline std::string getVersionString() {
return VERSION_STRING;
}
/**
* @brief Get the library version components
* @param major Output parameter for major version
* @param minor Output parameter for minor version
* @param patch Output parameter for patch version
*/
inline void getVersion(int& major, int& minor, int& patch) {
major = VERSION_MAJOR;
minor = VERSION_MINOR;
patch = VERSION_PATCH;
}
/**
* @brief Check if the library version is at least the specified version
* @param major Required major version
* @param minor Required minor version
* @param patch Required patch version
* @return True if current version >= required version
*/
inline bool isVersionAtLeast(int major, int minor, int patch) {
if (VERSION_MAJOR > major) return true;
if (VERSION_MAJOR < major) return false;
if (VERSION_MINOR > minor) return true;
if (VERSION_MINOR < minor) return false;
return VERSION_PATCH >= patch;
}
} // namespace nextcloud
#endif // NEXTCLOUD_VERSION_HPP