LocalPackage
LocalPackage
#include <icy/pacm/package.h>Inherits:
Package
Package metadata for an installed package on the local filesystem.
Public Methods
| Return | Name | Description |
|---|---|---|
LocalPackage | Constructs an empty local package. | |
LocalPackage | Constructs a local package from an existing JSON value. | |
LocalPackage | Create the local package from the remote package reference with the following manipulations. 1) Add a local manifest element. 2) Remove asset mirror elements. | |
void | setState virtual | Set's the overall package state. Possible values are: Installing, Installed, Failed, Uninstalled. If the packages completes while still Installing, this means the package has yet to be finalized. |
void | setInstallState virtual | Set's the package installation state. See InstallationState for possible values. |
void | setInstallDir virtual | Set's the installation directory for this package. |
void | setInstalledAsset virtual | Sets the installed asset, once installed. This method also sets the version. |
void | setVersion virtual | Sets the current version of the local package. Installation must be complete. |
void | setVersionLock virtual | Locks the package at the given version. Once set this package will not be updated past the given version. Pass an empty string to remove the lock. |
void | setSDKVersionLock virtual | Locks the package at the given SDK version. Once set this package will only update to the most recent version with given SDK version. Pass an empty string to remove the lock. |
std::string | version virtual const | Returns the installed package version. |
std::string | state virtual const | Returns the current state of this package. |
std::string | installState virtual const | Returns the installation state of this package. |
std::string | installDir virtual const | Returns the installation directory for this package. |
std::string | versionLock virtual const | Returns the pinned version string, or empty if no lock is set. |
std::string | sdkLockedVersion virtual const | Returns the pinned SDK version string, or empty if no lock is set. |
Asset | asset virtual | Returns the currently installed asset, if any. If none, the returned asset will be empty(). |
bool | isInstalled virtual const | Returns true or false depending on weather or not the package is installed successfully. False if package is in Failed state. |
bool | isFailed virtual const | Returns true if the package state is "Failed". |
Manifest | manifest virtual | Returns the installation manifest. |
bool | verifyInstallManifest virtual | |
std::string | getInstalledFilePath virtual | Returns the full full path of the installed file. Thrown an exception if the install directory is unset. |
std::string | extensionEntryPointPath virtual const | Returns the install-relative extension entrypoint resolved against installDir(). Returns an empty string when no extension metadata is present. |
json::Value & | errors virtual | Returns a reference to the JSON array of accumulated error messages. |
void | addError virtual | Appends message to the errors array. |
std::string | lastError virtual const | Returns the most recently added error message, or empty if none. |
void | clearErrors virtual | Clears all recorded error messages. |
bool | valid virtual const | Returns true if id, name and type are all non-empty. |
LocalPackage
LocalPackage()Constructs an empty local package.
LocalPackage
LocalPackage(const json::Value & src)Constructs a local package from an existing JSON value.
Parameters
srcJSON object containing local package fields.
LocalPackage
LocalPackage(const RemotePackage & src)Create the local package from the remote package reference with the following manipulations. 1) Add a local manifest element. 2) Remove asset mirror elements.
setState
virtual
virtual void setState(const std::string & state)Set's the overall package state. Possible values are: Installing, Installed, Failed, Uninstalled. If the packages completes while still Installing, this means the package has yet to be finalized.
setInstallState
virtual
virtual void setInstallState(const std::string & state)Set's the package installation state. See InstallationState for possible values.
setInstallDir
virtual
virtual void setInstallDir(const std::string & dir)Set's the installation directory for this package.
setInstalledAsset
virtual
virtual void setInstalledAsset(const Package::Asset & installedRemoteAsset)Sets the installed asset, once installed. This method also sets the version.
setVersion
virtual
virtual void setVersion(const std::string & version)Sets the current version of the local package. Installation must be complete.
setVersionLock
virtual
virtual void setVersionLock(const std::string & version)Locks the package at the given version. Once set this package will not be updated past the given version. Pass an empty string to remove the lock.
setSDKVersionLock
virtual
virtual void setSDKVersionLock(const std::string & version)Locks the package at the given SDK version. Once set this package will only update to the most recent version with given SDK version. Pass an empty string to remove the lock.
version
virtual const
virtual std::string version() constReturns the installed package version.
state
virtual const
virtual std::string state() constReturns the current state of this package.
installState
virtual const
virtual std::string installState() constReturns the installation state of this package.
installDir
virtual const
virtual std::string installDir() constReturns the installation directory for this package.
versionLock
virtual const
virtual std::string versionLock() constReturns the pinned version string, or empty if no lock is set.
sdkLockedVersion
virtual const
virtual std::string sdkLockedVersion() constReturns the pinned SDK version string, or empty if no lock is set.
asset
virtual
virtual Asset asset()Returns the currently installed asset, if any. If none, the returned asset will be empty().
isInstalled
virtual const
virtual bool isInstalled() constReturns true or false depending on weather or not the package is installed successfully. False if package is in Failed state.
isFailed
virtual const
virtual bool isFailed() constReturns true if the package state is "Failed".
manifest
virtual
virtual Manifest manifest()Returns the installation manifest.
verifyInstallManifest
virtual
virtual bool verifyInstallManifest(bool allowEmpty)getInstalledFilePath
virtual
virtual std::string getInstalledFilePath(const std::string & fileName, bool whiny)Returns the full full path of the installed file. Thrown an exception if the install directory is unset.
extensionEntryPointPath
virtual const
virtual std::string extensionEntryPointPath(bool whiny) constReturns the install-relative extension entrypoint resolved against installDir(). Returns an empty string when no extension metadata is present.
errors
virtual
virtual json::Value & errors()Returns a reference to the JSON array of accumulated error messages.
addError
virtual
virtual void addError(const std::string & message)Appends message to the errors array.
Parameters
messageError description to record.
lastError
virtual const
virtual std::string lastError() constReturns the most recently added error message, or empty if none.
clearErrors
virtual
virtual void clearErrors()Clears all recorded error messages.
valid
virtual const
virtual bool valid() constReturns true if id, name and type are all non-empty.
