libnick 2025.9.1
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
updater.h
Go to the documentation of this file.
1
22
23#ifndef UPDATER_H
24#define UPDATER_H
25
26#include <filesystem>
27#include <mutex>
28#include <string>
29#include <cpr/callback.h>
30#include "version.h"
31
33{
37 class Updater
38 {
39 public:
45 Updater(std::string githubRepoUrl);
50 Updater(const Updater& u) noexcept;
55 Updater(Updater&& u) noexcept;
73 bool downloadUpdate(VersionType versionType, const std::filesystem::path& path, const std::string& assetName, bool exactMatch = true, const cpr::ProgressCallback& progress = {}) noexcept;
74#ifdef _WIN32
83 bool windowsUpdate(VersionType versionType, const cpr::ProgressCallback& progress = {}) noexcept;
84#endif
90 Updater& operator=(const Updater& u) noexcept;
96 Updater& operator=(Updater&& u) noexcept;
97
98 private:
99 mutable std::mutex m_mutex;
100 std::string m_repoOwner;
101 std::string m_repoName;
102 int m_latestStableReleaseId;
103 int m_latestPreviewReleaseId;
104 };
105}
106
107#endif //UPDATER_H
Updater(std::string githubRepoUrl)
Constructs an Updater.
bool downloadUpdate(VersionType versionType, const std::filesystem::path &path, const std::string &assetName, bool exactMatch=true, const cpr::ProgressCallback &progress={}) noexcept
Downloads an update for the application.
Version fetchCurrentVersion(VersionType versionType) noexcept
Gets the latest version of the provided type from the GitHub repo.
bool windowsUpdate(VersionType versionType, const cpr::ProgressCallback &progress={}) noexcept
Downloads and installs an application update for Windows.
Updater & operator=(const Updater &u) noexcept
Copies an Updater.
Updater(Updater &&u) noexcept
Constructs an Updater via move.
Updater & operator=(Updater &&u) noexcept
Moves an Updater.
Updater(const Updater &u) noexcept
Constructs an Updater via copy.
A model for a version number.
Definition version.h:37
Definition updater.h:33
VersionType
Types of a version.
Definition versiontype.h:32