license: Removed license generator dependency to lib_utitlity to avoid linking with Qt
This commit is contained in:
+2
-3
@@ -252,7 +252,6 @@ create_source_groups(${LIB_LICENSE_FILES})
|
||||
target_include_directories( ${LIB_LICENSE_PROJECT_NAME} PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_license"
|
||||
"${CMAKE_BINARY_DIR}/src/lib_license"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_utility"
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_LICENSE_PROJECT_NAME} SYSTEM
|
||||
@@ -261,8 +260,6 @@ target_include_directories(${LIB_LICENSE_PROJECT_NAME} SYSTEM
|
||||
${BOTAN_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_LICENSE_PROJECT_NAME} ${LIB_UTILITY_PROJECT_NAME})
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(${LIB_LICENSE_PROJECT_NAME} ${BOTAN})
|
||||
else()
|
||||
@@ -578,6 +575,7 @@ set_property(
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CMAKE_SOURCE_DIR}/src/app"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_utility"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_gui"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_license"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_cxx"
|
||||
@@ -723,6 +721,7 @@ if (CXXTEST_FOUND)
|
||||
PROPERTY INCLUDE_DIRECTORIES
|
||||
"${CXXTEST_INCLUDE_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_utility"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_gui"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_cxx"
|
||||
"${CMAKE_SOURCE_DIR}/src/lib_java"
|
||||
|
||||
@@ -21,10 +21,28 @@
|
||||
#include "botan/auto_rng.h"
|
||||
#include "botan/pbkdf.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/Version.h"
|
||||
#include "PublicKey.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string trim(const std::string &str)
|
||||
{
|
||||
auto wsfront = std::find_if_not(str.begin(), str.end(), [](int c) { return std::isspace(c); });
|
||||
auto wsback = std::find_if_not(str.rbegin(), str.rend(), [](int c) { return std::isspace(c); }).base();
|
||||
return (wsback <= wsfront ? std::string() : std::string(wsfront, wsback));
|
||||
}
|
||||
|
||||
std::string toLowerCase(const std::string& in)
|
||||
{
|
||||
std::string out;
|
||||
std::transform(in.begin(), in.end(), std::back_inserter(out), tolower);
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
License::License()
|
||||
: m_rng(std::make_shared<Botan::AutoSeeded_RNG>())
|
||||
, m_user("")
|
||||
@@ -95,7 +113,7 @@ std::string License::getLine(std::istream& stream)
|
||||
std::string line;
|
||||
if(getline(stream, line, '\n'))
|
||||
{
|
||||
return utility::trim(line);
|
||||
return trim(line);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -274,7 +292,7 @@ bool License::load(std::istream& stream)
|
||||
|
||||
// separator line
|
||||
getline(stream, line, '\n');
|
||||
if (utility::trim(line) != LicenseConstants::SEPARATOR_STRING)
|
||||
if (trim(line) != LicenseConstants::SEPARATOR_STRING)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -286,7 +304,7 @@ bool License::load(std::istream& stream)
|
||||
m_signature = "";
|
||||
while (getline(stream, line, '\n'))
|
||||
{
|
||||
std::string l = utility::trim(line);
|
||||
std::string l = trim(line);
|
||||
if (l == LicenseConstants::END_LICENSE_STRING)
|
||||
{
|
||||
break;
|
||||
@@ -320,7 +338,7 @@ void License::setTypeAndNumberOfUsers(const std::string& line)
|
||||
m_numberOfUsers = 0;
|
||||
}
|
||||
|
||||
if (utility::toLowerCase(line).find("seat") != line.npos)
|
||||
if (toLowerCase(line).find("seat") != line.npos)
|
||||
{
|
||||
m_createdWithSeats = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user