From 500dae3683aae3d406985a52d76deae18b3de531 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Thu, 5 Jun 2014 09:42:32 -0400 Subject: [PATCH] Added isEmpty() to Readable_String. --- Jupiter/Readable_String.h | 13 ++++++++++--- Jupiter/Readable_String_Imp.h | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) 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