libnick 2025.10.0
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;
74 bool downloadUpdate(VersionType versionType, const std::filesystem::path& path, const std::string& assetName, bool exactMatch = true, const cpr::ProgressCallback& progress = {}) noexcept;
75#ifdef _WIN32
84 bool windowsUpdate(VersionType versionType, const cpr::ProgressCallback& progress = {}) noexcept;
85#endif
91 Updater& operator=(const Updater& u) noexcept;
97 Updater& operator=(Updater&& u) noexcept;
98
99 private:
100 mutable std::mutex m_mutex;
101 std::string m_repoOwner;
102 std::string m_repoName;
103 int m_latestStableReleaseId;
104 int m_latestPreviewReleaseId;
105 };
106}
107
108#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