Browse Source

Added pointer + size constructors

release/0.19
JustinAJ 11 years ago
parent
commit
1ac0d00ab3
  1. 2
      Jupiter/CString.h
  2. 37
      Jupiter/CString_Imp.h
  3. 2
      Jupiter/String.h
  4. 36
      Jupiter/String_Imp.h

2
Jupiter/CString.h

@ -226,6 +226,7 @@ namespace Jupiter
CString_Type(const CString_Type<T> &in) : CString_Type((Readable_String<T> &)in) {}
CString_Type(const Readable_String<T> &in);
CString_Type(const std::basic_string<T> &in);
CString_Type(const T *in, size_t len);
CString_Type(const T *in);
protected:
@ -378,6 +379,7 @@ namespace Jupiter
CString_Loose(const CString_Loose &in);
CString_Loose(const Readable_String<T> &in);
CString_Loose(const std::basic_string<T> &in);
CString_Loose(const T *in, size_t len);
CString_Loose(const T *in);
static const Jupiter::CString_Loose<T> empty; /** Empty instantation of CString_Loose */

37
Jupiter/CString_Imp.h

@ -59,22 +59,21 @@ template<typename T> Jupiter::CString_Type<T>::CString_Type(Jupiter::CString_Typ
{
}
template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &in) : Jupiter::CString_Type<T>::CString_Type(in.size())
template<typename T> Jupiter::CString_Type<T>::CString_Type(const Jupiter::Readable_String<T> &in) : Jupiter::CString_Type<T>::CString_Type(in.ptr(), in.size())
{
while (Jupiter::String_Type<T>::length < in.size() && in.get(Jupiter::String_Type<T>::length) != 0)
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::length++;
}
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = 0;
}
template<typename T> Jupiter::CString_Type<T>::CString_Type(const std::basic_string<T> &in) : Jupiter::CString_Type<T>::CString_Type(in.size())
template<typename T> Jupiter::CString_Type<T>::CString_Type(const std::basic_string<T> &in) : Jupiter::CString_Type<T>::CString_Type(in.data(), in.size())
{
while (Jupiter::String_Type<T>::length < in.size() && in.at(Jupiter::String_Type<T>::length) != 0)
}
template<typename T> Jupiter::CString_Type<T>::CString_Type(const T *in, size_t len) : Jupiter::CString_Type<T>::CString_Type(len)
{
while (Jupiter::String_Type<T>::length != len)
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.at(Jupiter::String_Type<T>::length);
if ((Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in) == 0) return;
Jupiter::String_Type<T>::length++;
in++;
}
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = 0;
}
@ -408,21 +407,19 @@ template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::CSt
Jupiter::String_Type<T>::length = in.length;
}
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &in) : Jupiter::CString_Loose<T>::CString_Loose(in.size())
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const Jupiter::Readable_String<T> &in) : Jupiter::CString_Loose<T>::CString_Loose(in.ptr(), in.size())
{
while (Jupiter::String_Type<T>::length < in.size() && in.get(Jupiter::String_Type<T>::length) != 0)
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::length++;
}
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = 0;
}
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const std::basic_string<T> &in) : Jupiter::CString_Loose<T>::CString_Loose(in.size())
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const std::basic_string<T> &in) : Jupiter::CString_Loose<T>::CString_Loose(in.data(), in.size())
{
while (Jupiter::String_Type<T>::length < in.size() && in.at(Jupiter::String_Type<T>::length) != 0)
}
template<typename T> Jupiter::CString_Loose<T>::CString_Loose(const T *in, size_t len) : Jupiter::CString_Loose<T>::CString_Loose(len)
{
while (Jupiter::String_Type<T>::length != len)
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.at(Jupiter::String_Type<T>::length);
if ((Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in) == 0) return;
Jupiter::String_Type<T>::length++;
}
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = 0;

2
Jupiter/String.h

@ -189,6 +189,7 @@ namespace Jupiter
String_Strict(const String_Strict<T> &in) : String_Strict((Readable_String<T> &)in) {}
String_Strict(const Readable_String<T> &in);
String_Strict(const std::basic_string<T> &in);
String_Strict(const T *in, size_t len);
String_Strict(const T *in);
protected:
@ -349,6 +350,7 @@ namespace Jupiter
String_Loose(const String_Loose &in);
String_Loose(const Readable_String<T> &in);
String_Loose(const std::basic_string<T> &in);
String_Loose(const T *in, size_t len);
String_Loose(const T *in);
static const Jupiter::String_Loose<T> empty; /** Empty instantation of String_Loose */

36
Jupiter/String_Imp.h

@ -57,21 +57,21 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(Jupiter::String_St
{
}
template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &in) : Jupiter::String_Strict<T>::String_Strict(in.size())
template<typename T> Jupiter::String_Strict<T>::String_Strict(const Jupiter::Readable_String<T> &in) : Jupiter::String_Strict<T>::String_Strict(in.ptr(), in.size())
{
}
template<typename T> Jupiter::String_Strict<T>::String_Strict(const std::basic_string<T> &in) : Jupiter::String_Strict<T>::String_Strict(in.data(), in.size())
{
while (Jupiter::String_Type<T>::length < in.size())
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::length++;
}
}
template<typename T> Jupiter::String_Strict<T>::String_Strict(const std::basic_string<T> &in) : Jupiter::String_Strict<T>::String_Strict(in.size())
template<typename T> Jupiter::String_Strict<T>::String_Strict(const T *in, size_t len) : Jupiter::String_Strict<T>::String_Strict(len)
{
while (Jupiter::String_Type<T>::length < in.size())
while (Jupiter::String_Type<T>::length != len)
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.at(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in;
Jupiter::String_Type<T>::length++;
in++;
}
}
@ -275,21 +275,21 @@ template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Strin
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length);
}
template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &in) : Jupiter::String_Loose<T>::String_Loose(in.size())
template<typename T> Jupiter::String_Loose<T>::String_Loose(const Jupiter::Readable_String<T> &in) : Jupiter::String_Loose<T>::String_Loose(in.ptr(), in.size())
{
}
template<typename T> Jupiter::String_Loose<T>::String_Loose(const std::basic_string<T> &in) : Jupiter::String_Loose<T>::String_Loose(in.data(), in.size())
{
while (Jupiter::String_Type<T>::length < in.size())
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.get(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::length++;
}
}
template<typename T> Jupiter::String_Loose<T>::String_Loose(const std::basic_string<T> &in) : Jupiter::String_Loose<T>::String_Loose(in.size())
template<typename T> Jupiter::String_Loose<T>::String_Loose(const T *in, size_t len) : Jupiter::String_Loose<T>::String_Loose(len)
{
while (Jupiter::String_Type<T>::length < in.size())
while (Jupiter::String_Type<T>::length != len)
{
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = in.at(Jupiter::String_Type<T>::length);
Jupiter::String_Type<T>::str[Jupiter::String_Type<T>::length] = *in;
Jupiter::String_Type<T>::length++;
in++;
}
}

Loading…
Cancel
Save