|
|
@ -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 *end; |
|
|
@ -120,10 +120,43 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Rea |
|
|
|
++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(); |
|
|
|
end = itr + rhs.size(); |
|
|
|
itr = rhs; |
|
|
|
end = itr + rhs_size; |
|
|
|
*Jupiter::String_Type<T>::str = *itr; |
|
|
|
while (++itr != end) |
|
|
|
*++Jupiter::String_Type<T>::str = *itr; |
|
|
@ -349,6 +382,11 @@ template<typename T> typename Jupiter::Readable_String<T>::TokenizeResult<Jupite |
|
|
|
|
|
|
|
// 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 |
|
|
|
{ |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
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 |
|
|
|
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) |
|
|
|
{ |
|
|
|
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
|
|
|
|
|
|
|
|
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) |
|
|
|
{ |
|
|
|
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in; |
|
|
|
Jupiter::String_Type<T>::length++; |
|
|
|
in++; |
|
|
|
++in, ++Jupiter::String_Type<T>::length; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -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 *end; |
|
|
@ -480,10 +575,10 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Reada |
|
|
|
++Jupiter::String_Type<T>::str; |
|
|
|
} |
|
|
|
|
|
|
|
if (rhs.isNotEmpty()) |
|
|
|
if (rhs_size != 0) |
|
|
|
{ |
|
|
|
itr = rhs.ptr(); |
|
|
|
end = itr + rhs.size(); |
|
|
|
itr = rhs; |
|
|
|
end = itr + rhs_size; |
|
|
|
*Jupiter::String_Type<T>::str = *itr; |
|
|
|
while (++itr != end) |
|
|
|
*++Jupiter::String_Type<T>::str = *itr; |
|
|
@ -692,6 +787,11 @@ template<typename T> Jupiter::String_Loose<T> Jupiter::String_Loose<T>::gotoToke |
|
|
|
|
|
|
|
// 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 |
|
|
|
{ |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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 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) |
|
|
|
{ |
|
|
|
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 // JUPITER_STRING_STRICT_OPERATOR_PLUS
|
|
|
|
|
|
|
|