mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-15 15:26:19 -04:00
folly::Range -> std::span in string_table
This commit is contained in:
parent
5132082762
commit
3a09d21d05
@ -23,12 +23,11 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <folly/Range.h>
|
|
||||||
|
|
||||||
#include "dwarfs/gen-cpp2/metadata_layouts.h"
|
#include "dwarfs/gen-cpp2/metadata_layouts.h"
|
||||||
|
|
||||||
namespace dwarfs {
|
namespace dwarfs {
|
||||||
@ -66,24 +65,24 @@ class string_table {
|
|||||||
size_t unpacked_size() const { return impl_->unpacked_size(); }
|
size_t unpacked_size() const { return impl_->unpacked_size(); }
|
||||||
|
|
||||||
static thrift::metadata::string_table
|
static thrift::metadata::string_table
|
||||||
pack(folly::Range<std::string const*> input,
|
pack(std::span<std::string const> input,
|
||||||
pack_options const& options = pack_options());
|
pack_options const& options = pack_options());
|
||||||
|
|
||||||
static thrift::metadata::string_table
|
static thrift::metadata::string_table
|
||||||
pack(folly::Range<std::string_view const*> input,
|
pack(std::span<std::string_view const> input,
|
||||||
pack_options const& options = pack_options());
|
pack_options const& options = pack_options());
|
||||||
|
|
||||||
static thrift::metadata::string_table
|
static thrift::metadata::string_table
|
||||||
pack(std::vector<std::string> const& input,
|
pack(std::vector<std::string> const& input,
|
||||||
pack_options const& options = pack_options()) {
|
pack_options const& options = pack_options()) {
|
||||||
return pack(folly::Range(input.data(), input.size()), options);
|
return pack(std::span(input.data(), input.size()), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
static thrift::metadata::string_table
|
static thrift::metadata::string_table
|
||||||
pack(std::array<std::string_view, N> const& input,
|
pack(std::array<std::string_view, N> const& input,
|
||||||
pack_options const& options = pack_options()) {
|
pack_options const& options = pack_options()) {
|
||||||
return pack(folly::Range(input.data(), input.size()), options);
|
return pack(std::span(input.data(), input.size()), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
class impl {
|
class impl {
|
||||||
@ -99,7 +98,7 @@ class string_table {
|
|||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static thrift::metadata::string_table
|
static thrift::metadata::string_table
|
||||||
pack_generic(folly::Range<T const*> input, pack_options const& options);
|
pack_generic(std::span<T const> input, pack_options const& options);
|
||||||
|
|
||||||
std::unique_ptr<impl const> impl_;
|
std::unique_ptr<impl const> impl_;
|
||||||
};
|
};
|
||||||
|
@ -185,7 +185,7 @@ string_table::string_table(logger& lgr, std::string_view name,
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
thrift::metadata::string_table
|
thrift::metadata::string_table
|
||||||
string_table::pack_generic(folly::Range<T const*> input,
|
string_table::pack_generic(std::span<T const> input,
|
||||||
pack_options const& options) {
|
pack_options const& options) {
|
||||||
auto size = input.size();
|
auto size = input.size();
|
||||||
bool pack_data = options.pack_data;
|
bool pack_data = options.pack_data;
|
||||||
@ -296,13 +296,13 @@ string_table::pack_generic(folly::Range<T const*> input,
|
|||||||
}
|
}
|
||||||
|
|
||||||
thrift::metadata::string_table
|
thrift::metadata::string_table
|
||||||
string_table::pack(folly::Range<std::string const*> input,
|
string_table::pack(std::span<std::string const> input,
|
||||||
pack_options const& options) {
|
pack_options const& options) {
|
||||||
return pack_generic(input, options);
|
return pack_generic(input, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
thrift::metadata::string_table
|
thrift::metadata::string_table
|
||||||
string_table::pack(folly::Range<std::string_view const*> input,
|
string_table::pack(std::span<std::string_view const> input,
|
||||||
pack_options const& options) {
|
pack_options const& options) {
|
||||||
return pack_generic(input, options);
|
return pack_generic(input, options);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user