Browse Source

Added safety check to Readable_String::span()

Added Reference_String::erase()
release/0.19
JustinAJ 9 years ago
parent
commit
3df3472079
  1. 6
      Jupiter/Readable_String_Imp.h
  2. 5
      Jupiter/Reference_String.h
  3. 7
      Jupiter/Reference_String_Imp.h
  4. BIN
      Release/Jupiter.lib

6
Jupiter/Readable_String_Imp.h

@ -167,14 +167,16 @@ template<typename T> size_t Jupiter::Readable_String<T>::findi(const Jupiter::Re
template<typename T> size_t Jupiter::Readable_String<T>::span(const Jupiter::Readable_String<T> &in) const
{
size_t index = 0;
while (in.contains(this->get(index))) index++;
while (index != this->size() && in.contains(this->get(index)))
++index;
return index;
}
template<typename T> size_t Jupiter::Readable_String<T>::span(const T *in) const
{
size_t index = 0;
while (containsSymbol(in, this->get(index))) index++;
while (index != this->size() && containsSymbol(in, this->get(index)))
++index;
return index;
}

5
Jupiter/Reference_String.h

@ -70,6 +70,11 @@ namespace Jupiter
*/
virtual size_t truncate(size_t n);
/**
* @brief Erases the string (sets the string's length to 0)
*/
void erase();
/**
* @brief Shifts the string pointer to the left.
*

7
Jupiter/Reference_String_Imp.h

@ -93,6 +93,13 @@ template<typename T> size_t Jupiter::Reference_String<T>::truncate(size_t n)
return (Jupiter::Reference_String<T>::length -= n);
}
// erase
template<typename T> void Jupiter::Reference_String<T>::erase()
{
Jupiter::Reference_String<T>::length = 0;
}
// shift
template<typename T> size_t Jupiter::Reference_String<T>::shiftLeft(size_t len)

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save