[DEV] add back in the string API

This commit is contained in:
Edouard DUPIN 2017-12-27 14:38:46 +01:00
parent b1c561b0ab
commit a739c5d808
2 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,8 @@
/**
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL-2 (see license file)
*/
#include <etk/String.hpp>
#include <etk/UString.hpp>
@ -256,6 +260,14 @@ void etk::String::popBack() {
}
}
char& etk::String::back() {
return m_data[m_data.size()-2];
}
const char& etk::String::back() const {
return m_data[m_data.size()-2];
}
void etk::String::reserve(size_t _size) {
m_data.reserve(_size+1);
}

View File

@ -362,6 +362,12 @@ namespace etk {
* @brief Remove the last element of the string
*/
void popBack();
/**
* @brief Get the last element of the String
* @return An reference on the last char
*/
char& back();
const char& back() const;
/**
* @brief Force the container to have a minimum size in memory allocation
* @param[in] _size Size in byte that is requested.