mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-06 07:32:27 +00:00
44 lines
904 B
C++
44 lines
904 B
C++
#pragma once
|
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
|
#include <Dictionaries/LibraryDictionarySourceExternal.h>
|
|
#include <Core/Block.h>
|
|
#include <ext/bit_cast.h>
|
|
#include <ext/range.h>
|
|
|
|
|
|
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();
|
|
|
|
ptr_holder = std::make_unique<ClickHouseLibrary::CString[]>(strings.size);
|
|
strings.data = ptr_holder.get();
|
|
|
|
size_t i = 0;
|
|
for (auto & str : strings_holder)
|
|
{
|
|
strings.data[i] = str.c_str();
|
|
++i;
|
|
}
|
|
}
|
|
|
|
ClickHouseLibrary::CStrings strings; // will pass pointer to lib
|
|
|
|
private:
|
|
std::unique_ptr<ClickHouseLibrary::CString[]> ptr_holder = nullptr;
|
|
Container strings_holder;
|
|
};
|
|
|
|
|
|
}
|