update library

This commit is contained in:
Andrei Yankovich 2020-05-17 23:21:12 +03:00
parent 3b0c06626c
commit 44791d19c2
4 changed files with 38 additions and 2 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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();
};
}