Skip to main content

Velopack C++ Reference

MembersDescriptions
namespace Velopack
struct subprocess_s

namespace Velopack

Summary

MembersDescriptions
enum JsonNodeType
enum JsonToken
enum VelopackAssetType
public void startup(char ** args,size_t c_args)
class Velopack::JsonNode
class Velopack::JsonParser
class Velopack::Platform
class Velopack::StringStream
class Velopack::UpdateInfoHolds information about the current version and pending updates, such as how many there are, and access to release notes.
class Velopack::UpdateManagerSyncThis class is used to check for updates, download updates, and apply updates. It is a synchronous version of the UpdateManager class. This class is not recommended for use in GUI applications, as it will block the main thread, so you may want to use the async UpdateManager class instead, if it is supported for your programming language.
class Velopack::VelopackAssetAn individual Velopack asset, could refer to an asset on-disk or in a remote package feed.

Members

enum JsonNodeType

ValuesDescriptions
null
bool_
array
object
number
string

enum JsonToken

ValuesDescriptions
none
curlyOpen
curlyClose
squareOpen
squareClose
colon
comma
string
number
bool_
null

enum VelopackAssetType

ValuesDescriptions
unknown
full
delta

public void startup(char ** args,size_t c_args)

class Velopack::JsonNode

Summary

MembersDescriptions
public JsonNode() = default
public JsonNodeType getKind() constGet the type of this node, such as string, object, array, etc. You should use this function and then call the corresponding AsObject, AsArray, AsString, etc. functions to get the actual parsed json information.
public bool isNull() constCheck if the JSON value is null.
public bool isEmpty() constCheck if the JSON value is empty - eg. an empty string, array, or object.
public const std::unordered_map< std::string, std::shared_ptr< JsonNode> > *asObject() constReinterpret a JSON value as an object. Throws exception if the value type was not an object.
public const std::vector< std::shared_ptr< JsonNode> > *asArray() constReinterpret a JSON value as an array. Throws exception if the value type was not an array.
public double asNumber() constReinterpret a JSON value as a number. Throws exception if the value type was not a double.
public bool asBool() constReinterpret a JSON value as a boolean. Throws exception if the value type was not a boolean.
public std::string_view asString() constReinterpret a JSON value as a string. Throws exception if the value type was not a string.
public void initBool(bool value)
public void initArray()
public void addArrayChild(std::shared_ptr< JsonNode > child)
public void initObject()
public void addObjectChild(std::string_view key,std::shared_ptr< JsonNode > child)
public void initNumber(double value)
public void initString(std::string_view value)

Members

public JsonNode() = default

public JsonNodeType getKind() const

Get the type of this node, such as string, object, array, etc. You should use this function and then call the corresponding AsObject, AsArray, AsString, etc. functions to get the actual parsed json information.

public bool isNull() const

Check if the JSON value is null.

public bool isEmpty() const

Check if the JSON value is empty - eg. an empty string, array, or object.

public const std::unordered_map< std::string, std::shared_ptr< JsonNode> > *asObject() const

Reinterpret a JSON value as an object. Throws exception if the value type was not an object.

public const std::vector< std::shared_ptr< JsonNode> > *asArray() const

Reinterpret a JSON value as an array. Throws exception if the value type was not an array.

public double asNumber() const

Reinterpret a JSON value as a number. Throws exception if the value type was not a double.

public bool asBool() const

Reinterpret a JSON value as a boolean. Throws exception if the value type was not a boolean.

public std::string_view asString() const

Reinterpret a JSON value as a string. Throws exception if the value type was not a string.

public void initBool(bool value)

public void initArray()

public void addArrayChild(std::shared_ptr< JsonNode > child)

public void initObject()

public void addObjectChild(std::string_view key,std::shared_ptr< JsonNode > child)

public void initNumber(double value)

public void initString(std::string_view value)

class Velopack::JsonParser

Summary

MembersDescriptions
public JsonParser() = default
public void load(std::string_view text)
public bool endReached() const
public std::string readN(int n)
public int read()
public int peek() const
public bool peekWhitespace() const
public bool peekWordbreak() const
public void eatWhitespace()
public std::string readWord()
public std::shared_ptr< JsonNode>parseNull()
public std::shared_ptr< JsonNode>parseBool()
public std::shared_ptr< JsonNode>parseNumber()
public std::shared_ptr< JsonNode>parseString()
public std::shared_ptr< JsonNode>parseObject()
public std::shared_ptr< JsonNode>parseArray()
public std::shared_ptr< JsonNode>parseValue()

Members

public JsonParser() = default

public void load(std::string_view text)

public bool endReached() const

public std::string readN(int n)

public int read()

public int peek() const

public bool peekWhitespace() const

public bool peekWordbreak() const

public void eatWhitespace()

public std::string readWord()

public std::shared_ptr< JsonNode>parseNull()

public std::shared_ptr< JsonNode>parseBool()

public std::shared_ptr< JsonNode>parseNumber()

public std::shared_ptr< JsonNode>parseString()

public std::shared_ptr< JsonNode>parseObject()

public std::shared_ptr< JsonNode>parseArray()

public std::shared_ptr< JsonNode>parseValue()

class Velopack::Platform

Summary

MembersDescriptions

Members

class Velopack::StringStream

Summary

MembersDescriptions
public StringStream() = default
public void clear()
public void write(std::string s)
public void writeLine(std::string s)
public void writeChar(int c)
public std::string toString() const

Members

public StringStream() = default

public void clear()

public void write(std::string s)

public void writeLine(std::string s)

public void writeChar(int c)

public std::string toString() const

class Velopack::UpdateInfo

Holds information about the current version and pending updates, such as how many there are, and access to release notes.

Summary

MembersDescriptions
public std::shared_ptr< VelopackAsset>targetFullReleaseThe available version that we are updating to.
public bool isDowngradeTrue if the update is a version downgrade or lateral move (such as when switching channels to the same version number). In this case, only full updates are allowed, and any local packages on disk newer than the downloaded version will be deleted.
public UpdateInfo() = default

Members

public std::shared_ptr< VelopackAsset>targetFullRelease

The available version that we are updating to.

public bool isDowngrade

True if the update is a version downgrade or lateral move (such as when switching channels to the same version number). In this case, only full updates are allowed, and any local packages on disk newer than the downloaded version will be deleted.

public UpdateInfo() = default

class Velopack::UpdateManagerSync

This class is used to check for updates, download updates, and apply updates. It is a synchronous version of the UpdateManager class. This class is not recommended for use in GUI applications, as it will block the main thread, so you may want to use the async UpdateManager class instead, if it is supported for your programming language.

Summary

MembersDescriptions
public UpdateManagerSync() = default
public void setUrlOrPath(std::string urlOrPath)Set the URL or local file path to the update server. This is required before calling CheckForUpdates or DownloadUpdates.
public void setAllowDowngrade(bool allowDowngrade)Allows UpdateManager to update to a version that's lower than the current version (i.e. downgrading). This could happen if a release has bugs and was retracted from the release feed, or if you're using ExplicitChannel to switch channels to another channel where the latest version on that channel is lower than the current version.
public void setExplicitChannel(std::string explicitChannel)This option should usually be left null. Overrides the default channel used to fetch updates. The default channel will be whatever channel was specified on the command line when building this release. For example, if the current release was packaged with 'channel beta', then the default channel will be 'beta'. This allows users to automatically receive updates from the same channel they installed from. This options allows you to explicitly switch channels, for example if the user wished to switch back to the 'stable' channel without having to reinstall the application.
public bool isInstalled() constReturns true if the current app is installed, false otherwise. If the app is not installed, other functions in UpdateManager may throw exceptions, so you may want to check this before calling other functions.
public std::string getCurrentVersion() constGet the currently installed version of the application. If the application is not installed, this function will throw an exception.
public std::shared_ptr< UpdateInfo>checkForUpdates() constThis function will check for updates, and return information about the latest available release. This function runs synchronously and may take some time to complete, depending on the network speed and the number of updates available.
public void downloadUpdates(const VelopackAsset * toDownload) constDownloads the specified updates to the local app packages directory. If the update contains delta packages and ignoreDeltas=false, this method will attempt to unpack and prepare them. If there is no delta update available, or there is an error preparing delta packages, this method will fall back to downloading the full version of the update. This function will acquire a global update lock so may fail if there is already another update operation in progress.
public void applyUpdatesAndExit(const VelopackAsset * toApply) constThis will exit your app immediately, apply updates, and then optionally relaunch the app using the specified restart arguments. If you need to save state or clean up, you should do that before calling this method. The user may be prompted during the update, if the update requires additional frameworks to be installed etc.
public void applyUpdatesAndRestart(const VelopackAsset * toApply,const std::vector< std::string > * restartArgs) constThis will exit your app immediately, apply updates, and then optionally relaunch the app using the specified restart arguments. If you need to save state or clean up, you should do that before calling this method. The user may be prompted during the update, if the update requires additional frameworks to be installed etc.
public void waitExitThenApplyUpdates(const VelopackAsset * toApply,bool silent,bool restart,const std::vector< std::string > * restartArgs) constThis will launch the Velopack updater and tell it to wait for this program to exit gracefully. You should then clean up any state and exit your app. The updater will apply updates and then optionally restart your app. The updater will only wait for 60 seconds before giving up.
protected std::vector< std::string > getCurrentVersionCommand() constReturns the command line arguments to get the current version of the application.
protected std::vector< std::string > getCheckForUpdatesCommand() constReturns the command line arguments to check for updates.
protected std::vector< std::string > getDownloadUpdatesCommand(const VelopackAsset * toDownload) constReturns the command line arguments to download the specified update.
protected std::vector< std::string > getUpdateApplyCommand(const VelopackAsset * toApply,bool silent,bool restart,bool wait,const std::vector< std::string > * restartArgs) constReturns the command line arguments to apply the specified update.
protected std::string getPackagesDir() constReturns the path to the app's packages directory. This is where updates are downloaded to.

Members

public UpdateManagerSync() = default

public void setUrlOrPath(std::string urlOrPath)

Set the URL or local file path to the update server. This is required before calling CheckForUpdates or DownloadUpdates.

public void setAllowDowngrade(bool allowDowngrade)

Allows UpdateManager to update to a version that's lower than the current version (i.e. downgrading). This could happen if a release has bugs and was retracted from the release feed, or if you're using ExplicitChannel to switch channels to another channel where the latest version on that channel is lower than the current version.

public void setExplicitChannel(std::string explicitChannel)

This option should usually be left null. Overrides the default channel used to fetch updates. The default channel will be whatever channel was specified on the command line when building this release. For example, if the current release was packaged with 'channel beta', then the default channel will be 'beta'. This allows users to automatically receive updates from the same channel they installed from. This options allows you to explicitly switch channels, for example if the user wished to switch back to the 'stable' channel without having to reinstall the application.

public bool isInstalled() const

Returns true if the current app is installed, false otherwise. If the app is not installed, other functions in UpdateManager may throw exceptions, so you may want to check this before calling other functions.

public std::string getCurrentVersion() const

Get the currently installed version of the application. If the application is not installed, this function will throw an exception.

public std::shared_ptr< UpdateInfo>checkForUpdates() const

This function will check for updates, and return information about the latest available release. This function runs synchronously and may take some time to complete, depending on the network speed and the number of updates available.

public void downloadUpdates(const VelopackAsset * toDownload) const

Downloads the specified updates to the local app packages directory. If the update contains delta packages and ignoreDeltas=false, this method will attempt to unpack and prepare them. If there is no delta update available, or there is an error preparing delta packages, this method will fall back to downloading the full version of the update. This function will acquire a global update lock so may fail if there is already another update operation in progress.

public void applyUpdatesAndExit(const VelopackAsset * toApply) const

This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified restart arguments. If you need to save state or clean up, you should do that before calling this method. The user may be prompted during the update, if the update requires additional frameworks to be installed etc.

public void applyUpdatesAndRestart(const VelopackAsset * toApply,const std::vector< std::string > * restartArgs) const

This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified restart arguments. If you need to save state or clean up, you should do that before calling this method. The user may be prompted during the update, if the update requires additional frameworks to be installed etc.

public void waitExitThenApplyUpdates(const VelopackAsset * toApply,bool silent,bool restart,const std::vector< std::string > * restartArgs) const

This will launch the Velopack updater and tell it to wait for this program to exit gracefully. You should then clean up any state and exit your app. The updater will apply updates and then optionally restart your app. The updater will only wait for 60 seconds before giving up.

protected std::vector< std::string > getCurrentVersionCommand() const

Returns the command line arguments to get the current version of the application.

protected std::vector< std::string > getCheckForUpdatesCommand() const

Returns the command line arguments to check for updates.

protected std::vector< std::string > getDownloadUpdatesCommand(const VelopackAsset * toDownload) const

Returns the command line arguments to download the specified update.

protected std::vector< std::string > getUpdateApplyCommand(const VelopackAsset * toApply,bool silent,bool restart,bool wait,const std::vector< std::string > * restartArgs) const

Returns the command line arguments to apply the specified update.

protected std::string getPackagesDir() const

Returns the path to the app's packages directory. This is where updates are downloaded to.

class Velopack::VelopackAsset

An individual Velopack asset, could refer to an asset on-disk or in a remote package feed.

Summary

MembersDescriptions
public std::string packageIdThe name or Id of the package containing this release.
public std::string versionThe version of this release.
public VelopackAssetType typeThe type of asset (eg. full or delta).
public std::string fileNameThe filename of the update package containing this release.
public std::string sha1The SHA1 checksum of the update package containing this release.
public int64_t sizeThe size in bytes of the update package containing this release.
public std::string notesMarkdownThe release notes in markdown format, as passed to Velopack when packaging the release.
public std::string notesHTMLThe release notes in HTML format, transformed from Markdown when packaging the release.
public VelopackAsset() = default

Members

public std::string packageId

The name or Id of the package containing this release.

public std::string version

The version of this release.

public VelopackAssetType type

The type of asset (eg. full or delta).

public std::string fileName

The filename of the update package containing this release.

public std::string sha1

The SHA1 checksum of the update package containing this release.

public int64_t size

The size in bytes of the update package containing this release.

public std::string notesMarkdown

The release notes in markdown format, as passed to Velopack when packaging the release.

public std::string notesHTML

The release notes in HTML format, transformed from Markdown when packaging the release.

public VelopackAsset() = default

struct subprocess_s

Summary

MembersDescriptions
public FILE * stdin_file
public FILE * stdout_file
public FILE * stderr_file
public pid_t child
public int return_status
public subprocess_size_t alive

Members

public FILE * stdin_file

public FILE * stdout_file

public FILE * stderr_file

public pid_t child

public int return_status

public subprocess_size_t alive

Generated by Moxygen