OSDN Git Service

Fix the issue where the Apache Tika plugin becomes enabled again when reopening the...
[winmerge-jp/winmerge-jp.git] / Src / FileVersion.cpp
1 /** 
2  * @file  FileVersion.cpp
3  *
4  * @brief Implementation for FileVersion
5  */
6
7 #include "pch.h"
8 #include "FileVersion.h"
9 #include "UnicodeString.h"
10
11 #ifndef HIWORD
12 #define LOWORD(l) ((unsigned short)((l) & 0xffff))
13 #define HIWORD(l) ((unsigned short)((l) >> 16))
14 #endif
15
16 /**
17  * @brief Default constructor.
18  */
19 FileVersion::FileVersion()
20 : m_fileVersionMS(0xffffffff)
21 , m_fileVersionLS(0xffffffff)
22 {
23 }
24
25 /**
26  * @brief Get file version as a string.
27  * @return File version number as a string. Returns empty string if there is
28  * no version number for the file.
29  */
30 String FileVersion::GetFileVersionString() const
31 {
32         if (m_fileVersionMS == 0xffffffff && m_fileVersionLS >= 0xfffffffe)
33                 return _T("");
34
35         return strutils::format(_T("%u.%u.%u.%u"), HIWORD(m_fileVersionMS),
36                 LOWORD(m_fileVersionMS), HIWORD(m_fileVersionLS),
37                 LOWORD(m_fileVersionLS));
38 }
39