remove at(index) reference function
remove chrUpr and chrLwr from PIString
This commit is contained in:
@@ -167,7 +167,6 @@ public:
|
|||||||
inline bool isEmpty() const {return (pid_size == 0);}
|
inline bool isEmpty() const {return (pid_size == 0);}
|
||||||
|
|
||||||
inline T & operator [](size_t index) {return pid_data[pid_start + index];}
|
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 & 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 const T & at(size_t index) const {return pid_data[pid_start + index];}
|
||||||
inline T & back() {return pid_data[pid_start + pid_size - 1];}
|
inline T & back() {return pid_data[pid_start + pid_size - 1];}
|
||||||
|
|||||||
@@ -206,7 +206,6 @@ public:
|
|||||||
return pim_content.back();
|
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();}
|
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];}
|
const T at(const Key & key) const {return (*this)[key];}
|
||||||
|
|
||||||
PIMap<Key, T> & operator <<(const PIMap<Key, T> & other) {
|
PIMap<Key, T> & operator <<(const PIMap<Key, T> & other) {
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ public:
|
|||||||
inline bool isEmpty() const {return (piv_size == 0);}
|
inline bool isEmpty() const {return (piv_size == 0);}
|
||||||
|
|
||||||
inline T & operator [](size_t index) {return piv_data[index];}
|
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 & operator [](size_t index) const {return piv_data[index];}
|
||||||
inline const T & at(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];}
|
inline T & back() {return piv_data[piv_size - 1];}
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ PIString PIString::trimmed() const {
|
|||||||
PIString & PIString::replace(int from, int count, const PIString & with) {
|
PIString & PIString::replace(int from, int count, const PIString & with) {
|
||||||
count = piMini(count, length() - from);
|
count = piMini(count, length() - from);
|
||||||
if (count == with.size_s())
|
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 {
|
else {
|
||||||
remove(from, count);
|
remove(from, count);
|
||||||
PIDeque<PIChar>::insert(from, with);
|
PIDeque<PIChar>::insert(from, with);
|
||||||
@@ -671,7 +671,7 @@ PIString & PIString::replaceAll(const PIString & what, const char with) {
|
|||||||
}
|
}
|
||||||
if (!match) continue;
|
if (!match) continue;
|
||||||
if (dl > 0) PIDeque<PIChar>::remove(i, dl);
|
if (dl > 0) PIDeque<PIChar>::remove(i, dl);
|
||||||
at(i) = PIChar(with);
|
(*this)[i] = PIChar(with);
|
||||||
//i -= l;
|
//i -= l;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@@ -682,7 +682,7 @@ PIString & PIString::replaceAll(const char what, const char with) {
|
|||||||
int l = length();
|
int l = length();
|
||||||
for (int i = 0; i < l; ++i) {
|
for (int i = 0; i < l; ++i) {
|
||||||
if (at(i) == what)
|
if (at(i) == what)
|
||||||
at(i) = with;
|
(*this)[i] = with;
|
||||||
}
|
}
|
||||||
return *this;
|
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("._-+");
|
const static PIString _versionDelims_ = PIStringAscii("._-+");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -101,12 +101,6 @@ public:
|
|||||||
* Example: \snippet pistring.cpp PIString::char* */
|
* Example: \snippet pistring.cpp PIString::char* */
|
||||||
operator const char*() {return data();}
|
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
|
//! Compare operator
|
||||||
bool operator ==(const PIString & str) const;
|
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
|
//! \relatesalso PIString \brief Return concatenated string
|
||||||
inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);}
|
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);
|
int versionCompare(const PIString & v0, const PIString & v1, int components = 6);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
|
|
||||||
//! \brief Trim all strings
|
//! \brief Trim all strings
|
||||||
//! \details Example: \snippet pistring.cpp PIStringList::trim
|
//! \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
|
//! 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;}
|
uint contentSize() {uint s = 0; for (uint i = 0; i < size(); ++i) s += at(i).size(); return s;}
|
||||||
|
|||||||
Reference in New Issue
Block a user