74 void keep_store_alive(std::shared_ptr<void> owner)
noexcept { owner_ = std::move(owner); }
96 std::size_t
read(
size_type offset,
void* destination, std::size_t bytes)
const;
99 int compare(
const char* value)
const {
return compare(std::string_view(value)); }
100 int compare(
const std::string& value)
const {
return compare(std::string_view(value)); }
112 template <
class Sink>
115 std::array<char, chunk_bytes> buffer{};
117 const auto n =
read(offset, buffer.data(), buffer.size());
118 sink.bytes(buffer.data(), n);
128 template <
class Function>
131 std::forward<Function>(function)(temporary);
132 ScriptString replacement(required_store(), std::string_view(temporary));
133 replacement.owner_ = owner_;
140 std::shared_ptr<void> owner_;
141 detail::o1::Store& required_store()
const;
160 return std::string_view(a) + b;
163 return std::string_view(a) + b;
166 return std::string_view(&a, 1) + b;
189template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
191template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
193template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
195template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
197template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
199template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
201template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
203template <
class Text, std::enable_if_t<std::is_convertible_v<const Text&, std::
string_view>,
int> = 0>
224 return a.owner_ == b.owner_ && a.start_ == b.start_;
235 : source_(
std::move(
source)), separator_(
std::move(separator)) {}
240 template <
class Function>
void for_each(Function&& emit)
const {
241 for (
auto part : *
this) emit(std::move(part));
friend class ScriptStringParts
friend bool operator!=(const iterator &a, const iterator &b)
std::ptrdiff_t difference_type
friend bool operator==(const iterator &a, const iterator &b)
std::input_iterator_tag iterator_category
ScriptString operator*() const
void for_each(Function &&emit) const
ScriptStringParts(ScriptString source, ScriptString separator)
ScriptString operator[](ScriptString::size_type) const
ScriptString::size_type size() const
ScriptStringScope(const ScriptStringScope &)=delete
static detail::o1::Store & current()
ScriptStringScope(detail::o1::Store &store) noexcept
ScriptStringScope & operator=(const ScriptStringScope &)=delete
int compare(const char *value) const
ScriptString substr(size_type pos=0, size_type count=npos) const
size_type length() const noexcept
ScriptString & operator+=(std::string_view value)
ScriptString & append(const ScriptString &)
ScriptString & operator+=(char value)
static constexpr std::size_t chunk_bytes
size_type find(std::string_view, size_type pos=0) const
size_type find(const ScriptString &, size_type pos=0) const
int compare(std::string_view) const
ScriptString & append(const char *value)
static ScriptString from_handle(detail::o1::Store &, Handle)
std::string to_std_string() const
ScriptString & operator+=(const ScriptString &value)
size_type find(char, size_type pos=0) const
void hash_into(Sink &sink) const
ScriptString(const char *)
bool empty() const noexcept
void swap(ScriptString &) noexcept
ScriptString & operator+=(const std::string &value)
int compare(const ScriptString &) const
int compare(const std::string &value) const
size_type find(const char *value, size_type pos=0) const
ScriptString(const std::string &)
ScriptString(ScriptString &&) noexcept
size_type size() const noexcept
void with_std_string(Function &&function)
size_type find(const std::string &value, size_type pos=0) const
ScriptString & append(const std::string &value)
char operator[](size_type) const
detail::o1::Store * store() const noexcept
ScriptString(const ScriptString &)
static void unpin(detail::o1::Store &, Handle)
void keep_store_alive(std::shared_ptr< void > owner) noexcept
std::size_t read(size_type offset, void *destination, std::size_t bytes) const
void reserve(size_type proven_byte_bound)
ScriptString(std::string_view)
ScriptString() noexcept=default
int compare(size_type pos, size_type count, const ScriptString &) const
ScriptString & operator+=(const char *value)
static constexpr size_type npos
ScriptString & append(std::string_view)
ScriptString operator+(ScriptString a, const ScriptString &b)
double str_tonumber(const ScriptString &)
bool operator<=(const ScriptString &a, const ScriptString &b)
bool operator!=(const ScriptString &a, const ScriptString &b)
bool operator>(const ScriptString &a, const ScriptString &b)
bool operator<(const ScriptString &a, const ScriptString &b)
bool operator>=(const ScriptString &a, const ScriptString &b)
void swap(ScriptString &a, ScriptString &b) noexcept
bool operator==(const ScriptString &a, const ScriptString &b)
size_t operator()(const pineforge::ScriptString &value) const