diff --git a/Jupiter/Readable_String.h b/Jupiter/Readable_String.h index f5db4eb..1f84008 100644 --- a/Jupiter/Readable_String.h +++ b/Jupiter/Readable_String.h @@ -49,6 +49,13 @@ namespace Jupiter */ virtual const T &get(size_t index) const = 0; + /** + * @brief Returns a pointer to the underlying string of elements. + * + * @return Pointer to the underlying string of elements. + */ + virtual const T *ptr() const = 0; + /** * @brief Returns the number of elements in the String. * @@ -57,11 +64,11 @@ namespace Jupiter virtual size_t size() const = 0; /** - * @brief Returns a pointer to the underlying string of elements. + * @brief Checks if the String is empty. * - * @return Pointer to the underlying string of elements. + * @return True if the String is empty, false otherwise. */ - virtual const T *ptr() const = 0; + virtual bool isEmpty() const; /** * @brief Checks if the string contains an element with the specified value. diff --git a/Jupiter/Readable_String_Imp.h b/Jupiter/Readable_String_Imp.h index 1055b61..8851ac0 100644 --- a/Jupiter/Readable_String_Imp.h +++ b/Jupiter/Readable_String_Imp.h @@ -32,6 +32,13 @@ * Readable_String */ +// isEmpty + +template bool Jupiter::Readable_String::isEmpty() const +{ + return this->size() == 0; +} + // contains template bool Jupiter::Readable_String::contains(const T &value) const