Browse Source

Added additional operator+ functions to String classes.

release/0.19
JustinAJ 9 years ago
parent
commit
4d20ab6430
  1. 18
      Jupiter/CString.h
  2. 144
      Jupiter/CString_Imp.h
  3. 27
      Jupiter/String.h
  4. 145
      Jupiter/String_Imp.h
  5. BIN
      Release/Jupiter.lib

18
Jupiter/CString.h

@ -267,12 +267,19 @@ 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 */ /** Concatenation Constructors */
CString_Type(const Readable_String<T> &lhs, const T &rhs);
CString_Type(const Readable_String<T> &lhs, const Readable_String<T> &rhs); CString_Type(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
CString_Type(const Readable_String<T> &lhs, const std::basic_string<T> &rhs);
CString_Type(const Readable_String<T> &lhs, const T *rhs);
CString_Type(const Readable_String<T> &lhs, const T *rhs, size_t rhs_size);
/** Addition Operators */ /** Addition Operators */
inline CString_Type<T> operator+(const T &rhs) const;
inline CString_Type<T> operator+(const CString_Type<T> &rhs) const; inline CString_Type<T> operator+(const CString_Type<T> &rhs) const;
inline CString_Type<T> operator+(const Readable_String<T> &rhs) const; inline CString_Type<T> operator+(const Readable_String<T> &rhs) const;
inline CString_Type<T> operator+(const std::basic_string<T> &rhs) const;
inline CString_Type<T> operator+(const T *rhs) const;
/** Assignment Operators */ /** Assignment Operators */
inline CString_Type<T> &operator=(const CString_Type<T> &right) { this->set(right); return *this; }; inline CString_Type<T> &operator=(const CString_Type<T> &right) { this->set(right); return *this; };
@ -470,12 +477,19 @@ namespace Jupiter
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);
/** Concatenation Constructor */ /** Concatenation Constructors */
CString_Loose(const Readable_String<T> &lhs, const T &rhs);
CString_Loose(const Readable_String<T> &lhs, const Readable_String<T> &rhs); CString_Loose(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
CString_Loose(const Readable_String<T> &lhs, const std::basic_string<T> &rhs);
CString_Loose(const Readable_String<T> &lhs, const T *rhs);
CString_Loose(const Readable_String<T> &lhs, const T *rhs, size_t rhs_size);
/** Addition Operators */ /** Addition Operators */
inline CString_Loose<T> operator+(const T &rhs) const;
inline CString_Loose<T> operator+(const CString_Loose<T> &rhs) const; inline CString_Loose<T> operator+(const CString_Loose<T> &rhs) const;
inline CString_Loose<T> operator+(const Readable_String<T> &rhs) const; inline CString_Loose<T> operator+(const Readable_String<T> &rhs) const;
inline CString_Loose<T> operator+(const std::basic_string<T> &rhs) const;
inline CString_Loose<T> operator+(const 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; };

144
Jupiter/CString_Imp.h

@ -108,7 +108,7 @@ 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()) template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &lhs, const T &rhs) : CString_Type<T>(lhs.size() + 1)
{ {
const T *itr; const T *itr;
const T *end; const T *end;
@ -123,10 +123,44 @@ template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Reada
++Jupiter::String_Type<T>::str; ++Jupiter::String_Type<T>::str;
} }
if (rhs.isNotEmpty()) *Jupiter::String_Type<T>::str = rhs;
*++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> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) : CString_Type<T>(lhs, rhs.ptr(), rhs.size())
{
}
template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs) : CString_Type<T>(lhs, rhs.data(), rhs.size())
{
}
template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &lhs, const T *rhs) : CString_Type<T>(lhs, rhs, Jupiter::strlen<T>(rhs))
{
}
template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &lhs, const T *rhs, size_t rhs_size) : 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_size != 0)
{ {
itr = rhs.ptr(); itr = rhs;
end = itr + rhs.size(); end = itr + rhs_size;
*Jupiter::String_Type<T>::str = *itr; *Jupiter::String_Type<T>::str = *itr;
while (++itr != end) while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr; *++Jupiter::String_Type<T>::str = *itr;
@ -443,6 +477,11 @@ template<typename T> size_t Jupiter::CString_Type<T>::concat(const T &in)
// Operators // Operators
template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::operator+(const T &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::operator+(const Jupiter::CString_Type<T> &rhs) const 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)); return Jupiter::CString_Type<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
@ -453,11 +492,36 @@ template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::o
return Jupiter::operator+(*this, rhs); return Jupiter::operator+(*this, rhs);
} }
template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::operator+(const std::basic_string<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::CString_Type<T> Jupiter::CString_Type<T>::operator+(const T *rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if defined JUPITER_CSTRING_TYPE_OPERATOR_PLUS #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 T &rhs)
{
return Jupiter::CString_Type<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::CString_Type<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) 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); return Jupiter::CString_Type<T>(lhs, rhs);
} }
template<typename T> static inline Jupiter::CString_Type<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs)
{
return Jupiter::CString_Type<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::CString_Type<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const T *rhs)
{
return Jupiter::CString_Type<T>(lhs, rhs);
}
#endif // JUPITER_CSTRING_TYPE_OPERATOR_PLUS #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>();
@ -554,7 +618,7 @@ 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()) template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &lhs, const T &rhs) : CString_Loose<T>(lhs.size() + 1)
{ {
const T *itr; const T *itr;
const T *end; const T *end;
@ -569,10 +633,44 @@ template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Rea
++Jupiter::String_Type<T>::str; ++Jupiter::String_Type<T>::str;
} }
if (rhs.isNotEmpty()) *Jupiter::String_Type<T>::str = rhs;
*++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> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) : CString_Loose<T>(lhs, rhs.ptr(), rhs.size())
{
}
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs) : CString_Loose<T>(lhs, rhs.data(), rhs.size())
{
}
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &lhs, const T *rhs) : CString_Loose<T>(lhs, rhs, Jupiter::strlen<T>(rhs))
{
}
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &lhs, const T *rhs, size_t rhs_size) : 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_size != 0)
{ {
itr = rhs.ptr(); itr = rhs;
end = itr + rhs.size(); end = itr + rhs_size;
*Jupiter::String_Type<T>::str = *itr; *Jupiter::String_Type<T>::str = *itr;
while (++itr != end) while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr; *++Jupiter::String_Type<T>::str = *itr;
@ -734,6 +832,11 @@ template<typename T> typename Jupiter::Readable_String<T>::TokenizeResult<Jupite
// Operators // Operators
template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::operator+(const T &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::operator+(const Jupiter::CString_Loose<T> &rhs) const 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)); return Jupiter::CString_Loose<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
@ -744,11 +847,36 @@ template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>:
return Jupiter::operator+(*this, rhs); return Jupiter::operator+(*this, rhs);
} }
template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::operator+(const std::basic_string<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::CString_Loose<T> Jupiter::CString_Loose<T>::operator+(const T *rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if defined JUPITER_CSTRING_LOOSE_OPERATOR_PLUS #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 T &rhs)
{
return Jupiter::CString_Loose<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::CString_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) 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); return Jupiter::CString_Loose<T>(lhs, rhs);
} }
template<typename T> static inline Jupiter::CString_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs)
{
return Jupiter::CString_Loose<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::CString_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const T *rhs)
{
return Jupiter::CString_Loose<T>(lhs, rhs);
}
#endif // JUPITER_CSTRING_LOOSE_OPERATOR_PLUS #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>();

27
Jupiter/String.h

@ -246,12 +246,19 @@ 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 */ /** Concatenation Constructors */
String_Strict(const Readable_String<T> &lhs, const T &rhs);
String_Strict(const Readable_String<T> &lhs, const Readable_String<T> &rhs); String_Strict(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
String_Strict(const Readable_String<T> &lhs, const std::basic_string<T> &rhs);
String_Strict(const Readable_String<T> &lhs, const T *rhs);
String_Strict(const Readable_String<T> &lhs, const T *rhs, size_t rhs_size);
/** Addition Operators */ /** Addition Operators */
inline String_Strict<T> operator+(const T &rhs) const;
inline String_Strict<T> operator+(const String_Strict<T> &rhs) const; inline String_Strict<T> operator+(const String_Strict<T> &rhs) const;
inline String_Strict<T> operator+(const Readable_String<T> &rhs) const; inline String_Strict<T> operator+(const Readable_String<T> &rhs) const;
inline String_Strict<T> operator+(const std::basic_string<T> &rhs) const;
inline String_Strict<T> operator+(const T *rhs) const;
/** Assignment Operators */ /** Assignment Operators */
inline String_Strict<T> &operator=(const String_Strict<T> &right) { this->set(right); return *this; }; inline String_Strict<T> &operator=(const String_Strict<T> &right) { this->set(right); return *this; };
@ -269,8 +276,12 @@ namespace Jupiter
}; };
#if defined JUPITER_STRING_STRICT_OPERATOR_PLUS #if defined JUPITER_STRING_STRICT_OPERATOR_PLUS
/** String_Loose<T> Addition Operator */ /** String_Loose<T> Addition Operators */
template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const T &rhs);
template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs); template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs);
template<typename T> static inline Jupiter::String_Strict<T> operator+(const Jupiter::Readable_String<T> &lhs, const T *rhs);
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS #endif // JUPITER_STRING_STRICT_OPERATOR_PLUS
/** /**
@ -512,12 +523,19 @@ namespace Jupiter
String_Loose(const T *in); String_Loose(const T *in);
String_Loose(const Jupiter::DataBuffer &in); String_Loose(const Jupiter::DataBuffer &in);
/** Concatenation Constructor */ /** Concatenation Constructors */
String_Loose(const Readable_String<T> &lhs, const T &rhs);
String_Loose(const Readable_String<T> &lhs, const Readable_String<T> &rhs); String_Loose(const Readable_String<T> &lhs, const Readable_String<T> &rhs);
String_Loose(const Readable_String<T> &lhs, const std::basic_string<T> &rhs);
String_Loose(const Readable_String<T> &lhs, const T *rhs);
String_Loose(const Readable_String<T> &lhs, const T *rhs, size_t rhs_size);
/** Addition Operators */ /** Addition Operators */
inline String_Loose<T> operator+(const T &rhs) const;
inline String_Loose<T> operator+(const String_Loose<T> &rhs) const; inline String_Loose<T> operator+(const String_Loose<T> &rhs) const;
inline String_Loose<T> operator+(const Readable_String<T> &rhs) const; inline String_Loose<T> operator+(const Readable_String<T> &rhs) const;
inline String_Loose<T> operator+(const std::basic_string<T> &rhs) const;
inline String_Loose<T> operator+(const 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; };
@ -539,7 +557,10 @@ namespace Jupiter
#if !defined JUPITER_STRING_STRICT_OPERATOR_PLUS #if !defined JUPITER_STRING_STRICT_OPERATOR_PLUS
#if !defined DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS #if !defined DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
/** String_Loose<T> Addition Operator */ /** String_Loose<T> Addition Operator */
template<typename T> static inline Jupiter::String_Loose<T> operator+(const Jupiter::Readable_String<T> &lhs, const T &rhs);
template<typename T> static inline Jupiter::String_Loose<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs); template<typename T> static inline Jupiter::String_Loose<T> operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs);
template<typename T> static inline Jupiter::String_Loose<T> operator+(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs);
template<typename T> static inline Jupiter::String_Loose<T> operator+(const Jupiter::Readable_String<T> &lhs, const T *rhs);
#endif // DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS #endif // DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS #endif // JUPITER_STRING_STRICT_OPERATOR_PLUS

145
Jupiter/String_Imp.h

@ -105,7 +105,7 @@ 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()) template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &lhs, const T &rhs) : String_Strict<T>(lhs.size() + 1)
{ {
const T *itr; const T *itr;
const T *end; const T *end;
@ -120,10 +120,43 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Rea
++Jupiter::String_Type<T>::str; ++Jupiter::String_Type<T>::str;
} }
if (rhs.isNotEmpty()) *Jupiter::String_Type<T>::str = rhs;
Jupiter::String_Type<T>::length = Jupiter::String_Type<T>::str - Jupiter::Shift_String_Type<T>::base + 1;
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
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, rhs.ptr(), rhs.size())
{
}
template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs) : String_Strict<T>(lhs, rhs.data(), rhs.size())
{
}
template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &lhs, const T *rhs) : String_Strict<T>(lhs, rhs, Jupiter::strlen<T>(rhs))
{
}
template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &lhs, const T *rhs, size_t rhs_size) : 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_size != 0)
{ {
itr = rhs.ptr(); itr = rhs;
end = itr + rhs.size(); end = itr + rhs_size;
*Jupiter::String_Type<T>::str = *itr; *Jupiter::String_Type<T>::str = *itr;
while (++itr != end) while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr; *++Jupiter::String_Type<T>::str = *itr;
@ -349,6 +382,11 @@ template<typename T> typename Jupiter::Readable_String<T>::TokenizeResult<Jupite
// Operators // Operators
template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>::operator+(const T &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>::operator+(const Jupiter::String_Strict<T> &rhs) const 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)); return Jupiter::String_Strict<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
@ -359,11 +397,36 @@ template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>:
return Jupiter::operator+(*this, rhs); return Jupiter::operator+(*this, rhs);
} }
template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>::operator+(const std::basic_string<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::String_Strict<T> Jupiter::String_Strict<T>::operator+(const T *rhs) const
{
return Jupiter::operator+(*this, rhs);
}
#if defined JUPITER_STRING_STRICT_OPERATOR_PLUS #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 T &rhs)
{
return Jupiter::String_Strict<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::String_Strict<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) 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); return Jupiter::String_Strict<T>(lhs, rhs);
} }
template<typename T> static inline Jupiter::String_Strict<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs)
{
return Jupiter::String_Strict<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::String_Strict<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const T *rhs)
{
return Jupiter::String_Strict<T>(lhs, rhs);
}
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS #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>();
@ -434,8 +497,7 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const T *in, size_t
while (Jupiter::String_Type<T>::length != len) while (Jupiter::String_Type<T>::length != len)
{ {
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in; Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in;
Jupiter::String_Type<T>::length++; ++in, ++Jupiter::String_Type<T>::length;
in++;
} }
} }
@ -465,7 +527,40 @@ 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()) template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &lhs, const T &rhs) : String_Loose<T>(lhs.size() + 1)
{
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;
}
*Jupiter::String_Type<T>::str = rhs;
Jupiter::String_Type<T>::length = Jupiter::String_Type<T>::str - Jupiter::Shift_String_Type<T>::base + 1;
Jupiter::String_Type<T>::str = Jupiter::Shift_String_Type<T>::base;
}
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, rhs.ptr(), rhs.size())
{
}
template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs) : String_Loose<T>(lhs, rhs.data(), rhs.size())
{
}
template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &lhs, const T *rhs) : String_Loose<T>(lhs, rhs, Jupiter::strlen<T>(rhs))
{
}
template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &lhs, const T *rhs, size_t rhs_size) : String_Loose<T>(lhs.size() + rhs_size)
{ {
const T *itr; const T *itr;
const T *end; const T *end;
@ -480,10 +575,10 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Reada
++Jupiter::String_Type<T>::str; ++Jupiter::String_Type<T>::str;
} }
if (rhs.isNotEmpty()) if (rhs_size != 0)
{ {
itr = rhs.ptr(); itr = rhs;
end = itr + rhs.size(); end = itr + rhs_size;
*Jupiter::String_Type<T>::str = *itr; *Jupiter::String_Type<T>::str = *itr;
while (++itr != end) while (++itr != end)
*++Jupiter::String_Type<T>::str = *itr; *++Jupiter::String_Type<T>::str = *itr;
@ -692,6 +787,11 @@ template<typename T> Jupiter::String_Loose<T> Jupiter::String_Loose<T>::gotoToke
// Operators // Operators
template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::operator+(const T &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::operator+(const Jupiter::String_Loose<T> &rhs) const 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)); return Jupiter::String_Loose<T>::operator+(reinterpret_cast<const Jupiter::Readable_String<T> &>(rhs));
@ -702,6 +802,16 @@ template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::o
return Jupiter::operator+(*this, rhs); return Jupiter::operator+(*this, rhs);
} }
template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::operator+(const std::basic_string<T> &rhs) const
{
return Jupiter::operator+(*this, rhs);
}
template<typename T> inline Jupiter::String_Loose<T> Jupiter::String_Loose<T>::operator+(const T *rhs) const
{
return Jupiter::operator+(*this, rhs);
}
// tokenize // tokenize
template<typename T> typename Jupiter::Readable_String<T>::TokenizeResult<Jupiter::String_Loose> Jupiter::String_Loose<T>::tokenize(const T &separator) template<typename T> typename Jupiter::Readable_String<T>::TokenizeResult<Jupiter::String_Loose> Jupiter::String_Loose<T>::tokenize(const T &separator)
@ -736,10 +846,25 @@ template<typename T> typename Jupiter::Readable_String<T>::TokenizeResult<Jupite
#if !defined JUPITER_STRING_STRICT_OPERATOR_PLUS #if !defined JUPITER_STRING_STRICT_OPERATOR_PLUS
#if !defined DISABLE_DEFAULT_JUPITER_STRING_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 T &rhs)
{
return Jupiter::String_Loose<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::String_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const Jupiter::Readable_String<T> &rhs) 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); return Jupiter::String_Loose<T>(lhs, rhs);
} }
template<typename T> static inline Jupiter::String_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const std::basic_string<T> &rhs)
{
return Jupiter::String_Loose<T>(lhs, rhs);
}
template<typename T> static inline Jupiter::String_Loose<T> Jupiter::operator+(const Jupiter::Readable_String<T> &lhs, const T *rhs)
{
return Jupiter::String_Loose<T>(lhs, rhs);
}
#endif // DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS #endif // DISABLE_DEFAULT_JUPITER_STRING_OPERATOR_PLUS
#endif // JUPITER_STRING_STRICT_OPERATOR_PLUS #endif // JUPITER_STRING_STRICT_OPERATOR_PLUS

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save