Browse Source

Added erase() to String_Type.

Added concatentation operators and constructors for various String classes.
release/0.19
JustinAJ 10 years ago
parent
commit
69acccc2f2
  1. 50
      Jupiter/CString.h
  2. 96
      Jupiter/CString_Imp.h
  3. 5
      Jupiter/Shift_String.h
  4. 6
      Jupiter/Shift_String_Imp.h
  5. 50
      Jupiter/String.h
  6. 96
      Jupiter/String_Imp.h
  7. 5
      Jupiter/String_Type.h
  8. 7
      Jupiter/String_Type_Imp.h
  9. BIN
      Release/Jupiter.lib

50
Jupiter/CString.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2013-2014 Justin James. * Copyright (C) 2013-2015 Justin James.
* *
* This license must be preserved. * This license must be preserved.
* Any applications, libraries, or code which make any use of any * Any applications, libraries, or code which make any use of any
@ -205,15 +205,6 @@ namespace Jupiter
size_t concat(const T *in); size_t concat(const T *in);
size_t concat(const T in); size_t concat(const T in);
/** Assignment Operators */
inline CString_Type<T> &operator=(const CString_Type<T> &right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const Readable_String<T> &right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const std::basic_string<T> &right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const T *right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const T right) { this->set(right); return *this; };
static const Jupiter::CString_Type<T> empty; /** Empty instantation of CString_Type */
/** Default Constructor */ /** Default Constructor */
CString_Type(); CString_Type();
@ -235,6 +226,22 @@ namespace Jupiter
CString_Type(const T *in, size_t len); CString_Type(const T *in, size_t len);
CString_Type(const T *in); CString_Type(const T *in);
/** Concatenation Constructor */
CString_Type(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
/** Addition Operators */
inline CString_Type<T> operator+(const CString_Type<T> &rhs) const;
inline CString_Type<T> operator+(const Readable_String<T> &rhs) const;
/** Assignment Operators */
inline CString_Type<T> &operator=(const CString_Type<T> &right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const Readable_String<T> &right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const std::basic_string<T> &right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const T *right) { this->set(right); return *this; };
inline CString_Type<T> &operator=(const T right) { this->set(right); return *this; };
static const Jupiter::CString_Type<T> empty; /** Empty instantiation of CString_Type */
protected: protected:
/** /**
@ -260,6 +267,11 @@ namespace Jupiter
}; };
template<typename T = char> using CString_Strict = CString_Type<T>; template<typename T = char> using CString_Strict = CString_Type<T>;
#if defined JUPITER_CSTRING_TYPE_OPERATOR_PLUS
/** String_Loose<T> Addition Operator */
template<typename T> static inline Jupiter::CString_Type<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
#endif // JUPITER_CSTRING_TYPE_OPERATOR_PLUS
/** /**
* @brief Provides a "loose" CString implementation that's more optimized for repeated concatenations. * @brief Provides a "loose" CString implementation that's more optimized for repeated concatenations.
* Note: The underlying C-style string will always have a size which is a power of 2, but no fewer than 8 elements. * Note: The underlying C-style string will always have a size which is a power of 2, but no fewer than 8 elements.
@ -382,14 +394,18 @@ namespace Jupiter
CString_Loose(CString_Loose<T> &&source); CString_Loose(CString_Loose<T> &&source);
/** Copy Constructors */ /** Copy Constructors */
CString_Loose(const CString_Loose &in); CString_Loose(const CString_Loose<T> &in);
CString_Loose(const Readable_String<T> &in); CString_Loose(const Readable_String<T> &in);
CString_Loose(const std::basic_string<T> &in); CString_Loose(const std::basic_string<T> &in);
CString_Loose(const T *in, size_t len); CString_Loose(const T *in, size_t len);
CString_Loose(const T *in); CString_Loose(const T *in);
static const Jupiter::CString_Loose<T> empty; /** Empty instantation of CString_Loose */ /** Concatenation Constructor */
static const size_t start_size = 8; /** Starting size for loose CStrings. */ CString_Loose(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
/** Addition Operators */
inline CString_Loose<T> operator+(const CString_Loose<T> &rhs) const;
inline CString_Loose<T> operator+(const Readable_String<T> &rhs) const;
/** Assignment Operators */ /** Assignment Operators */
inline CString_Loose<T> &operator=(const CString_Loose<T> &right) { this->set(right); return *this; }; inline CString_Loose<T> &operator=(const CString_Loose<T> &right) { this->set(right); return *this; };
@ -399,6 +415,9 @@ namespace Jupiter
inline CString_Loose<T> &operator=(const T *right) { this->set(right); return *this; }; inline CString_Loose<T> &operator=(const T *right) { this->set(right); return *this; };
inline CString_Loose<T> &operator=(const T right) { this->set(right); return *this; }; inline CString_Loose<T> &operator=(const T right) { this->set(right); return *this; };
static const Jupiter::CString_Loose<T> empty; /** Empty instantiation of CString_Loose */
static const size_t start_size = 8; /** Starting size for loose CStrings. */
protected: protected:
/** /**
@ -425,6 +444,11 @@ namespace Jupiter
size_t strSize; /** Size of underlying C-string buffer */ size_t strSize; /** Size of underlying C-string buffer */
}; };
#if defined JUPITER_CSTRING_LOOSE_OPERATOR_PLUS
/** String_Loose<T> Addition Operator */
template<typename T> static inline Jupiter::CString_LOOSE<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
#endif // JUPITER_CSTRING_LOOSE_OPERATOR_PLUS
/** Definition of a Loose CString. */ /** Definition of a Loose CString. */
typedef CString_Loose<char> CStringL; typedef CString_Loose<char> CStringL;

96
Jupiter/CString_Imp.h

@ -108,6 +108,36 @@ template<typename T> Jupiter::CString_Type<T>::CString_Type(const T *in)
} }
} }
template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) : CString_Type<T>(lhs.size() + rhs.size())
{
const T *itr;
const T *end;
if (lhs.isNotEmpty())
{
itr = lhs.ptr();
end = itr + lhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
if (rhs.isNotEmpty())
{
itr = rhs.ptr();
end = itr + rhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
*Jupiter::String_Type<T>::str = 0;
Jupiter::String_Type<T>::length = Jupiter::String_Type<T>::str - Jupiter::Shift_String_Type<T>::base;
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
template<typename T> bool Jupiter::CString_Type<T>::setBufferSize(size_t len) template<typename T> bool Jupiter::CString_Type<T>::setBufferSize(size_t len)
{ {
if (Jupiter::Shift_String_Type<T>::setBufferSize(len + 1)) if (Jupiter::Shift_String_Type<T>::setBufferSize(len + 1))
@ -385,6 +415,24 @@ template<typename T> size_t Jupiter::CString_Type<T>::concat(const T c)
return Jupiter::String_Type<T>::length; return Jupiter::String_Type<T>::length;
} }
// Operators
template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::operator+(const Jupiter::CString_Type<T> &rhs) const
{
return Jupiter::CString_Type<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
}
template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::operator+(const Jupiter::Readable_String<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if defined JUPITER_CSTRING_TYPE_OPERATOR_PLUS
template<typename T> static inline Jupiter::CString_Type<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs)
{
return Jupiter::CString_Type<T>(lhs, rhs);
}
#endif // JUPITER_CSTRING_TYPE_OPERATOR_PLUS
template<typename T> const Jupiter::CString_Type<T> Jupiter::CString_Type<T>::empty = Jupiter::CString_Type<T>(); template<typename T> const Jupiter::CString_Type<T> Jupiter::CString_Type<T>::empty = Jupiter::CString_Type<T>();
// Jupiter::DataBuffer specialization // Jupiter::DataBuffer specialization
@ -479,6 +527,36 @@ template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const T *in) : Jup
} }
} }
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) : CString_Loose<T>(lhs.size() + rhs.size())
{
const T *itr;
const T *end;
if (lhs.isNotEmpty())
{
itr = lhs.ptr();
end = itr + lhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
if (rhs.isNotEmpty())
{
itr = rhs.ptr();
end = itr + rhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
*Jupiter::String_Type<T>::str = 0;
Jupiter::String_Type<T>::length = Jupiter::String_Type<T>::str - Jupiter::Shift_String_Type<T>::base;
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
template<typename T> bool Jupiter::CString_Loose<T>::setBufferSize(size_t len) template<typename T> bool Jupiter::CString_Loose<T>::setBufferSize(size_t len)
{ {
len = getPowerTwo32(len + 1); len = getPowerTwo32(len + 1);
@ -590,6 +668,24 @@ template<typename T> Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::gotoWo
return Jupiter::Readable_String<T>::gotoWord<Jupiter::CString_Loose>(in, pos, whitespace); return Jupiter::Readable_String<T>::gotoWord<Jupiter::CString_Loose>(in, pos, whitespace);
} }
// Operators
template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::operator+(const Jupiter::CString_Loose<T> &rhs) const
{
return Jupiter::CString_Loose<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
}
template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::operator+(const Jupiter::Readable_String<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if defined JUPITER_CSTRING_LOOSE_OPERATOR_PLUS
template<typename T> static inline Jupiter::CString_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs)
{
return Jupiter::CString_Loose<T>(lhs, rhs);
}
#endif // JUPITER_CSTRING_LOOSE_OPERATOR_PLUS
template<typename T> const Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::empty = Jupiter::CString_Loose<T>(); template<typename T> const Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::empty = Jupiter::CString_Loose<T>();
// Jupiter::DataBuffer specialization // Jupiter::DataBuffer specialization

5
Jupiter/Shift_String.h

@ -76,6 +76,11 @@ namespace Jupiter
*/ */
virtual void remove(size_t index, size_t length) override; virtual void remove(size_t index, size_t length) override;
/**
* @brief Removes all elements from the string.
*/
virtual void erase();
/** /**
* @brief Default constructor for the Shift_String_Type class. * @brief Default constructor for the Shift_String_Type class.
*/ */

6
Jupiter/Shift_String_Imp.h

@ -72,6 +72,12 @@ template<typename T> void Jupiter::Shift_String_Type<T>::remove(size_t index, si
Jupiter::String_Type<T>::remove(index, len); Jupiter::String_Type<T>::remove(index, len);
} }
template<typename T> void Jupiter::Shift_String_Type<T>::erase()
{
Jupiter::String_Type<T>::erase();
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
template<typename T> bool Jupiter::Shift_String_Type<T>::setBufferSize(size_t len) template<typename T> bool Jupiter::Shift_String_Type<T>::setBufferSize(size_t len)
{ {
if (len > Jupiter::String_Type<T>::length) if (len > Jupiter::String_Type<T>::length)

50
Jupiter/String.h

@ -203,15 +203,6 @@ namespace Jupiter
static String_Strict<T> gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const T &token); static String_Strict<T> gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const T &token);
static String_Strict<T> gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const Jupiter::Readable_String<T> &token); static String_Strict<T> gotoToken(const Jupiter::Readable_String<T> &in, size_t pos, const Jupiter::Readable_String<T> &token);
/** Assignment Operators */
inline String_Strict<T> &operator=(const String_Strict<T> &right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const Readable_String<T> &right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const std::basic_string<T> &right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const T *right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const T right) { this->set(right); return *this; };
static const Jupiter::String_Strict<T> empty; /** Empty instantation of String_Strict */
/** Default Constructor */ /** Default Constructor */
String_Strict(); String_Strict();
@ -234,12 +225,33 @@ namespace Jupiter
String_Strict(const T *in); String_Strict(const T *in);
String_Strict(const Jupiter::DataBuffer &in); String_Strict(const Jupiter::DataBuffer &in);
/** Concatenation Constructor */
String_Strict(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
/** Addition Operators */
inline String_Strict<T> operator+(const String_Strict<T> &rhs) const;
inline String_Strict<T> operator+(const Readable_String<T> &rhs) const;
/** Assignment Operators */
inline String_Strict<T> &operator=(const String_Strict<T> &right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const Readable_String<T> &right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const std::basic_string<T> &right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const T *right) { this->set(right); return *this; };
inline String_Strict<T> &operator=(const T right) { this->set(right); return *this; };
static const Jupiter::String_Strict<T> empty; /** Empty instantiation of String_Strict */
protected: protected:
/** Dummy constructor to prevent string initialization */ /** Dummy constructor to prevent string initialization */
String_Strict(Jupiter::String_Constructor_Base &) {}; String_Strict(Jupiter::String_Constructor_Base &) {};
}; };
#if defined JUPITER_STRING_STRICT_OPERATOR_PLUS
/** String_Loose<T> Addition Operator */
template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS
/** /**
* @brief Provides a "loose" String implementation that's more optimized for repeated concatenations. * @brief Provides a "loose" String implementation that's more optimized for repeated concatenations.
* Note: The underlying string will always have a size which is a power of 2, but no fewer than 8 elements. * Note: The underlying string will always have a size which is a power of 2, but no fewer than 8 elements.
@ -424,15 +436,19 @@ namespace Jupiter
String_Loose(String_Loose<T> &&source); String_Loose(String_Loose<T> &&source);
/** Copy Constructors */ /** Copy Constructors */
String_Loose(const String_Loose &in); String_Loose(const String_Loose<T> &in);
String_Loose(const Readable_String<T> &in); String_Loose(const Readable_String<T> &in);
String_Loose(const std::basic_string<T> &in); String_Loose(const std::basic_string<T> &in);
String_Loose(const T *in, size_t len); String_Loose(const T *in, size_t len);
String_Loose(const T *in); String_Loose(const T *in);
String_Loose(const Jupiter::DataBuffer &in); String_Loose(const Jupiter::DataBuffer &in);
static const Jupiter::String_Loose<T> empty; /** Empty instantation of String_Loose */ /** Concatenation Constructor */
static const size_t start_size = 8; /** Starting size for loose Strings. */ String_Loose(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
/** Addition Operators */
inline String_Loose<T> operator+(const String_Loose<T> &rhs) const;
inline String_Loose<T> operator+(const Readable_String<T> &rhs) const;
/** Assignment Operators */ /** Assignment Operators */
inline String_Loose<T> &operator=(const String_Loose<T> &right) { this->set(right); return *this; }; inline String_Loose<T> &operator=(const String_Loose<T> &right) { this->set(right); return *this; };
@ -441,6 +457,9 @@ namespace Jupiter
inline String_Loose<T> &operator=(const T *right) { this->set(right); return *this; }; inline String_Loose<T> &operator=(const T *right) { this->set(right); return *this; };
inline String_Loose<T> &operator=(const T right) { this->set(right); return *this; }; inline String_Loose<T> &operator=(const T right) { this->set(right); return *this; };
static const Jupiter::String_Loose<T> empty; /** Empty instantiation of String_Loose */
static const size_t start_size = 8; /** Starting size for loose Strings. */
protected: protected:
/** /**
@ -467,6 +486,13 @@ namespace Jupiter
size_t strSize; /** Size of underlying string buffer */ size_t strSize; /** Size of underlying string buffer */
}; };
#if !defined JUPITER_STRING_STRICT_OPERATOR_PLUS
#if !defined DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
/** String_Loose<T> Addition Operator */
template<typename T> static inline Jupiter::String_Loose<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
#endif // DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS
/** Definition of a Loose String. */ /** Definition of a Loose String. */
typedef String_Loose<char> StringL; typedef String_Loose<char> StringL;

96
Jupiter/String_Imp.h

@ -105,6 +105,35 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Dat
{ {
} }
template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) : String_Strict<T>(lhs.size() + rhs.size())
{
const T *itr;
const T *end;
if (lhs.isNotEmpty())
{
itr = lhs.ptr();
end = itr + lhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
if (rhs.isNotEmpty())
{
itr = rhs.ptr();
end = itr + rhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
Jupiter::String_Type<T>::length = Jupiter::String_Type<T>::str - Jupiter::Shift_String_Type<T>::base;
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
// vformat() // vformat()
template<> size_t inline Jupiter::String_Strict<char>::vformat(const char *format, va_list args) template<> size_t inline Jupiter::String_Strict<char>::vformat(const char *format, va_list args)
@ -286,6 +315,24 @@ template<typename T> Jupiter::String_Strict<T> Jupiter::String_Strict<T>::gotoTo
return Jupiter::Readable_String<T>::gotoToken<Jupiter::String_Strict>(in, pos, token); return Jupiter::Readable_String<T>::gotoToken<Jupiter::String_Strict>(in, pos, token);
} }
// Operators
template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>::operator+(const Jupiter::String_Strict<T> &rhs) const
{
return Jupiter::String_Strict<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
}
template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>::operator+(const Jupiter::Readable_String<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if defined JUPITER_STRING_STRICT_OPERATOR_PLUS
template<typename T> static inline Jupiter::String_Strict<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs)
{
return Jupiter::String_Strict<T>(lhs, rhs);
}
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS
template<typename T> const Jupiter::String_Strict<T> Jupiter::String_Strict<T>::empty = Jupiter::String_Strict<T>(); template<typename T> const Jupiter::String_Strict<T> Jupiter::String_Strict<T>::empty = Jupiter::String_Strict<T>();
// Jupiter::DataBuffer specialization // Jupiter::DataBuffer specialization
@ -385,6 +432,35 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::DataB
{ {
} }
template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) : String_Loose<T>(lhs.size() + rhs.size())
{
const T *itr;
const T *end;
if (lhs.isNotEmpty())
{
itr = lhs.ptr();
end = itr + lhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
if (rhs.isNotEmpty())
{
itr = rhs.ptr();
end = itr + rhs.size();
*Jupiter::String_Type<T>::str = *itr;
while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr;
++Jupiter::String_Type<T>::str;
}
Jupiter::String_Type<T>::length = Jupiter::String_Type<T>::str - Jupiter::Shift_String_Type<T>::base;
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
template<typename T> bool Jupiter::String_Loose<T>::setBufferSize(size_t len) template<typename T> bool Jupiter::String_Loose<T>::setBufferSize(size_t len)
{ {
return Jupiter::Shift_String_Type<T>::setBufferSize(Jupiter::String_Loose<T>::strSize = getPowerTwo32(len)); return Jupiter::Shift_String_Type<T>::setBufferSize(Jupiter::String_Loose<T>::strSize = getPowerTwo32(len));
@ -576,6 +652,26 @@ template<typename T> Jupiter::String_Loose<T> Jupiter::String_Loose<T>::gotoToke
return Jupiter::Readable_String<T>::gotoToken<Jupiter::String_Loose>(in, pos, token); return Jupiter::Readable_String<T>::gotoToken<Jupiter::String_Loose>(in, pos, token);
} }
// Operators
template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::operator+(const Jupiter::String_Loose<T> &rhs) const
{
return Jupiter::String_Loose<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
}
template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::operator+(const Jupiter::Readable_String<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if !defined JUPITER_STRING_STRICT_OPERATOR_PLUS
#if !defined DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
template<typename T> static inline Jupiter::String_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs)
{
return Jupiter::String_Loose<T>(lhs, rhs);
}
#endif // DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS
template<typename T> const Jupiter::String_Loose<T> Jupiter::String_Loose<T>::empty = Jupiter::String_Loose<T>(); template<typename T> const Jupiter::String_Loose<T> Jupiter::String_Loose<T>::empty = Jupiter::String_Loose<T>();
// Jupiter::DataBuffer specialization // Jupiter::DataBuffer specialization

5
Jupiter/String_Type.h

@ -116,6 +116,11 @@ namespace Jupiter
*/ */
virtual void remove(size_t index, size_t length); virtual void remove(size_t index, size_t length);
/**
* @brief Removes all elements from the string.
*/
virtual void erase();
/** /**
* @brief Processes escape sequences in a string. * @brief Processes escape sequences in a string.
* Source reference: http://en.cppreference.com/w/cpp/language/escape * Source reference: http://en.cppreference.com/w/cpp/language/escape

7
Jupiter/String_Type_Imp.h

@ -152,6 +152,13 @@ template<typename T> void Jupiter::String_Type<T>::remove(size_t index, size_t l
} }
} }
// erase
template<typename T> void Jupiter::String_Type<T>::erase()
{
Jupiter::String_Type<T>::length = 0;
}
// processEscapeSequences // processEscapeSequences
template<typename T> void Jupiter::String_Type<T>::processEscapeSequences() template<typename T> void Jupiter::String_Type<T>::processEscapeSequences()

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save