Skip to content

Commit

Permalink
removed: fstrcmp and StringUtils::CompareFuzzy() + StringUtils::FindB…
Browse files Browse the repository at this point in the history
…estMatch() because of an incompatible license. bump to 2.0.0. issue #12 #13
  • Loading branch information
opdenkamp committed Dec 1, 2015
1 parent 2c8d36e commit a1e5905
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 183 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ include(CheckAtomic.cmake)

set(platform_NAME platform)
set(platform_DESCRIPTION "Platform support library")
set(platform_VERSION_MAJOR 1)
set(platform_VERSION_MAJOR 2)
set(platform_VERSION_MINOR 0)
set(platform_VERSION_PATCH 10)
set(platform_VERSION_PATCH 0)

set(CMAKE_POSITION_INDEPENDENT_CODE on)

Expand All @@ -34,8 +34,7 @@ if(NOT ${CORE_SYSTEM_NAME} STREQUAL "")
endif()
endif()

set(SOURCES src/util/fstrcmp.c
src/util/StringUtils.cpp)
set(SOURCES src/util/StringUtils.cpp)

add_library(platform ${SOURCES} ${PLAT_SOURCES})
target_link_libraries(platform ${platform_LIBRARIES})
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
platform (2.0.0-1~trusty) trusty; urgency=medium

* removed: fstrcmp and StringUtils::CompareFuzzy() +
StringUtils::FindBestMatch() because of an incompatible license

-- Pulse-Eight Packaging <packaging@pulse-eight.com> Tue, 01 Dec 2015 02:48:06 +0100

platform (1.0.10-1~trusty) trusty; urgency=medium

* fixed: posix socket return value for connect
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
platform (2.0.0-1~#DIST#) #DIST#; urgency=medium

* removed: fstrcmp and StringUtils::CompareFuzzy() +
StringUtils::FindBestMatch() because of an incompatible license

-- Pulse-Eight Packaging <packaging@pulse-eight.com> Tue, 01 Dec 2015 02:48:06 +0100

platform (1.0.10-1~#DIST#) #DIST#; urgency=medium

* fixed: posix socket return value for connect
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Package: libplatform-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: libplatform1 (= ${binary:Version})
Depends: libplatform2 (= ${binary:Version})
Provides: libplatform-dev
Description: Platform support library -- development files
Platform support library

Package: libplatform1
Package: libplatform2
Section: libs
Architecture: any
Multi-Arch: same
Expand Down
File renamed without changes.
25 changes: 0 additions & 25 deletions src/util/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


#include "StringUtils.h"
#include "fstrcmp.h"
#include <locale>

#include <assert.h>
Expand Down Expand Up @@ -1093,30 +1092,6 @@ std::string StringUtils::CreateUUID()
return UuidStrTmp;
}

double StringUtils::CompareFuzzy(const std::string &left, const std::string &right)
{
return (0.5 + fstrcmp(left.c_str(), right.c_str(), 0.0) * (left.length() + right.length())) / 2.0;
}

int StringUtils::FindBestMatch(const std::string &str, const vector<string> &strings, double &matchscore)
{
int best = -1;
matchscore = 0;

int i = 0;
for (vector<string>::const_iterator it = strings.begin(); it != strings.end(); ++it, i++)
{
int maxlength = max(str.length(), it->length());
double score = StringUtils::CompareFuzzy(str, *it) / maxlength;
if (score > matchscore)
{
matchscore = score;
best = i;
}
}
return best;
}

bool StringUtils::ContainsKeyword(const std::string &str, const vector<string> &keywords)
{
for (vector<string>::const_iterator it = keywords.begin(); it != keywords.end(); ++it)
Expand Down
2 changes: 0 additions & 2 deletions src/util/StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ class StringUtils
static int DateStringToYYYYMMDD(const std::string &dateString);
static void WordToDigits(std::string &word);
static std::string CreateUUID();
static double CompareFuzzy(const std::string &left, const std::string &right);
static int FindBestMatch(const std::string &str, const std::vector<std::string> &strings, double &matchscore);
static bool ContainsKeyword(const std::string &str, const std::vector<std::string> &keywords);

/*! \brief Escapes the given string to be able to be used as a parameter.
Expand Down
114 changes: 0 additions & 114 deletions src/util/fstrcmp.c

This file was deleted.

36 changes: 0 additions & 36 deletions src/util/fstrcmp.h

This file was deleted.

0 comments on commit a1e5905

Please sign in to comment.