AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LuxVersionText.h
Go to the documentation of this file.
1/*
2 * AMFP-2026: the version line on the title menu (bottom right), e.g.
3 * "AMFP Enhanced 0.1.0 (773e566)". The version and commit come from AmfpVersion.h, which the
4 * build writes from the CMake project version and git (cmake/AmfpVersion.cmake).
5 * Pure, unit tested in tests/cpp/test_version_text.cpp.
6 */
7#ifndef LUX_VERSION_TEXT_H
8#define LUX_VERSION_TEXT_H
9
10#include <string>
11
12inline std::string LuxVersionText(const std::string& asVersion, const std::string& asCommit)
13{
14 std::string s = "AMFP Enhanced " + asVersion;
15 if(asCommit.empty()) return s;
16 const std::string kDirty = "-dirty";
17 bool bDirty = asCommit.size() > kDirty.size() && asCommit.compare(asCommit.size() - kDirty.size(), kDirty.size(), kDirty) == 0;
18 std::string sCommit = bDirty ? asCommit.substr(0, asCommit.size() - kDirty.size()) : asCommit;
19 return s + " (" + sCommit + (bDirty ? ", modified)" : ")");
20}
21
22#endif
std::string LuxVersionText(const std::string &asVersion, const std::string &asCommit)