24 std::string fmtNumber(T value,
int precision) {
25 std::stringstream strm{};
26 strm << std::setprecision(precision) << value;
35 template<
class Iterator>
37 Iterator mBegin, mEnd;
39 Iterator begin()
const {
return mBegin; }
40 Iterator end()
const {
return mEnd; }
47 using iterator_t = decltype(std::begin(std::declval<C&>()));
59 return {std::next(container.begin(), skip), container.end()};
70 template<
typename T,
size_t N>
72 strm <<
'(' << metric.front();
73 for (
auto &i :
offset(metric,1)) {
87 using namespace std::chrono_literals;
88 using namespace std::chrono;
90 auto sysWriteTime = time_point_cast<system_clock::duration>(
91 fileTimePoint - decltype(fileTimePoint)::clock::now() +
117 template<class ContainerType>
123 ReverseContainerView() =
delete;
137 return std::rbegin(mContainer);
145 return std::rend(mContainer);
154 #define XSTR(arg) STR(arg) 155 #define STR(arg) #arg 157 #define FILE_LOC " -- ", __FILE__, ':', __LINE__ 162 using DebugTuple = std::optional<std::tuple<const std::string_view, unsigned int>>;
167 #define DEBUG_TUPLE(use) use ? std::make_optional(std::make_tuple(std::string_view{__FILE__},__LINE__)) : (std::nullopt) 175 static bool bxor(
bool a,
bool b) {
return b == !a; }
185 template<
typename Arg,
typename... Args>
187 std::stringstream out;
188 out << std::forward<Arg>(arg);
189 ((out << std::forward<Args>(args)), ...);
std::chrono::system_clock::time_point fileClockToSystemClock(T fileTimePoint)
Convert a filesystem time to a system clock time point.
Definition: Utilities.h:86
Provide a reverse view of a standard container type.
Definition: Utilities.h:118
int fontLineSkip
The size of a line advance for the font.
Definition: Utilities.h:101
auto begin()
Get the begin iterator for the reverse view.
Definition: Utilities.h:136
std::string StringCompositor(Arg &&arg, Args &&... args)
Composite a pack of arguments that are streamable to a string.
Definition: Utilities.h:186
auto end()
Get the end iterator for the reverse view.
Definition: Utilities.h:144
Constants and Enumerations.
The size metrics that pertain to a particular font.
Definition: Utilities.h:100
Utility Functions.
Definition: Math.h:14
iterator_pair< iterator_t< C > > offset(C &container, size_t skip)
Crate an iterator_pair to generate an offset sequence.
Definition: Utilities.h:58
std::ostream & printScreenMetric(std::ostream &strm, const std::array< T, N > &metric)
A function to print ScreenMetric values.
Definition: Utilities.h:71
A pair of iterators which may be used as first and last in the sequence [first .
Definition: Utilities.h:36
ReverseContainerView(ContainerType &container, bool reverse=true)
Constructor.
Definition: Utilities.h:130
std::optional< std::tuple< const std::string_view, unsigned int > > DebugTuple
A type to encode the location of an error: file name and line number.
Definition: Utilities.h:162
ContainerType & mContainer
A reference to the standard container.
Definition: Utilities.h:120
decltype(std::begin(std::declval< C & >())) iterator_t
An iterator type definition.
Definition: Utilities.h:47