6 #include <unordered_map> 33 version() : mjor(0), mnor(0), patch(0), build(0) {}
38 patch = (ver / 10000) % 100;
39 mnor = (ver / 1000000) % 100;
40 mjor = (ver / 100000000) % 100;
45 constexpr
int MINIMAL_MATCH_SECTIONS = 4;
46 constexpr
int MATCH_SECTIONS_INC_BUILD_NUM = 5;
47 std::regex rgx(
"^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,5})?$");
50 if (std::regex_search(str.begin(), str.end(), match, rgx) && match.size() >= MINIMAL_MATCH_SECTIONS)
55 if (match.size() == MATCH_SECTIONS_INC_BUILD_NUM)
62 if (mjor > other.
mjor)
return false;
63 if ((mjor == other.
mjor) && (mnor > other.
mnor))
return false;
64 if ((mjor == other.
mjor) && (mnor == other.
mnor) && (patch > other.
patch))
return false;
65 if ((mjor == other.
mjor) && (mnor == other.
mnor) && (patch == other.
patch) && (build > other.
build))
return false;
70 return (other.
mjor == mjor && other.
mnor == mnor && other.
patch == patch && other.
build == build);
80 return (from <= *
this) && (*
this <= until);
86 ss << mjor <<
"." << mnor <<
"." << patch <<
"." <<
build;
104 : _dev_info_url(url), _local_source_file(use_url_as_local_path), _server_versions_vec(), _server_versions_loaded(false), _download_cb_func(download_callback) {};
137 bool get_server_data(std::stringstream &ver_data);
138 void parse_versions_data(
const std::stringstream &ver_data);
140 bool is_device_name_equal(
const std::string &str_from_db,
const std::string &str_compared,
bool allow_wildcard);
version(const std::string &str)
bool operator>(const version &other) const
std::string rel_notes_link
GLsizei const GLchar *const * string
bool get_version_description(const component_part_type component, const version &version, std::string &version_description)
bool operator!=(const version &other) const
bool operator<=(const version &other) const
bool operator<(const version &other) const
bool operator>=(const version &other) const
const std::string _dev_info_url
std::vector< std::unordered_map< std::string, std::string > > _server_versions_vec
std::string to_string(const component_part_type &component)
std::function< callback_result(uint64_t dl_current_bytes, uint64_t dl_total_bytes)> user_callback_func_type
versions_db_manager(const std::string &url, const bool use_url_as_local_path=false, http::user_callback_func_type download_callback=http::user_callback_func_type())
bool get_version_download_link(const component_part_type component, const version &version, std::string &dl_link)
bool operator==(const version &other) const
bool get_version_release_notes(const component_part_type component, const version &version, std::string &version_release_notes_link)
bool _server_versions_loaded
bool is_between(const version &from, const version &until) const
bool from_string(const std::string &component_str, component_part_type &component_val)
http::user_callback_func_type _download_cb_func