karazeh
A cross-platform software updating library.
|
#include <version_manifest.hpp>
Public Member Functions | |
version_manifest (config_t const &) | |
virtual | ~version_manifest () |
vector< string_t > | get_available_updates (const string_t ¤t_version) const |
string_t | get_current_version () const |
release_manifest const * | get_release (const string_t &) const |
int | get_release_count () const |
int | get_release_count (string_t const &identity) const |
void | load_from_string (string_t const &raw_json) |
void | load_from_uri (string_t const &uri) |
void | load_release_from_string (string_t const &raw_json) |
void | load_release_from_uri (string_t const &) |
void | parse (JSON const &) |
void | parse_release (JSON const &) |
|
explicit |
|
virtual |
vector< string_t > kzh::version_manifest::get_available_updates | ( | const string_t & | current_version | ) | const |
References kzh::create_operation::dst_path, kzh::release_manifest::head, kzh::release_manifest::id, kzh::release_manifest::identity, kzh::create_operation::is_executable, kzh::create_operation::marked_for_deletion(), kzh::release_manifest::operations, kzh::create_operation::src_checksum, kzh::create_operation::src_size, kzh::create_operation::src_uri, kzh::release_manifest::tag, kzh::release_manifest::uri, and kzh::validate_schema.
Referenced by TEST_CASE().
string_t kzh::version_manifest::get_current_version | ( | ) | const |
Attempt to identify the current application version.
std::domain_error |
|
References kzh::hasher::digest_rc::digest, kzh::KARAZEH_EXPORT::file_manager, kzh::KARAZEH_EXPORT::hasher, kzh::hasher::hex_digest(), and kzh::file_manager::is_readable().
Referenced by TEST_CASE().
const release_manifest * kzh::version_manifest::get_release | ( | const string_t & | id | ) | const |
If no such release could be found, the behavior is undefined.
Referenced by TEST_CASE().
int kzh::version_manifest::get_release_count | ( | ) | const |
Referenced by TEST_CASE().
int kzh::version_manifest::get_release_count | ( | string_t const & | identity | ) | const |
void kzh::version_manifest::load_from_string | ( | string_t const & | raw_json | ) |
A convenience method for parsing a JSON manifest from a string. This implicitly calls parse().
This function is equivalent to manually parsing JSON into an object and feeding it to parse.
kzh::invalid_manifest | If the supplied JSON string is malformed or could not be parsed for some reason. |
References parse().
Referenced by load_from_uri(), and TEST_CASE().
void kzh::version_manifest::load_from_uri | ( | string_t const & | uri | ) |
A convenience method for downloading a JSON manifest from a remote server and parsing it. This implicitly calls load_from_string() and parse().
kzh::invalid_resource | If the resource at the supplied URI could not be downloaded. |
References kzh::KARAZEH_EXPORT::downloader, kzh::downloader::fetch(), and load_from_string().
Referenced by TEST_CASE().
void kzh::version_manifest::load_release_from_string | ( | string_t const & | raw_json | ) |
A convenience method for parsing a JSON release manifest from a string. This implicitly calls parse_release().
kzh::invalid_manifest | If the supplied JSON string is malformed or could not be parsed for some reason. |
References parse_release().
Referenced by load_release_from_uri().
void kzh::version_manifest::load_release_from_uri | ( | string_t const & | uri | ) |
A convenience method for downloading a JSON release manifest from a remote server and then parsing it. This implicitly calls load_release_from_string() and parse_release().
kzh::invalid_manifest | If the supplied JSON string is malformed or could not be parsed for some reason. |
References kzh::KARAZEH_EXPORT::downloader, kzh::downloader::fetch(), and load_release_from_string().
Referenced by TEST_CASE().
void kzh::version_manifest::parse | ( | JSON const & | manifest | ) |
Populate the version manifest object from a JSON manifest.
This method tracks the identity lists defined in the manifest as well as the release definitions.
kzh::invalid_manifest |
|
std::domain_error |
|
This function is NOT idempotent. This function has implicit side-effects on the tracked identity list and release containers.
References kzh::KARAZEH_EXPORT::file_manager, kzh::file_manager::is_readable(), kzh::KARAZEH_EXPORT::root_path, and kzh::validate_schema.
Referenced by load_from_string().
void kzh::version_manifest::parse_release | ( | JSON const & | manifest | ) |
Referenced by load_release_from_string(), and TEST_CASE().