Add user agent to curl requests
This commit is contained in:
@@ -24,29 +24,27 @@ namespace utils
|
||||
return (m_hi << 24) | (m_mid << 16) | (m_lo << 8) | ((uint(m_type) & 0xf) << 4) | (m_type_index & 0xf);
|
||||
}
|
||||
|
||||
std::string version::to_string() const
|
||||
std::string version::to_string(bool simple) const
|
||||
{
|
||||
std::string version = std::to_string(hi()) + "." + std::to_string(mid());
|
||||
std::string version = fmt::format("%d.%d", hi(), mid());
|
||||
|
||||
if (lo())
|
||||
{
|
||||
version += '.';
|
||||
version += std::to_string(lo());
|
||||
fmt::append(version, ".%d", lo());
|
||||
}
|
||||
|
||||
if (type() != version_type::release)
|
||||
if (!simple && type() != version_type::release)
|
||||
{
|
||||
if (!postfix().empty())
|
||||
{
|
||||
version += "-" + postfix();
|
||||
fmt::append(version, "-%s", postfix());
|
||||
}
|
||||
|
||||
version += ' ';
|
||||
version += utils::to_string(type());
|
||||
fmt::append(version, " %s", utils::to_string(type()));
|
||||
|
||||
if (type_index() > 1)
|
||||
{
|
||||
version += " " + std::to_string(type_index());
|
||||
fmt::append(version, " %d", type_index());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -23,10 +23,10 @@ namespace utils
|
||||
uint m_lo;
|
||||
version_type m_type = version_type::release;
|
||||
uint m_type_index = 1;
|
||||
const char* m_postfix;
|
||||
std::string_view m_postfix;
|
||||
|
||||
public:
|
||||
constexpr version(uint hi, uint mid, uint lo, version_type type, uint type_index, const char* postfix)
|
||||
constexpr version(uint hi, uint mid, uint lo, version_type type, uint type_index, std::string_view postfix)
|
||||
: m_hi(hi)
|
||||
, m_mid(mid)
|
||||
, m_lo(lo)
|
||||
@@ -56,7 +56,7 @@ namespace utils
|
||||
return m_type;
|
||||
}
|
||||
|
||||
std::string postfix() const
|
||||
std::string_view postfix() const
|
||||
{
|
||||
return m_postfix;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace utils
|
||||
}
|
||||
|
||||
uint to_hex() const;
|
||||
std::string to_string() const;
|
||||
std::string to_string(bool simple = false) const;
|
||||
};
|
||||
|
||||
// Generic version comparison (e.g. 0.0.5 vs 1.3)
|
||||
|
||||
Reference in New Issue
Block a user