-
Notifications
You must be signed in to change notification settings - Fork 444
/
VersionHelper.h
40 lines (33 loc) · 909 Bytes
/
VersionHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include <xstring>
#include <windows.h>
#include <algorithm>
#include <cctype>
using namespace std;
class CVersionHelper
{
public:
CVersionHelper();
virtual ~CVersionHelper();
public:
wstring GetFileVersionX();
wstring GetProductVersionX();
wstring GetVersionInfo(HMODULE hLib, wstring csEntry);
wstring FormatVersion(wstring cs);
private:
wstring m_csFileVersion;
wstring m_csProductVersion;
};
// cited: https://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
// trim from start (in place)
static inline void ltrim(std::wstring &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) {
return !std::isspace(ch);
}));
}
// trim from end (in place)
static inline void rtrim(std::wstring &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) {
return !std::isspace(ch);
}).base(), s.end());
}