[DEV] update string basic implement
This commit is contained in:
parent
13b8c4bf75
commit
68e371d932
@ -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>)));
|
//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));
|
memset(m_localData, 0, sizeof(m_localData));
|
||||||
#else
|
#else
|
||||||
//m_data.resize(1, '\0');
|
m_data.resize(1, '\0');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,6 +401,7 @@ const etk::String::Iterator etk::String::end() const {
|
|||||||
void etk::String::resize(size_t _newSize, char _value) {
|
void etk::String::resize(size_t _newSize, char _value) {
|
||||||
if (_newSize == 0) {
|
if (_newSize == 0) {
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
m_data.resize(1, '\0');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
size_t oldSize = m_data.size();
|
size_t oldSize = m_data.size();
|
||||||
|
@ -23,15 +23,13 @@ namespace etk {
|
|||||||
public:
|
public:
|
||||||
class Iterator {
|
class Iterator {
|
||||||
private:
|
private:
|
||||||
size_t m_current; //!< current Id on the string
|
size_t m_current = 0; //!< current Id on the string
|
||||||
String* m_string; //!< Pointer on the current element of the string
|
String* m_string = null; //!< Pointer on the current element of the string
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Basic iterator constructor with no link with an etk::String
|
* @brief Basic iterator constructor with no link with an etk::String
|
||||||
*/
|
*/
|
||||||
Iterator():
|
Iterator() {
|
||||||
m_current(0),
|
|
||||||
m_string(null) {
|
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -312,14 +312,19 @@ const etk::UString::Iterator etk::UString::begin() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
etk::UString::Iterator etk::UString::end() {
|
etk::UString::Iterator etk::UString::end() {
|
||||||
return position( size()-1 );
|
return position( size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
const etk::UString::Iterator etk::UString::end() const {
|
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) {
|
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();
|
size_t oldSize = m_data.size();
|
||||||
if (oldSize != 0) {
|
if (oldSize != 0) {
|
||||||
m_data[m_data.size()-1] = _value;
|
m_data[m_data.size()-1] = _value;
|
||||||
|
@ -19,15 +19,13 @@ namespace etk {
|
|||||||
public:
|
public:
|
||||||
class Iterator {
|
class Iterator {
|
||||||
private:
|
private:
|
||||||
size_t m_current; //!< current Id on the string
|
size_t m_current = 0; //!< current Id on the string
|
||||||
UString* m_string; //!< Pointer on the current element of the stringBin
|
UString* m_string = null; //!< Pointer on the current element of the stringBin
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Basic iterator constructor with no link with an etk::UString
|
* @brief Basic iterator constructor with no link with an etk::UString
|
||||||
*/
|
*/
|
||||||
Iterator():
|
Iterator() {
|
||||||
m_current(0),
|
|
||||||
m_string(null) {
|
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user