2020-02-25 16:44:13 +08:00
|
|
|
#include "pch.h"
|
|
|
|
#include "VersionHelper.h"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
VersionHelper::VersionHelper(std::string str)
|
|
|
|
{
|
|
|
|
std::replace(str.begin(), str.end(), '.', ' ');
|
|
|
|
std::replace(str.begin(), str.end(), 'v', ' ');
|
|
|
|
std::stringstream ss;
|
|
|
|
|
|
|
|
ss << str;
|
|
|
|
|
|
|
|
std::string temp;
|
|
|
|
ss >> temp;
|
|
|
|
std::stringstream(temp) >> major;
|
|
|
|
ss >> temp;
|
|
|
|
std::stringstream(temp) >> minor;
|
|
|
|
ss >> temp;
|
|
|
|
std::stringstream(temp) >> revision;
|
|
|
|
}
|
|
|
|
|
|
|
|
VersionHelper::VersionHelper(int major, int minor, int revision) :
|
|
|
|
major(major),
|
|
|
|
minor(minor),
|
|
|
|
revision(revision)
|
|
|
|
{
|
|
|
|
}
|
2020-04-27 18:39:47 +08:00
|
|
|
|
|
|
|
std::wstring VersionHelper::toWstring() const
|
|
|
|
{
|
|
|
|
std::wstring result{ L"v" };
|
|
|
|
result += std::to_wstring(major);
|
|
|
|
result += L'.';
|
|
|
|
result += std::to_wstring(minor);
|
|
|
|
result += L'.';
|
|
|
|
result += std::to_wstring(revision);
|
|
|
|
return result;
|
|
|
|
}
|