|
@@ -3,7 +3,7 @@
|
|
* Company: Lynar Studios
|
|
* Company: Lynar Studios
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* Created: 2020-09-28
|
|
* Created: 2020-09-28
|
|
- * Changed: 2021-04-23
|
|
|
|
|
|
+ * Changed: 2021-04-24
|
|
*
|
|
*
|
|
* */
|
|
* */
|
|
|
|
|
|
@@ -30,13 +30,11 @@ ls_std::byte_field ls_std::Version::marshal()
|
|
void ls_std::Version::unmarshal(const ls_std::byte_field &_data)
|
|
void ls_std::Version::unmarshal(const ls_std::byte_field &_data)
|
|
{
|
|
{
|
|
std::string field = _data;
|
|
std::string field = _data;
|
|
- std::string subSequence{};
|
|
|
|
- size_t position;
|
|
|
|
|
|
|
|
if (ls_std::Version::_isValid(_data))
|
|
if (ls_std::Version::_isValid(_data))
|
|
{
|
|
{
|
|
- position = field.find('.');
|
|
|
|
- subSequence = field.substr(0, position);
|
|
|
|
|
|
+ size_t position = field.find('.');
|
|
|
|
+ std::string subSequence = field.substr(0, position);
|
|
this->majorVersion = std::stoi(subSequence);
|
|
this->majorVersion = std::stoi(subSequence);
|
|
field.erase(0, position + 1);
|
|
field.erase(0, position + 1);
|
|
|
|
|
|
@@ -86,6 +84,13 @@ void ls_std::Version::setPatchVersion(ls_std::version_type _patch)
|
|
|
|
|
|
bool ls_std::Version::_isValid(const std::string &_versionString)
|
|
bool ls_std::Version::_isValid(const std::string &_versionString)
|
|
{
|
|
{
|
|
|
|
+ bool isValidVersionString{};
|
|
static std::regex versionRegex{R"(\d+[.]\d+[.]\d+)"};
|
|
static std::regex versionRegex{R"(\d+[.]\d+[.]\d+)"};
|
|
- return std::regex_match(_versionString.begin(), _versionString.end(), versionRegex);
|
|
|
|
|
|
+
|
|
|
|
+ if (!_versionString.empty())
|
|
|
|
+ {
|
|
|
|
+ isValidVersionString = std::regex_match(_versionString.begin(), _versionString.end(), versionRegex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return isValidVersionString;
|
|
}
|
|
}
|