2021-03-05 09:38:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
|
|
|
#include <Core/Block.h>
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/bit_cast.h>
|
|
|
|
#include <base/range.h>
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2022-08-03 11:19:13 +00:00
|
|
|
#include "ExternalDictionaryLibraryAPI.h"
|
2021-04-13 19:53:36 +00:00
|
|
|
|
2021-03-05 09:38:00 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class CStringsHolder
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
using Container = std::vector<std::string>;
|
|
|
|
|
|
|
|
explicit CStringsHolder(const Container & strings_pass)
|
|
|
|
{
|
|
|
|
strings_holder = strings_pass;
|
|
|
|
strings.size = strings_holder.size();
|
|
|
|
|
2022-08-03 11:19:13 +00:00
|
|
|
ptr_holder = std::make_unique<ExternalDictionaryLibraryAPI::CString[]>(strings.size);
|
2021-03-05 09:38:00 +00:00
|
|
|
strings.data = ptr_holder.get();
|
|
|
|
|
|
|
|
size_t i = 0;
|
|
|
|
for (auto & str : strings_holder)
|
|
|
|
{
|
|
|
|
strings.data[i] = str.c_str();
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-03 11:19:13 +00:00
|
|
|
ExternalDictionaryLibraryAPI::CStrings strings; // will pass pointer to lib
|
2021-03-05 09:38:00 +00:00
|
|
|
|
|
|
|
private:
|
2022-08-03 11:19:13 +00:00
|
|
|
std::unique_ptr<ExternalDictionaryLibraryAPI::CString[]> ptr_holder = nullptr;
|
2021-03-05 09:38:00 +00:00
|
|
|
Container strings_holder;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|