[DEV] update string basic implement

This commit is contained in:
Edouard DUPIN 2019-04-01 21:53:08 +02:00
parent 13b8c4bf75
commit 68e371d932
4 changed files with 15 additions and 13 deletions

View File

@ -25,7 +25,7 @@ etk::String::String():
//printf("size of string=%ld %ld %ld\n", uint64_t(sizeof(etk::String)), m_sizeLocal, uint64_t(sizeof(etk::Vector<char>)));
memset(m_localData, 0, sizeof(m_localData));
#else
//m_data.resize(1, '\0');
m_data.resize(1, '\0');
#endif
}
@ -401,6 +401,7 @@ const etk::String::Iterator etk::String::end() const {
void etk::String::resize(size_t _newSize, char _value) {
if (_newSize == 0) {
m_data.clear();
m_data.resize(1, '\0');
return;
}
size_t oldSize = m_data.size();

View File

@ -23,15 +23,13 @@ namespace etk {
public:
class Iterator {
private:
size_t m_current; //!< current Id on the string
String* m_string; //!< Pointer on the current element of the string
size_t m_current = 0; //!< current Id on the string
String* m_string = null; //!< Pointer on the current element of the string
public:
/**
* @brief Basic iterator constructor with no link with an etk::String
*/
Iterator():
m_current(0),
m_string(null) {
Iterator() {
// nothing to do ...
}
/**

View File

@ -312,14 +312,19 @@ const etk::UString::Iterator etk::UString::begin() const {
}
etk::UString::Iterator etk::UString::end() {
return position( size()-1 );
return position( size() );
}
const etk::UString::Iterator etk::UString::end() const {
return position( size()-1 );
return position( size() );
}
void etk::UString::resize(size_t _newSize, char32_t _value) {
if (_newSize == 0) {
m_data.clear();
m_data.resize(1, '\0');
return;
}
size_t oldSize = m_data.size();
if (oldSize != 0) {
m_data[m_data.size()-1] = _value;

View File

@ -19,15 +19,13 @@ namespace etk {
public:
class Iterator {
private:
size_t m_current; //!< current Id on the string
UString* m_string; //!< Pointer on the current element of the stringBin
size_t m_current = 0; //!< current Id on the string
UString* m_string = null; //!< Pointer on the current element of the stringBin
public:
/**
* @brief Basic iterator constructor with no link with an etk::UString
*/
Iterator():
m_current(0),
m_string(null) {
Iterator() {
// nothing to do ...
}
/**