Browse Source

Removed c_str() from String_Type, String_Loose, and String_Strict

release/0.19
JustinAJ 11 years ago
parent
commit
b400941629
  1. 14
      Jupiter/String.h
  2. 26
      Jupiter/String_Imp.h
  3. 9
      Jupiter/String_Type.h
  4. 20
      Jupiter/String_Type_Imp.h
  5. BIN
      Release/Jupiter.lib

14
Jupiter/String.h

@ -39,13 +39,6 @@ namespace Jupiter
{ {
public: public:
/**
* @brief Returns a C-Style string representation of the String.
*
* @return C-Style string representation of the String.
*/
const T *c_str() const;
/** /**
* @brief Sets the String's contents based on the format string and input variables. * @brief Sets the String's contents based on the format string and input variables.
* Note: Format specifiers similar to printf. Returns 0 for any type other than char and wchar_t. * Note: Format specifiers similar to printf. Returns 0 for any type other than char and wchar_t.
@ -208,13 +201,6 @@ namespace Jupiter
{ {
public: public:
/**
* @brief Returns a C-Style string representation of the String.
*
* @return C-Style string representation of the String.
*/
const T *c_str() const;
/** /**
* @brief Sets the String's contents based on the format string and input variables. * @brief Sets the String's contents based on the format string and input variables.
* Note: Format specifiers similar to printf. Returns 0 for any type other than char and wchar_t. * Note: Format specifiers similar to printf. Returns 0 for any type other than char and wchar_t.

26
Jupiter/String_Imp.h

@ -85,19 +85,6 @@ template<typename T> Jupiter::String_Strict<T>::String_Strict(const T *in)
for (size_t index = 0; index != Jupiter::String_Type<T>::length; index++, in++) Jupiter::String_Type<T>::str[index] = *in; for (size_t index = 0; index != Jupiter::String_Type<T>::length; index++, in++) Jupiter::String_Type<T>::str[index] = *in;
} }
template<typename T> const T *Jupiter::String_Strict<T>::c_str() const
{
static T *buff = new T[1];
delete[] buff;
buff = new T[Jupiter::String_Type<T>::length + 1];
size_t index;
for (index = 0; index < Jupiter::String_Type<T>::length && Jupiter::String_Type<T>::str[index] != 0; index++) buff[index] = Jupiter::String_Type<T>::str[index];
buff[index] = 0;
return buff;
}
// 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)
@ -325,19 +312,6 @@ template<typename T> bool Jupiter::String_Loose<T>::setBufferSizeNoCopy(size_t l
return Jupiter::Shift_String_Type<T>::setBufferSizeNoCopy(Jupiter::String_Loose<T>::strSize = getPowerTwo32(len)); return Jupiter::Shift_String_Type<T>::setBufferSizeNoCopy(Jupiter::String_Loose<T>::strSize = getPowerTwo32(len));
} }
template<typename T> const T *Jupiter::String_Loose<T>::c_str() const
{
static T *buff = new T[1];
delete[] buff;
buff = new T[Jupiter::String_Type<T>::length + 1];
size_t index;
for (index = 0; index < Jupiter::String_Type<T>::length && Jupiter::String_Type<T>::str[index] != 0; index++) buff[index] = Jupiter::String_Type<T>::str[index];
buff[index] = 0;
return buff;
}
// vformat() // vformat()
template<> size_t inline Jupiter::String_Loose<char>::vformat(const char *format, va_list args) template<> size_t inline Jupiter::String_Loose<char>::vformat(const char *format, va_list args)

9
Jupiter/String_Type.h

@ -62,13 +62,6 @@ namespace Jupiter
*/ */
const T *ptr() const; const T *ptr() const;
/**
* @brief Returns a C-Style string version of the String.
*
* @return C-Style string representation of the String.
*/
virtual const T *c_str() const = 0;
/** /**
* @brief Sets the String's contents based on the format string and input variables. * @brief Sets the String's contents based on the format string and input variables.
* Note: Format specifiers similar to printf. Returns 0 for any type other than char and wchar_t. * Note: Format specifiers similar to printf. Returns 0 for any type other than char and wchar_t.
@ -77,7 +70,6 @@ namespace Jupiter
* @param ... Inputs to match the format specifiers. * @param ... Inputs to match the format specifiers.
* @return Number of characters written. * @return Number of characters written.
*/ */
size_t format(const String_Type<T> &format, ...);
size_t format(const std::basic_string<T> &format, ...); size_t format(const std::basic_string<T> &format, ...);
size_t format(const T *format, ...); size_t format(const T *format, ...);
virtual size_t vformat(const T *format, va_list args) = 0; virtual size_t vformat(const T *format, va_list args) = 0;
@ -90,7 +82,6 @@ namespace Jupiter
* @param ... Inputs to match the format specifiers. * @param ... Inputs to match the format specifiers.
* @return Number of characters written. * @return Number of characters written.
*/ */
size_t aformat(const String_Type<T> &format, ...);
size_t aformat(const std::basic_string<T> &format, ...); size_t aformat(const std::basic_string<T> &format, ...);
size_t aformat(const T *format, ...); size_t aformat(const T *format, ...);
virtual size_t avformat(const T *format, va_list args) = 0; virtual size_t avformat(const T *format, va_list args) = 0;

20
Jupiter/String_Type_Imp.h

@ -57,16 +57,6 @@ template<typename T> const T *Jupiter::String_Type<T>::ptr() const
// format forwards // format forwards
template<typename T> size_t Jupiter::String_Type<T>::format(const String_Type<T> &format, ...)
{
size_t r;
va_list args;
va_start(args, format);
r = this->vformat(format.c_str(), args);
va_end(args);
return r;
}
template<typename T> size_t Jupiter::String_Type<T>::format(const std::basic_string<T> &format, ...) template<typename T> size_t Jupiter::String_Type<T>::format(const std::basic_string<T> &format, ...)
{ {
size_t r; size_t r;
@ -89,16 +79,6 @@ template<typename T> size_t Jupiter::String_Type<T>::format(const T *format, ...
// aformat forwards // aformat forwards
template<typename T> size_t Jupiter::String_Type<T>::aformat(const String_Type<T> &format, ...)
{
size_t r;
va_list args;
va_start(args, format);
r = this->avformat(format.c_str(), args);
va_end(args);
return r;
}
template<typename T> size_t Jupiter::String_Type<T>::aformat(const std::basic_string<T> &format, ...) template<typename T> size_t Jupiter::String_Type<T>::aformat(const std::basic_string<T> &format, ...)
{ {
size_t r; size_t r;

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save