1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-02-19 12:04:54 +00:00

Move split_tags to common lib.

This commit is contained in:
King_DuckZ 2016-05-16 09:59:10 +02:00
parent 1192ce7c18
commit 5832ca3374
7 changed files with 10 additions and 11 deletions

View file

@ -23,8 +23,8 @@
#include <boost/utility/string_ref.hpp>
#include "helpers/compatibility.h"
namespace din {
namespace dinlib {
std::vector<boost::string_ref> split_tags ( const std::string& parCommaSeparatedList ) a_pure;
} //namespace din
} //namespace dinlib
#endif

View file

@ -8,6 +8,7 @@ add_library(${PROJECT_NAME}
validationerror.cpp
common_info.cpp
readline_wrapper.cpp
split_tags.cpp
)
target_include_directories(${PROJECT_NAME}

View file

@ -15,7 +15,7 @@
* along with "dindexer". If not, see <http://www.gnu.org/licenses/>.
*/
#include "split_tags.hpp"
#include "dindexer-common/split_tags.hpp"
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
@ -24,7 +24,7 @@
#include <boost/range/adaptor/filtered.hpp>
#include <ciso646>
namespace din {
namespace dinlib {
std::vector<boost::string_ref> split_tags (const std::string& parCommaSeparatedList) {
using OutRange = boost::iterator_range<std::string::const_iterator>;
using boost::token_finder;
@ -48,4 +48,4 @@ namespace din {
filtered([](const string_ref& r){return not r.empty();})
);
}
} //namespace din
} //namespace dinlib

View file

@ -3,7 +3,6 @@ project(${bare_name}-tag CXX)
add_executable(${PROJECT_NAME}
main.cpp
commandline.cpp
split_tags.cpp
tag_postgres.cpp
)

View file

@ -19,7 +19,7 @@
#include "dindexer-common/settings.hpp"
#include "dindexerConfig.h"
#include "tag_postgres.hpp"
#include "split_tags.hpp"
#include "dindexer-common/split_tags.hpp"
#include <iostream>
#include <ciso646>
@ -60,7 +60,7 @@ int main (int parArgc, char* parArgv[]) {
}
const auto master_tags_string = vm["tags"].as<std::string>();
std::vector<boost::string_ref> tags = din::split_tags(master_tags_string);
std::vector<boost::string_ref> tags = dinlib::split_tags(master_tags_string);
din::tag_files(settings.db, ids, tags);
return 0;

View file

@ -4,7 +4,6 @@ add_executable(${PROJECT_NAME}
${CMAKE_SOURCE_DIR}/src/main/damerau_levenshtein.c
${CMAKE_SOURCE_DIR}/src/main/utf8_ops.c
test_damerau_levenshtein.cpp
${CMAKE_SOURCE_DIR}/src/tag/split_tags.cpp
test_tag_splitting.cpp
)

View file

@ -18,10 +18,10 @@
#include <gtest/gtest.h>
#include <sstream>
#include <boost/lexical_cast.hpp>
#include "tag/split_tags.hpp"
#include "dindexer-common/split_tags.hpp"
TEST(cli_main, split_tags) {
using din::split_tags;
using dinlib::split_tags;
{
const std::string test_tags = "tag1,tag2";