14 #define XSTR(arg) STR(arg) 17 #define FILE_LOC " -- ", __FILE__, ':', __LINE__ 21 template<
typename U,
typename C>
22 bool oneFlagOf(U flag, C container) {
23 static_assert(std::is_unsigned_v<U>,
"Argument flag must be unsigned type." );
24 static_assert(std::is_unsigned_v<typename C::value_type>,
"Container must hold an unsigned type.");
25 return std::any_of(container.begin(), container.end(), [&flag](
typename C::value_type value){
35 template<
class ContainerType>
55 return std::rbegin(mContainer);
63 return std::rend(mContainer);
73 template<
class ContainerType>
86 explicit ContainerView(ContainerType &container) : mContainer(container) {}
93 return std::begin(mContainer);
101 return std::end(mContainer);
113 template<
typename Arg,
typename... Args>
115 std::stringstream out;
116 out << std::forward<Arg>(arg);
117 ((out << std::forward<Args>(args)), ...);
157 [[nodiscard]]
const std::string& appName()
const {
return mAppName; }
159 [[nodiscard]]
const std::filesystem::path& configHome()
const {
return mConfigHome; }
161 [[nodiscard]]
const std::filesystem::path& cacheHome()
const {
return mCacheHome; }
163 [[nodiscard]]
const std::filesystem::path& dataHome()
const {
return mDataHome; }
165 [[nodiscard]]
const std::filesystem::path& appResources()
const {
return mAppResources; }
167 template<
typename Source>
168 std::filesystem::path appResourcesAppend(Source source) {
169 auto path = mAppResources;
170 return path.append(source);
182 std::filesystem::path getenv_path(XDGFilePaths::XDG_Name name,
const std::string &appName,
bool create);
std::filesystem::path mAppResources
Resources installed with the application.
Definition: Utilities.h:129
std::string mAppName
Application name as provided by the system.
Definition: Utilities.h:139
auto end()
Get the end iterator for the reverse view.
Definition: Utilities.h:62
std::string StringCompositor(Arg &&arg, Args &&... args)
Composite a pack of arguments that are streamable to a string.
Definition: Utilities.h:114
Provide a reverse view of a standard container type.
Definition: Utilities.h:36
Provide a view of a standard container type.
Definition: Utilities.h:74
std::filesystem::path mConfigHome
The user's XDG Config Home path.
Definition: Utilities.h:127
auto begin()
Get the begin iterator for the reverse view.
Definition: Utilities.h:54
std::filesystem::path mHomeDirectory
The user's home directory path.
Definition: Utilities.h:125
ContainerType & mContainer
A reference to the standard container.
Definition: Utilities.h:38
ReverseContainerView(ContainerType &container)
Constructor.
Definition: Utilities.h:48
Definition: Utilities.h:121
A class to determine and provide searching of XDG standard files paths.
Definition: XDGFilePaths.h:23
std::filesystem::path mCacheHome
The user's XDG Cache Home path.
Definition: Utilities.h:128
ContainerView(ContainerType &container)
Constructor.
Definition: Utilities.h:86
auto end()
Get the end iterator for the reverse view.
Definition: Utilities.h:100
ContainerType & mContainer
A reference to the standard container.
Definition: Utilities.h:76
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13
std::filesystem::path mDataHome
The user's XDG Data Home path.
Definition: Utilities.h:126
std::filesystem::path mLibResources
Resources shared by applications using the library.
Definition: Utilities.h:136
auto begin()
Get the begin iterator for the reverse view.
Definition: Utilities.h:92