Browse Source

First pass: deprecating Reference_String

task/remove_strings
Jessica James 3 years ago
parent
commit
b010fea392
  1. 3
      src/include/Jupiter/Readable_String.h
  2. 59
      src/include/Jupiter/Reference_String.h
  3. 204
      src/include/Jupiter/Reference_String_Imp.h

3
src/include/Jupiter/Readable_String.h

@ -455,9 +455,6 @@ namespace Jupiter
/** Generic Readable String Type */ /** Generic Readable String Type */
typedef Readable_String<char> ReadableString; typedef Readable_String<char> ReadableString;
/** Generic Wide Readable String Type */
typedef Readable_String<wchar_t> ReadableWString;
} }
#include "Readable_String_Imp.h" #include "Readable_String_Imp.h"

59
src/include/Jupiter/Reference_String.h

@ -22,9 +22,10 @@
/** /**
* @file Reference_String.h * @file Reference_String.h
* @brief Provides the basis for String types, of any implementation. * @brief Provides the basis for String types, of any implementation.
* Note: Some methods are commented out. This means that they should be implemented, but could not be put declared in this template (return of abstract type). * Note: DEPRECATED
*/ */
#include <string_view>
#include "Readable_String.h" #include "Readable_String.h"
namespace Jupiter namespace Jupiter
@ -36,8 +37,8 @@ namespace Jupiter
* *
* @param T Element type which the String will store. Defaults to char. * @param T Element type which the String will store. Defaults to char.
*/ */
template<typename T = char> class Reference_String : public Jupiter::Readable_String<T> template<typename T = char> class Reference_String : public Jupiter::Readable_String<T>, public std::basic_string_view<T> {
{ /** DEPRECATED IN FAVOR OF std::string_view */
public: public:
/** /**
@ -46,21 +47,21 @@ namespace Jupiter
* @param index Index of the element to return. * @param index Index of the element to return.
* @return The element located at the specified index. * @return The element located at the specified index.
*/ */
const T &get(size_t index) const; const T &get(size_t index) const override;
/** /**
* @brief Returns the number of elements in the String. * @brief Returns the number of elements in the String.
* *
* @return Number of elements in the string. * @return Number of elements in the string.
*/ */
size_t size() const; size_t size() const override;
/** /**
* @brief Returns a pointer to the underlying string of elements. * @brief Returns a pointer to the underlying string of elements.
* *
* @return Pointer to the underlying string of elements. * @return Pointer to the underlying string of elements.
*/ */
const T *ptr() const; const T *ptr() const override;
/** /**
* @brief Truncates the string by a specified number of elements. * @brief Truncates the string by a specified number of elements.
@ -262,36 +263,30 @@ namespace Jupiter
static typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> tokenize(const Jupiter::Readable_String<T> &in, const T *separator, size_t separator_size); static typename Jupiter::Readable_String<T>::template TokenizeResult<Jupiter::Reference_String> tokenize(const Jupiter::Readable_String<T> &in, const T *separator, size_t separator_size);
/** Mutative operators */ /** Mutative operators */
inline Readable_String<T> &operator-=(size_t right) { this->truncate(right); return *this; }; inline Reference_String<T>& operator-=(size_t right) { this->truncate(right); return *this; };
inline Readable_String<T> &operator=(const Readable_String<T> &right) { this->set(right); return *this; }; inline Reference_String<T>& operator=(const Readable_String<T> &right) { std::basic_string_view<T>::operator=({right.ptr(), right.size()}); return *this; };
inline Readable_String<T> &operator=(const Reference_String<T> &right) { this->set(right); return *this; }; inline Reference_String<T>& operator=(const Reference_String<T> &right) = default;
inline Readable_String<T> &operator=(const std::basic_string<T> &right) { this->set(right); return *this; }; inline Reference_String<T>& operator=(const std::basic_string<T> &right) { std::basic_string_view<T>::operator=(right); return *this; };
inline Readable_String<T> &operator=(const T *right) { this->set(right); return *this; }; inline Reference_String<T>& operator=(const std::basic_string_view<T> &right) { std::basic_string_view<T>::operator=(right); return *this; };
inline Reference_String<T>& operator=(const T *right) { std::basic_string_view<T>::operator=(right); return *this; };
/** /**
* @brief Default constructor for the Reference_String class. * @brief Default constructor for the Reference_String class.
*/ */
Reference_String(); Reference_String() = default;
/** /**
* @brief Creates a reference to a C-Style string. * @brief Creates a reference to a C-Style string.
* Difference from basic_string_view: checks nullptr
* *
* @param in String to get a reference of. * @param in String to get a reference of.
*/ */
Reference_String(const T *in); Reference_String(const T *in);
/**
* @brief Creates a reference to a string.
*
* @param in String to get a reference of.
* @param len Length of the string to track.
*/
Reference_String(const T *in, size_t len);
/** /**
* @brief Move constructor for the Reference_String class. * @brief Move constructor for the Reference_String class.
*/ */
Reference_String(Jupiter::Reference_String<T> &&source); Reference_String(Jupiter::Reference_String<T> &&source) = default;
/** /**
* @brief Constructor for the Refererence_String class to create a reference to an existing string. * @brief Constructor for the Refererence_String class to create a reference to an existing string.
@ -301,32 +296,24 @@ namespace Jupiter
/** /**
* @brief Copy constructor for the Reference_String class. * @brief Copy constructor for the Reference_String class.
*/ */
Reference_String(const Jupiter::Reference_String<T> &in); Reference_String(const Jupiter::Reference_String<T> &in) = default;
/** // Bring in constructors from basic_string_view
* @brief Conversion constructor for Jupiter::DataBuffer class. using std::basic_string_view<T>::basic_string_view;
*/
Reference_String(const Jupiter::DataBuffer &in);
static const Jupiter::Reference_String<T> empty; /** Empty instantiation of Reference_String */ static const Jupiter::Reference_String<T> empty; /** Empty instantiation of Reference_String */
protected: /** Methods to force disambiguation between bases until this class is removed entirely */
using std::basic_string_view<T>::find;
const T *str; /** Pointer for the underlying string of elements */ using std::basic_string_view<T>::operator[];
size_t length; /** Number of representable elements in the string */
}; };
/** Generic Reference String Type */ /** Generic Reference String Type */
typedef Reference_String<char> ReferenceString; typedef Reference_String<char> ReferenceString;
/** Generic Wide Reference String Type */ namespace literals {
typedef Reference_String<wchar_t> ReferenceWString;
namespace literals
{
/** Reference_String literals */ /** Reference_String literals */
inline Jupiter::ReferenceString operator"" _jrs(const char *str, size_t len) { return Jupiter::ReferenceString(str, len); } inline Jupiter::ReferenceString operator"" _jrs(const char *str, size_t len) { return Jupiter::ReferenceString(str, len); }
inline Jupiter::ReferenceWString operator"" _jrws(const wchar_t *str, size_t len) { return Jupiter::ReferenceWString(str, len); }
} }
} }

204
src/include/Jupiter/Reference_String_Imp.h

@ -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) template<typename T> Jupiter::Reference_String<T>::Reference_String(const Jupiter::Readable_String<T>& in)
{ : Reference_String(in.ptr(), in.size()) {
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> const T &Jupiter::Reference_String<T>::get(size_t index) const {
{ return operator[](index);
} }
template<typename T> Jupiter::Reference_String<T>::Reference_String(const Jupiter::Reference_String<T> &in) : Reference_String(in.str, in.length) template<typename T> size_t Jupiter::Reference_String<T>::size() const {
{ return std::basic_string_view<T>::size();
} }
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> const T* Jupiter::Reference_String<T>::ptr() const {
{ return std::basic_string_view<T>::data();
}
template<typename T> const T &Jupiter::Reference_String<T>::get(size_t index) const
{
return Jupiter::Reference_String<T>::str[index];
}
template<typename T> size_t Jupiter::Reference_String<T>::size() const
{
return Jupiter::Reference_String<T>::length;
}
template<typename T> const T *Jupiter::Reference_String<T>::ptr() const
{
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_);

Loading…
Cancel
Save