remove at(index) reference function

remove chrUpr and chrLwr from PIString
This commit is contained in:
2020-09-10 12:37:33 +03:00
parent b11ebc8100
commit 05b48af153
6 changed files with 4 additions and 28 deletions

View File

@@ -167,7 +167,6 @@ public:
inline bool isEmpty() const {return (pid_size == 0);}
inline T & operator [](size_t index) {return pid_data[pid_start + index];}
inline T & at(size_t index) {return pid_data[pid_start + index];}
inline const T & operator [](size_t index) const {return pid_data[pid_start + index];}
inline const T & at(size_t index) const {return pid_data[pid_start + index];}
inline T & back() {return pid_data[pid_start + pid_size - 1];}

View File

@@ -206,7 +206,6 @@ public:
return pim_content.back();
}
const T operator [](const Key & key) const {bool f(false); ssize_t i = _find(key, f); if (f) return pim_content[pim_index[i].index]; return T();}
T & at(const Key & key) {return (*this)[key];}
const T at(const Key & key) const {return (*this)[key];}
PIMap<Key, T> & operator <<(const PIMap<Key, T> & other) {

View File

@@ -167,7 +167,6 @@ public:
inline bool isEmpty() const {return (piv_size == 0);}
inline T & operator [](size_t index) {return piv_data[index];}
inline T & at(size_t index) {return piv_data[index];}
inline const T & operator [](size_t index) const {return piv_data[index];}
inline const T & at(size_t index) const {return piv_data[index];}
inline T & back() {return piv_data[piv_size - 1];}

View File

@@ -613,7 +613,7 @@ PIString PIString::trimmed() const {
PIString & PIString::replace(int from, int count, const PIString & with) {
count = piMini(count, length() - from);
if (count == with.size_s())
memcpy(&(at(from)), &(with.at(0)), count * sizeof(PIChar));
memcpy(PIDeque<PIChar>::data(from), static_cast<PIDeque<PIChar>>(with).data(), count * sizeof(PIChar));
else {
remove(from, count);
PIDeque<PIChar>::insert(from, with);
@@ -671,7 +671,7 @@ PIString & PIString::replaceAll(const PIString & what, const char with) {
}
if (!match) continue;
if (dl > 0) PIDeque<PIChar>::remove(i, dl);
at(i) = PIChar(with);
(*this)[i] = PIChar(with);
//i -= l;
}
return *this;
@@ -682,7 +682,7 @@ PIString & PIString::replaceAll(const char what, const char with) {
int l = length();
for (int i = 0; i < l; ++i) {
if (at(i) == what)
at(i) = with;
(*this)[i] = with;
}
return *this;
}
@@ -1166,18 +1166,6 @@ PIString & PIString::setReadableSize(llong bytes) {
}
inline char chrUpr(char c) {
if (c >= 'a' && c <= 'z') return c + 'A' - 'a';
return c;
}
inline char chrLwr(char c) {
if (c >= 'A' && c <= 'Z') return c + 'a' - 'A';
return c;
}
const static PIString _versionDelims_ = PIStringAscii("._-+");

View File

@@ -101,12 +101,6 @@ public:
* Example: \snippet pistring.cpp PIString::char* */
operator const char*() {return data();}
//! Return symbol at index "pos"
PIChar operator [](const int pos) const {return at(pos);}
//! Return reference to symbol at index "pos"
PIChar & operator [](const int pos) {return at(pos);}
//! Compare operator
bool operator ==(const PIString & str) const;
@@ -790,9 +784,6 @@ inline PIString operator +(const char c, const PIString & f) {return PIChar(c) +
//! \relatesalso PIString \brief Return concatenated string
inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);}
inline char chrUpr(char c);
inline char chrLwr(char c);
int versionCompare(const PIString & v0, const PIString & v1, int components = 6);

View File

@@ -77,7 +77,7 @@ public:
//! \brief Trim all strings
//! \details Example: \snippet pistring.cpp PIStringList::trim
PIStringList & trim() {for (uint i = 0; i < size(); ++i) at(i).trim(); return *this;}
PIStringList & trim() {for (uint i = 0; i < size(); ++i) (*this)[i].trim(); return *this;}
//! Return sum of lengths of all strings
uint contentSize() {uint s = 0; for (uint i = 0; i < size(); ++i) s += at(i).size(); return s;}