|
@ -26,220 +26,175 @@ |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#include "Reference_String.h" |
|
|
#include "Reference_String.h" |
|
|
|
|
|
#include <algorithm> // std::min according to standard |
|
|
|
|
|
#include <cmath> // std::min on MSVC |
|
|
#include "Functions.h" |
|
|
#include "Functions.h" |
|
|
|
|
|
|
|
|
|
|
|
// A hack due to some Windows.h inclusion somewhere, ugh
|
|
|
|
|
|
#ifdef min |
|
|
|
|
|
#undef min |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* IMPLEMENTATION: |
|
|
* IMPLEMENTATION: |
|
|
* Reference_String |
|
|
* Reference_String |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String() : Reference_String(nullptr, 0) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const T *in) |
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const T *in) |
|
|
{ |
|
|
: std::basic_string_view<T>{} { |
|
|
Jupiter::Reference_String<T>::str = in; |
|
|
if (in != nullptr) { |
|
|
if (in == nullptr) Jupiter::Reference_String<T>::length = 0; |
|
|
*this = in; |
|
|
else Jupiter::Reference_String<T>::length = Jupiter::strlen<T>(in); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const T *in, size_t len) |
|
|
|
|
|
{ |
|
|
|
|
|
Jupiter::Reference_String<T>::str = in; |
|
|
|
|
|
Jupiter::Reference_String<T>::length = len; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(Jupiter::Reference_String<T> &&source) |
|
|
|
|
|
{ |
|
|
|
|
|
Jupiter::Reference_String<T>::str = source.str; |
|
|
|
|
|
Jupiter::Reference_String<T>::length = source.length; |
|
|
|
|
|
source.length = 0; |
|
|
|
|
|
source.str = nullptr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const Jupiter::Readable_String<T> &in) : Reference_String(in.ptr(), in.size()) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const Jupiter::Reference_String<T> &in) : Reference_String(in.str, in.length) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const Jupiter::DataBuffer &in) : Reference_String(reinterpret_cast<T *>(in.getHead()), in.size() / sizeof(T)) |
|
|
template<typename T> Jupiter::Reference_String<T>::Reference_String(const Jupiter::Readable_String<T>& in) |
|
|
{ |
|
|
: Reference_String(in.ptr(), in.size()) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> const T &Jupiter::Reference_String<T>::get(size_t index) const |
|
|
template<typename T> const T &Jupiter::Reference_String<T>::get(size_t index) const { |
|
|
{ |
|
|
return operator[](index); |
|
|
return Jupiter::Reference_String<T>::str[index]; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::size() const |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::size() const { |
|
|
{ |
|
|
return std::basic_string_view<T>::size(); |
|
|
return Jupiter::Reference_String<T>::length; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> const T *Jupiter::Reference_String<T>::ptr() const |
|
|
template<typename T> const T* Jupiter::Reference_String<T>::ptr() const { |
|
|
{ |
|
|
return std::basic_string_view<T>::data(); |
|
|
return Jupiter::Reference_String<T>::str; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// truncate
|
|
|
// truncate
|
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::truncate(size_t n) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::truncate(size_t n) { |
|
|
{ |
|
|
std::basic_string_view<T>::remove_suffix(std::min(n, size())); |
|
|
if (n >= Jupiter::Reference_String<T>::length) return (Jupiter::Reference_String<T>::length = 0); |
|
|
return size(); |
|
|
return (Jupiter::Reference_String<T>::length -= n); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// erase
|
|
|
// erase
|
|
|
|
|
|
|
|
|
template<typename T> void Jupiter::Reference_String<T>::erase() |
|
|
template<typename T> void Jupiter::Reference_String<T>::erase() { |
|
|
{ |
|
|
std::basic_string_view<T>::remove_suffix(size()); |
|
|
Jupiter::Reference_String<T>::length = 0; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// shift
|
|
|
// shift
|
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::shiftLeft(size_t len) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::shiftLeft(size_t len) { |
|
|
{ |
|
|
*this = std::basic_string_view<T>{ this->data() - len, size() }; |
|
|
Jupiter::Reference_String<T>::str -= len; |
|
|
|
|
|
Jupiter::Reference_String<T>::length += len; |
|
|
|
|
|
return len; |
|
|
return len; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::shiftRight(size_t len) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::shiftRight(size_t len) { |
|
|
{ |
|
|
len = std::min(len, size()); |
|
|
if (len > Jupiter::Reference_String<T>::length) len = Jupiter::Reference_String<T>::length; |
|
|
this->remove_prefix(len); |
|
|
Jupiter::Reference_String<T>::str += len; |
|
|
|
|
|
Jupiter::Reference_String<T>::length -= len; |
|
|
|
|
|
return len; |
|
|
return len; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// set
|
|
|
// set
|
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const Jupiter::Readable_String<T> &in) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const Jupiter::Readable_String<T> &in) { |
|
|
{ |
|
|
|
|
|
return this->set(in.ptr(), in.size()); |
|
|
return this->set(in.ptr(), in.size()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const std::basic_string<T> &in) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const std::basic_string<T> &in) { |
|
|
{ |
|
|
*this = in; |
|
|
return this->set(in.data(), in.size()); |
|
|
return size(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const T *in, size_t len) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const T *in, size_t len) { |
|
|
{ |
|
|
*this = std::basic_string_view<T>{ in, len }; |
|
|
Jupiter::Reference_String<T>::str = in; |
|
|
return size(); |
|
|
return Jupiter::Reference_String<T>::length = len; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const T *in) |
|
|
template<typename T> size_t Jupiter::Reference_String<T>::set(const T *in) { |
|
|
{ |
|
|
if (in == nullptr) { |
|
|
if (in == nullptr) return this->set(in, 0); |
|
|
*this = std::basic_string_view<T>{}; |
|
|
return this->set(in, Jupiter::strlen<T>(in)); |
|
|
} |
|
|
|
|
|
*this = std::basic_string_view<T>{ in }; |
|
|
|
|
|
return size(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(size_t pos) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(size_t pos) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::substring(*this, pos); |
|
|
return Jupiter::Reference_String<T>::substring(*this, pos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(size_t pos, size_t len) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(size_t pos, size_t len) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::substring(*this, pos, len); |
|
|
return Jupiter::Reference_String<T>::substring(*this, pos, len); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const Jupiter::Readable_String<T> &in, size_t pos) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const Jupiter::Readable_String<T> &in, size_t pos) { |
|
|
{ |
|
|
pos = std::min(pos, in.size()); |
|
|
if (pos > in.size()) pos = in.size(); |
|
|
|
|
|
return Jupiter::Reference_String<T>(in.ptr() + pos, in.size() - pos); |
|
|
return Jupiter::Reference_String<T>(in.ptr() + pos, in.size() - pos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const T *in, size_t pos) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const T *in, size_t pos) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>(in + pos); |
|
|
return Jupiter::Reference_String<T>(in + pos); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const Jupiter::Readable_String<T> &in, size_t pos, size_t len) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const Jupiter::Readable_String<T> &in, size_t pos, size_t len) { |
|
|
{ |
|
|
if (pos + len > in.size()) { |
|
|
if (pos + len > in.size()) return Jupiter::Reference_String<T>::substring(in, pos); |
|
|
return Jupiter::Reference_String<T>::substring(in, pos); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return Jupiter::Reference_String<T>(in.ptr() + pos, len); |
|
|
return Jupiter::Reference_String<T>(in.ptr() + pos, len); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const T *in, size_t pos, size_t len) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::substring(const T *in, size_t pos, size_t len) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>(in + pos, len); |
|
|
return Jupiter::Reference_String<T>(in + pos, len); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getWord(size_t pos, const T *whitespace) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getWord(size_t pos, const T *whitespace) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::getWord(*this, pos, whitespace); |
|
|
return Jupiter::Reference_String<T>::getWord(*this, pos, whitespace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getWord(const Jupiter::Readable_String<T> &in, size_t pos, const T *whitespace) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getWord(const Jupiter::Readable_String<T> &in, size_t pos, const T *whitespace) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template getWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
return Jupiter::Readable_String<T>::template getWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getWord(const T *in, size_t pos, const T *whitespace) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getWord(const T *in, size_t pos, const T *whitespace) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template getWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
return Jupiter::Readable_String<T>::template getWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(size_t pos, const T &token) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(size_t pos, const T &token) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::getToken(*this, pos, token); |
|
|
return Jupiter::Reference_String<T>::getToken(*this, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(size_t pos, const Jupiter::Readable_String<T> &token) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(size_t pos, const Jupiter::Readable_String<T> &token) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::getToken(*this, pos, token); |
|
|
return Jupiter::Reference_String<T>::getToken(*this, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(const Jupiter::Readable_String<T> &in, size_t pos, const T &token) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(const Jupiter::Readable_String<T> &in, size_t pos, const T &token) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template getToken<Jupiter::Reference_String>(in, pos, token); |
|
|
return Jupiter::Readable_String<T>::template getToken<Jupiter::Reference_String>(in, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(const Jupiter::Readable_String<T> &in, size_t pos, const Jupiter::Readable_String<T> &token) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::getToken(const Jupiter::Readable_String<T> &in, size_t pos, const Jupiter::Readable_String<T> &token) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template getToken<Jupiter::Reference_String>(in, pos, token); |
|
|
return Jupiter::Readable_String<T>::template getToken<Jupiter::Reference_String>(in, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoWord(size_t pos, const T *whitespace) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoWord(size_t pos, const T *whitespace) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::gotoWord(*this, pos, whitespace); |
|
|
return Jupiter::Reference_String<T>::gotoWord(*this, pos, whitespace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoWord(const Jupiter::Readable_String<T> &in, size_t pos, const T *whitespace) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoWord(const Jupiter::Readable_String<T> &in, size_t pos, const T *whitespace) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template gotoWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
return Jupiter::Readable_String<T>::template gotoWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoWord(const T *in, size_t pos, const T *whitespace) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoWord(const T *in, size_t pos, const T *whitespace) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template gotoWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
return Jupiter::Readable_String<T>::template gotoWord<Jupiter::Reference_String>(in, pos, whitespace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(size_t pos, const T &token) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(size_t pos, const T &token) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::gotoToken(*this, pos, token); |
|
|
return Jupiter::Reference_String<T>::gotoToken(*this, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(size_t pos, const Jupiter::Readable_String<T> &token) const |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(size_t pos, const Jupiter::Readable_String<T> &token) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::gotoToken(*this, pos, token); |
|
|
return Jupiter::Reference_String<T>::gotoToken(*this, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const T &token) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const T &token) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template gotoToken<Jupiter::Reference_String>(in, pos, token); |
|
|
return Jupiter::Readable_String<T>::template gotoToken<Jupiter::Reference_String>(in, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const Jupiter::Readable_String<T> &token) |
|
|
template<typename T> Jupiter::Reference_String<T> Jupiter::Reference_String<T>::gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const Jupiter::Readable_String<T> &token) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template gotoToken<Jupiter::Reference_String>(in, pos, token); |
|
|
return Jupiter::Readable_String<T>::template gotoToken<Jupiter::Reference_String>(in, pos, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -247,47 +202,38 @@ template<typename T> const Jupiter::Reference_String<T> Jupiter::Reference_Strin |
|
|
|
|
|
|
|
|
// tokenize
|
|
|
// tokenize
|
|
|
|
|
|
|
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const T &separator) const |
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const T &separator) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::tokenize(*this, separator); |
|
|
return Jupiter::Reference_String<T>::tokenize(*this, separator); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &separator) const |
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &separator) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::tokenize(*this, separator); |
|
|
return Jupiter::Reference_String<T>::tokenize(*this, separator); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const T *separator, size_t separator_size) const |
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const T *separator, size_t separator_size) const { |
|
|
{ |
|
|
|
|
|
return Jupiter::Reference_String<T>::tokenize(*this, separator, separator_size); |
|
|
return Jupiter::Reference_String<T>::tokenize(*this, separator, separator_size); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const T &token) |
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const T &token) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template tokenize<Jupiter::Reference_String>(in, token); |
|
|
return Jupiter::Readable_String<T>::template tokenize<Jupiter::Reference_String>(in, token); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const Jupiter::Readable_String<T> &separator) |
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const Jupiter::Readable_String<T> &separator) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template tokenize<Jupiter::Reference_String>(in, separator); |
|
|
return Jupiter::Readable_String<T>::template tokenize<Jupiter::Reference_String>(in, separator); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const T *separator, size_t separator_size) |
|
|
template<typename T> typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> Jupiter::Reference_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const T *separator, size_t separator_size) { |
|
|
{ |
|
|
|
|
|
return Jupiter::Readable_String<T>::template tokenize<Jupiter::Reference_String>(in, separator, separator_size); |
|
|
return Jupiter::Readable_String<T>::template tokenize<Jupiter::Reference_String>(in, separator, separator_size); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Jupiter::DataBuffer specialization
|
|
|
// Jupiter::DataBuffer specialization
|
|
|
|
|
|
|
|
|
template<> struct _Jupiter_DataBuffer_partial_specialization_impl<Jupiter::Reference_String> |
|
|
template<> struct _Jupiter_DataBuffer_partial_specialization_impl<Jupiter::Reference_String> { |
|
|
{ |
|
|
template<typename Y> static void push(Jupiter::DataBuffer *buffer, const Jupiter::Reference_String<Y> *data) { |
|
|
template<typename Y> static void push(Jupiter::DataBuffer *buffer, const Jupiter::Reference_String<Y> *data) |
|
|
|
|
|
{ |
|
|
|
|
|
_Jupiter_DataBuffer_partial_specialization_impl<Jupiter::Readable_String>::push<Y>(buffer, data); |
|
|
_Jupiter_DataBuffer_partial_specialization_impl<Jupiter::Readable_String>::push<Y>(buffer, data); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
template<typename Y> static Jupiter::Reference_String<Y> interpret(uint8_t *&head) |
|
|
template<typename Y> static Jupiter::Reference_String<Y> interpret(uint8_t *&head) { |
|
|
{ |
|
|
|
|
|
size_t size_ = *reinterpret_cast<size_t *>(head); |
|
|
size_t size_ = *reinterpret_cast<size_t *>(head); |
|
|
head += sizeof(size_t); |
|
|
head += sizeof(size_t); |
|
|
Jupiter::Reference_String<Y> r = Jupiter::Reference_String<Y>(reinterpret_cast<Y *>(head), size_); |
|
|
Jupiter::Reference_String<Y> r = Jupiter::Reference_String<Y>(reinterpret_cast<Y *>(head), size_); |
|
|