diff --git a/Jupiter/Shift_String.h b/Jupiter/Shift_String.h index 632c216..c277643 100644 --- a/Jupiter/Shift_String.h +++ b/Jupiter/Shift_String.h @@ -82,6 +82,15 @@ namespace Jupiter */ virtual void erase(); + /** + * @brief Captures an input string of elements and uses it as the internal string. + * Note: Do NOT externally delete[] or free() 'in'. + * + * @param in Pointer to the start of the string to capture + * @param in_length Number of elements in the string + */ + virtual void capture(T *in, size_t in_length); + /** * @brief Sets the internal buffer to be at least large enough to old a specified number of elements. * Note: This does nothing if len is less than the string's current length. diff --git a/Jupiter/Shift_String_Imp.h b/Jupiter/Shift_String_Imp.h index bb8e4c6..f87a387 100644 --- a/Jupiter/Shift_String_Imp.h +++ b/Jupiter/Shift_String_Imp.h @@ -79,6 +79,16 @@ template void Jupiter::Shift_String_Type::erase() Jupiter::String_Type::str = Jupiter::Shift_String_Type::base; } +// capture + +template void Jupiter::Shift_String_Type::capture(T *in, size_t in_size) +{ + delete[] Jupiter::Shift_String_Type::base; + + Jupiter::Shift_String_Type::base = in; + Jupiter::String_Type::length = in_size; +} + template bool Jupiter::Shift_String_Type::setBufferSize(size_t len) { if (len > Jupiter::String_Type::length) diff --git a/Jupiter/String_Type.h b/Jupiter/String_Type.h index 4b176e1..79257bb 100644 --- a/Jupiter/String_Type.h +++ b/Jupiter/String_Type.h @@ -137,6 +137,15 @@ namespace Jupiter */ virtual void processEscapeSequences(); + /** + * @brief Captures an input string of elements and uses it as the internal string. + * Note: Do NOT externally delete[] or free() 'in'. + * + * @param in Pointer to the start of the string to capture + * @param in_length Number of elements in the string + */ + virtual void capture(T *in, size_t in_length) = 0; + /** * @brief Sets the value of an element at the specified index. * Note: If the index is not in the string, it will be added. diff --git a/Release/Jupiter.lib b/Release/Jupiter.lib index 216219b..7aad1ee 100644 Binary files a/Release/Jupiter.lib and b/Release/Jupiter.lib differ