diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index 9146d523..f590c948 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -717,8 +717,8 @@ namespace etl //********************************************************************* /// Assigns values to the string from a view. //********************************************************************* - template - void assign(const etl::basic_string_view& view) + template + void assign(const etl::basic_string_view& view) { assign(view.begin(), view.end()); } @@ -877,8 +877,8 @@ namespace etl /// Appends to the string. ///\param view An etl::string_view. //********************************************************************* - template - ibasic_string& append(const etl::basic_string_view& view) + template + ibasic_string& append(const etl::basic_string_view& view) { insert(end(), view.begin(), view.end()); return *this; @@ -1120,8 +1120,8 @@ namespace etl ///\param position The position to insert before. ///\param view The view element to add. //********************************************************************* - template - iterator insert(const_iterator position, const etl::basic_string_view& view) + template + iterator insert(const_iterator position, const etl::basic_string_view& view) { return insert(position, view.begin(), view.end()); } @@ -1156,8 +1156,8 @@ namespace etl ///\param position The position to insert before. ///\param view The view to insert. //********************************************************************* - template - etl::ibasic_string& insert(size_type position, const etl::basic_string_view& view) + template + etl::ibasic_string& insert(size_type position, const etl::basic_string_view& view) { ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); @@ -1206,8 +1206,8 @@ namespace etl ///\param subposition The subposition to start from. ///\param sublength The number of characters to insert. //********************************************************************* - template - etl::ibasic_string& insert(size_type position, const etl::basic_string_view& view, size_type subposition, size_type sublength) + template + etl::ibasic_string& insert(size_type position, const etl::basic_string_view& view, size_type subposition, size_type sublength) { ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); ETL_ASSERT(subposition <= view.size(), ETL_ERROR(string_out_of_bounds)); @@ -1387,8 +1387,8 @@ namespace etl ///\param view The content to find ///\param pos The position to start searching from. //********************************************************************* - template - size_type find(const etl::basic_string_view& view, size_type pos = 0) const + template + size_type find(const etl::basic_string_view& view, size_type pos = 0) const { return find_impl(view.begin(), view.end(), view.size(), pos); } @@ -1452,8 +1452,8 @@ namespace etl ///\param view The content to find ///\param pos The position to start searching from. //********************************************************************* - template - size_type rfind(const etl::basic_string_view& view, size_type pos = 0) const + template + size_type rfind(const etl::basic_string_view& view, size_type pos = 0) const { return rfind_impl(view.rbegin(), view.rend(), view.size(), pos); } @@ -1523,8 +1523,8 @@ namespace etl //********************************************************************* /// Checks that the view is within this string //********************************************************************* - template - bool contains(const etl::basic_string_view& view) const + template + bool contains(const etl::basic_string_view& view) const { return find(view) != npos; } @@ -1556,8 +1556,8 @@ namespace etl //********************************************************************* /// Checks that the view is the start of this string //********************************************************************* - template - bool starts_with(const etl::basic_string_view& view) const + template + bool starts_with(const etl::basic_string_view& view) const { return compare(0, view.size(), view) == 0; } @@ -1596,8 +1596,8 @@ namespace etl //********************************************************************* /// Checks that the view is the end of this string //********************************************************************* - template - bool ends_with(const etl::basic_string_view& view) const + template + bool ends_with(const etl::basic_string_view& view) const { if (view.size() > size()) { @@ -1658,8 +1658,8 @@ namespace etl ///\param length The number of characters to replace. ///\param view The string to replace it with. //********************************************************************* - template - ibasic_string& replace(size_type position, size_type length_, const etl::basic_string_view& view) + template + ibasic_string& replace(size_type position, size_type length_, const etl::basic_string_view& view) { ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); @@ -1713,8 +1713,8 @@ namespace etl ///\param last The one after the position to end at. ///\param view The string view to replace it with. //********************************************************************* - template - ibasic_string& replace(const_iterator first, const_iterator last, const etl::basic_string_view& view) + template + ibasic_string& replace(const_iterator first, const_iterator last, const etl::basic_string_view& view) { // Quick hack, as iterators are pointers. iterator first_ = to_iterator(first); @@ -1764,8 +1764,8 @@ namespace etl //********************************************************************* /// Replace characters from 'position' of 'length' with 'view' from 'subposition' of 'sublength'. //********************************************************************* - template - ibasic_string& replace(size_type position, size_type length_, const etl::basic_string_view& view, size_type subposition, size_type sublength) + template + ibasic_string& replace(size_type position, size_type length_, const etl::basic_string_view& view, size_type subposition, size_type sublength) { ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); ETL_ASSERT(subposition <= view.size(), ETL_ERROR(string_out_of_bounds)); @@ -1927,8 +1927,8 @@ namespace etl //************************************************************************* /// Compare with etl::basic_string_view. //************************************************************************* - template - int compare(const etl::basic_string_view& view) const + template + int compare(const etl::basic_string_view& view) const { return compare(p_buffer, p_buffer + size(), @@ -1955,8 +1955,8 @@ namespace etl //************************************************************************* /// Compare position / length with etl::basic_string_view. //************************************************************************* - template - int compare(size_type position, size_type length_, const etl::basic_string_view& view) const + template + int compare(size_type position, size_type length_, const etl::basic_string_view& view) const { return compare(p_buffer + position, p_buffer + position + length_, @@ -1985,8 +1985,8 @@ namespace etl //************************************************************************* /// Compare position / length with etl::basic_string_view. / subposition / sublength. //************************************************************************* - template - int compare(size_type position, size_type length_, const etl::basic_string_view& view, size_type subposition, size_type sublength) const + template + int compare(size_type position, size_type length_, const etl::basic_string_view& view, size_type subposition, size_type sublength) const { ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); ETL_ASSERT(subposition <= view.size(), ETL_ERROR(string_out_of_bounds)); @@ -2059,8 +2059,8 @@ namespace etl ///\param view The content to find ///\param pos The position to start searching from. //********************************************************************* - template - size_type find_first_of(const etl::basic_string_view& view, size_type position = 0) const + template + size_type find_first_of(const etl::basic_string_view& view, size_type position = 0) const { return find_first_of(view.data(), position, view.size()); } @@ -2136,8 +2136,8 @@ namespace etl ///\param view The content to find ///\param pos The position to start searching from. //********************************************************************* - template - size_type find_last_of(const etl::basic_string_view& view, size_type position = npos) const + template + size_type find_last_of(const etl::basic_string_view& view, size_type position = npos) const { return find_last_of(view.data(), position, view.size()); } @@ -2231,8 +2231,8 @@ namespace etl ///\param view The content to find ///\param pos The position to start searching from. //********************************************************************* - template - size_type find_first_not_of(const etl::basic_string_view& view, size_type position = 0) const + template + size_type find_first_not_of(const etl::basic_string_view& view, size_type position = 0) const { return find_first_not_of(view.data(), position, view.size()); } @@ -2315,8 +2315,8 @@ namespace etl ///\param view The content to find ///\param pos The position to start searching from. //********************************************************************* - template - size_type find_last_not_of(const etl::basic_string_view& view, size_type position = npos) const + template + size_type find_last_not_of(const etl::basic_string_view& view, size_type position = npos) const { return find_last_not_of(view.data(), position, view.size()); } @@ -2416,8 +2416,8 @@ namespace etl //************************************************************************* /// Assignment operator. //************************************************************************* - template - ibasic_string& operator = (const etl::basic_string_view& view) + template + ibasic_string& operator = (const etl::basic_string_view& view) { assign(view); @@ -2437,8 +2437,8 @@ namespace etl //************************************************************************* /// += operator. //************************************************************************* - template - ibasic_string& operator += (const etl::basic_string_view& rhs) + template + ibasic_string& operator += (const etl::basic_string_view& rhs) { append(rhs); diff --git a/include/etl/string_view.h b/include/etl/string_view.h index af261924..7b60d839 100644 --- a/include/etl/string_view.h +++ b/include/etl/string_view.h @@ -100,9 +100,9 @@ namespace etl { public: - typedef T value_type; - typedef TTraits traits_type; - typedef size_t size_type; + typedef T value_type; + typedef TTraits traits_type; + typedef size_t size_type; typedef const T& const_reference; typedef const T* const_pointer; typedef const T* const_iterator; @@ -766,7 +766,6 @@ namespace etl //********************************************************************* /// Checks that the view is within this string //********************************************************************* - template bool contains(const etl::basic_string_view& view) const { return find(view) != npos;