mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-26 09:44:38 +00:00
update library
This commit is contained in:
parent
3b0c06626c
commit
44791d19c2
@ -44,4 +44,4 @@ add_library(${PROJECT_NAME} SHARED ${SOURCE_CPP})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
setVersion(1 3 1)
|
||||
setVersion(1 4 0)
|
||||
|
16
global.h
16
global.h
@ -3,6 +3,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <type_traits>
|
||||
#include <string>
|
||||
|
||||
template <typename T>
|
||||
constexpr inline T operator | (T lhs, T rhs)
|
||||
@ -64,4 +65,19 @@ constexpr inline T operator ^ (T lhs, T rhs)
|
||||
return static_cast<T>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
|
||||
}
|
||||
|
||||
|
||||
constexpr uint32_t static_hash(const char* str) {
|
||||
uint32_t hash = 0;
|
||||
unsigned char index = 0;
|
||||
uint32_t tmp = 1;
|
||||
while (str[index] && index < 0xff) {
|
||||
tmp *= str[index];
|
||||
if (index % 4 == 0) {
|
||||
hash = hash % str[index];
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
#endif // GLOBAL_H
|
||||
|
11
params.cpp
11
params.cpp
@ -99,6 +99,15 @@ QVariantMap Params::getUserParamsMap() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void Params::clearParsedData() {
|
||||
params.clear();
|
||||
_argc = 0;
|
||||
}
|
||||
|
||||
QString Params::getCurrentExecutable() {
|
||||
return getStrArg(APP_PATH) + "/" + getStrArg(APP_NAME);
|
||||
}
|
||||
|
||||
int Params::size() {
|
||||
return params.size();
|
||||
}
|
||||
@ -141,7 +150,7 @@ std::string Params::lvlToString(VerboseLvl vLvl) {
|
||||
bool Params::writeLoginFile(const QString &log, VerboseLvl vLvl) {
|
||||
if (isEndable("fileLog")) {
|
||||
|
||||
QString path = getStrArg(APP_PATH) + "/" + getStrArg(APP_NAME) + ".log";
|
||||
QString path = getCurrentExecutable() + ".log";
|
||||
auto file = getStrArg("fileLog");
|
||||
if (file.size()) {
|
||||
QString path = file;
|
||||
|
11
params.h
11
params.h
@ -148,6 +148,17 @@ public:
|
||||
* @return QVariantMap with user params
|
||||
*/
|
||||
static QVariantMap getUserParamsMap();
|
||||
|
||||
/**
|
||||
* @brief clearParsedData - this method clear allparsed data.
|
||||
*/
|
||||
static void clearParsedData();
|
||||
|
||||
/**
|
||||
* @brief getCurrentExecutable
|
||||
* @return path to current executable.
|
||||
*/
|
||||
static QString getCurrentExecutable();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user