iterator methods fixes (patch 1164808)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -227,13 +227,13 @@ public:
|
|||||||
reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
|
reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { }
|
||||||
reference operator*() const { return *m_ptr; }
|
reference operator*() const { return *m_ptr; }
|
||||||
pointer operator->() const { return m_ptr; }
|
pointer operator->() const { return m_ptr; }
|
||||||
itor operator++() { --m_ptr; return *this; }
|
itor& operator++() { --m_ptr; return *this; }
|
||||||
itor operator++(int)
|
const itor operator++(int)
|
||||||
{ reverse_iterator tmp = *this; --m_ptr; return tmp; }
|
{ reverse_iterator tmp = *this; --m_ptr; return tmp; }
|
||||||
itor operator--() { ++m_ptr; return *this; }
|
itor& operator--() { ++m_ptr; return *this; }
|
||||||
itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }
|
const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }
|
||||||
bool operator ==(const itor& it) { return m_ptr == it.m_ptr; }
|
bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }
|
||||||
bool operator !=(const itor& it) { return m_ptr != it.m_ptr; }
|
bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class const_reverse_iterator
|
class const_reverse_iterator
|
||||||
@@ -254,13 +254,13 @@ public:
|
|||||||
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
|
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
|
||||||
reference operator*() const { return *m_ptr; }
|
reference operator*() const { return *m_ptr; }
|
||||||
pointer operator->() const { return m_ptr; }
|
pointer operator->() const { return m_ptr; }
|
||||||
itor operator++() { --m_ptr; return *this; }
|
itor& operator++() { --m_ptr; return *this; }
|
||||||
itor operator++(int)
|
const itor operator++(int)
|
||||||
{ itor tmp = *this; --m_ptr; return tmp; }
|
{ itor tmp = *this; --m_ptr; return tmp; }
|
||||||
itor operator--() { ++m_ptr; return *this; }
|
itor& operator--() { ++m_ptr; return *this; }
|
||||||
itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }
|
const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }
|
||||||
bool operator ==(const itor& it) { return m_ptr == it.m_ptr; }
|
bool operator ==(const itor& it) const { return m_ptr == it.m_ptr; }
|
||||||
bool operator !=(const itor& it) { return m_ptr != it.m_ptr; }
|
bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
wxArrayString(const_iterator first, const_iterator last)
|
wxArrayString(const_iterator first, const_iterator last)
|
||||||
|
@@ -400,11 +400,11 @@ public: \
|
|||||||
reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \
|
reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } \
|
||||||
reference operator*() const { return *m_ptr; } \
|
reference operator*() const { return *m_ptr; } \
|
||||||
ptrop \
|
ptrop \
|
||||||
itor operator++() { --m_ptr; return *this; } \
|
itor& operator++() { --m_ptr; return *this; } \
|
||||||
itor operator++(int) \
|
const itor operator++(int) \
|
||||||
{ reverse_iterator tmp = *this; --m_ptr; return tmp; } \
|
{ reverse_iterator tmp = *this; --m_ptr; return tmp; } \
|
||||||
itor operator--() { ++m_ptr; return *this; } \
|
itor& operator--() { ++m_ptr; return *this; } \
|
||||||
itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } \
|
const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\
|
||||||
bool operator ==(const itor& it) { return m_ptr == it.m_ptr; } \
|
bool operator ==(const itor& it) { return m_ptr == it.m_ptr; } \
|
||||||
bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } \
|
bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } \
|
||||||
}; \
|
}; \
|
||||||
@@ -433,11 +433,11 @@ public: \
|
|||||||
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }\
|
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }\
|
||||||
reference operator*() const { return *m_ptr; } \
|
reference operator*() const { return *m_ptr; } \
|
||||||
ptrop \
|
ptrop \
|
||||||
itor operator++() { --m_ptr; return *this; } \
|
itor& operator++() { --m_ptr; return *this; } \
|
||||||
itor operator++(int) \
|
const itor operator++(int) \
|
||||||
{ itor tmp = *this; --m_ptr; return tmp; } \
|
{ itor tmp = *this; --m_ptr; return tmp; } \
|
||||||
itor operator--() { ++m_ptr; return *this; } \
|
itor& operator--() { ++m_ptr; return *this; } \
|
||||||
itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; } \
|
const itor operator--(int) { itor tmp = *this; ++m_ptr; return tmp; }\
|
||||||
bool operator ==(const itor& it) { return m_ptr == it.m_ptr; } \
|
bool operator ==(const itor& it) { return m_ptr == it.m_ptr; } \
|
||||||
bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } \
|
bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } \
|
||||||
}; \
|
}; \
|
||||||
|
@@ -170,9 +170,9 @@ private:
|
|||||||
compatibility_iterator* operator->() { return this; } \
|
compatibility_iterator* operator->() { return this; } \
|
||||||
const compatibility_iterator* operator->() const { return this; } \
|
const compatibility_iterator* operator->() const { return this; } \
|
||||||
\
|
\
|
||||||
bool operator==(const compatibility_iterator& i) \
|
bool operator==(const compatibility_iterator& i) const \
|
||||||
{ return (m_list == i.m_list) && (m_iter == i.m_iter); } \
|
{ return (m_list == i.m_list) && (m_iter == i.m_iter); } \
|
||||||
bool operator!=(const compatibility_iterator& i) \
|
bool operator!=(const compatibility_iterator& i) const \
|
||||||
{ return !( operator==( i ) ); } \
|
{ return !( operator==( i ) ); } \
|
||||||
operator bool() const \
|
operator bool() const \
|
||||||
{ return m_list ? m_iter != m_list->end() : false; } \
|
{ return m_list ? m_iter != m_list->end() : false; } \
|
||||||
@@ -329,7 +329,6 @@ extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
class WXDLLEXPORT wxObjectListNode;
|
class WXDLLEXPORT wxObjectListNode;
|
||||||
typedef wxObjectListNode wxNode;
|
|
||||||
|
|
||||||
// undef it to get rid of old, deprecated functions
|
// undef it to get rid of old, deprecated functions
|
||||||
#define wxLIST_COMPATIBILITY
|
#define wxLIST_COMPATIBILITY
|
||||||
@@ -672,6 +671,7 @@ private:
|
|||||||
void SetData(T *data) \
|
void SetData(T *data) \
|
||||||
{ wxNodeBase::SetData(data); } \
|
{ wxNodeBase::SetData(data); } \
|
||||||
\
|
\
|
||||||
|
protected: \
|
||||||
virtual void DeleteData(); \
|
virtual void DeleteData(); \
|
||||||
\
|
\
|
||||||
DECLARE_NO_COPY_CLASS(nodetype) \
|
DECLARE_NO_COPY_CLASS(nodetype) \
|
||||||
@@ -786,14 +786,14 @@ private:
|
|||||||
{ return *(pointer_type)m_node->GetDataPtr(); } \
|
{ return *(pointer_type)m_node->GetDataPtr(); } \
|
||||||
ptrop \
|
ptrop \
|
||||||
itor& operator++() { m_node = m_node->GetNext(); return *this; }\
|
itor& operator++() { m_node = m_node->GetNext(); return *this; }\
|
||||||
itor operator++(int) \
|
const itor operator++(int) \
|
||||||
{ itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\
|
{ itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\
|
||||||
itor& operator--() \
|
itor& operator--() \
|
||||||
{ \
|
{ \
|
||||||
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
||||||
return *this; \
|
return *this; \
|
||||||
} \
|
} \
|
||||||
itor operator--(int) \
|
const itor operator--(int) \
|
||||||
{ \
|
{ \
|
||||||
itor tmp = *this; \
|
itor tmp = *this; \
|
||||||
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
||||||
@@ -829,14 +829,14 @@ private:
|
|||||||
{ return *(pointer_type)m_node->GetDataPtr(); } \
|
{ return *(pointer_type)m_node->GetDataPtr(); } \
|
||||||
ptrop \
|
ptrop \
|
||||||
itor& operator++() { m_node = m_node->GetNext(); return *this; }\
|
itor& operator++() { m_node = m_node->GetNext(); return *this; }\
|
||||||
itor operator++(int) \
|
const itor operator++(int) \
|
||||||
{ itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\
|
{ itor tmp = *this; m_node = m_node->GetNext(); return tmp; }\
|
||||||
itor& operator--() \
|
itor& operator--() \
|
||||||
{ \
|
{ \
|
||||||
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
||||||
return *this; \
|
return *this; \
|
||||||
} \
|
} \
|
||||||
itor operator--(int) \
|
const itor operator--(int) \
|
||||||
{ \
|
{ \
|
||||||
itor tmp = *this; \
|
itor tmp = *this; \
|
||||||
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
m_node = m_node ? m_node->GetPrevious() : m_init; \
|
||||||
@@ -871,11 +871,11 @@ private:
|
|||||||
ptrop \
|
ptrop \
|
||||||
itor& operator++() \
|
itor& operator++() \
|
||||||
{ m_node = m_node->GetPrevious(); return *this; } \
|
{ m_node = m_node->GetPrevious(); return *this; } \
|
||||||
itor operator++(int) \
|
const itor operator++(int) \
|
||||||
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
|
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
|
||||||
itor& operator--() \
|
itor& operator--() \
|
||||||
{ m_node = m_node ? m_node->GetNext() : m_init; return *this; } \
|
{ m_node = m_node ? m_node->GetNext() : m_init; return *this; } \
|
||||||
itor operator--(int) \
|
const itor operator--(int) \
|
||||||
{ \
|
{ \
|
||||||
itor tmp = *this; \
|
itor tmp = *this; \
|
||||||
m_node = m_node ? m_node->GetNext() : m_init; \
|
m_node = m_node ? m_node->GetNext() : m_init; \
|
||||||
@@ -912,11 +912,11 @@ private:
|
|||||||
ptrop \
|
ptrop \
|
||||||
itor& operator++() \
|
itor& operator++() \
|
||||||
{ m_node = m_node->GetPrevious(); return *this; } \
|
{ m_node = m_node->GetPrevious(); return *this; } \
|
||||||
itor operator++(int) \
|
const itor operator++(int) \
|
||||||
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
|
{ itor tmp = *this; m_node = m_node->GetPrevious(); return tmp; }\
|
||||||
itor& operator--() \
|
itor& operator--() \
|
||||||
{ m_node = m_node ? m_node->GetNext() : m_init; return *this;}\
|
{ m_node = m_node ? m_node->GetNext() : m_init; return *this;}\
|
||||||
itor operator--(int) \
|
const itor operator--(int) \
|
||||||
{ \
|
{ \
|
||||||
itor tmp = *this; \
|
itor tmp = *this; \
|
||||||
m_node = m_node ? m_node->GetNext() : m_init; \
|
m_node = m_node ? m_node->GetNext() : m_init; \
|
||||||
@@ -930,7 +930,7 @@ private:
|
|||||||
\
|
\
|
||||||
wxEXPLICIT name(size_type n, const_reference v = value_type()) \
|
wxEXPLICIT name(size_type n, const_reference v = value_type()) \
|
||||||
{ assign(n, v); } \
|
{ assign(n, v); } \
|
||||||
name(const_iterator first, const_iterator last) \
|
name(const const_iterator& first, const const_iterator& last) \
|
||||||
{ assign(first, last); } \
|
{ assign(first, last); } \
|
||||||
iterator begin() { return iterator(GetFirst(), GetLast()); } \
|
iterator begin() { return iterator(GetFirst(), GetLast()); } \
|
||||||
const_iterator begin() const \
|
const_iterator begin() const \
|
||||||
@@ -956,15 +956,15 @@ private:
|
|||||||
bool empty() const { return IsEmpty(); } \
|
bool empty() const { return IsEmpty(); } \
|
||||||
reference front() { return *begin(); } \
|
reference front() { return *begin(); } \
|
||||||
const_reference front() const { return *begin(); } \
|
const_reference front() const { return *begin(); } \
|
||||||
reference back() { return *--end(); } \
|
reference back() { iterator tmp = end(); return *--tmp; } \
|
||||||
const_reference back() const { return *--end(); } \
|
const_reference back() const { const_iterator tmp = end(); return *--tmp; }\
|
||||||
void push_front(const_reference v = value_type()) \
|
void push_front(const_reference v = value_type()) \
|
||||||
{ Insert(GetFirst(), (const_base_reference)v); } \
|
{ Insert(GetFirst(), (const_base_reference)v); } \
|
||||||
void pop_front() { DeleteNode(GetFirst()); } \
|
void pop_front() { DeleteNode(GetFirst()); } \
|
||||||
void push_back(const_reference v = value_type()) \
|
void push_back(const_reference v = value_type()) \
|
||||||
{ Append((const_base_reference)v); } \
|
{ Append((const_base_reference)v); } \
|
||||||
void pop_back() { DeleteNode(GetLast()); } \
|
void pop_back() { DeleteNode(GetLast()); } \
|
||||||
void assign(const_iterator first, const_iterator last) \
|
void assign(const_iterator first, const const_iterator& last) \
|
||||||
{ \
|
{ \
|
||||||
clear(); \
|
clear(); \
|
||||||
for(; first != last; ++first) \
|
for(; first != last; ++first) \
|
||||||
@@ -976,38 +976,38 @@ private:
|
|||||||
for(size_type i = 0; i < n; ++i) \
|
for(size_type i = 0; i < n; ++i) \
|
||||||
Append((const_base_reference)v); \
|
Append((const_base_reference)v); \
|
||||||
} \
|
} \
|
||||||
iterator insert(iterator it, const_reference v = value_type()) \
|
iterator insert(const iterator& it, const_reference v = value_type())\
|
||||||
{ \
|
{ \
|
||||||
Insert(it.m_node, (const_base_reference)v); \
|
Insert(it.m_node, (const_base_reference)v); \
|
||||||
return iterator(it.m_node->GetPrevious(), GetLast()); \
|
return iterator(it.m_node->GetPrevious(), GetLast()); \
|
||||||
} \
|
} \
|
||||||
void insert(iterator it, size_type n, const_reference v = value_type())\
|
void insert(const iterator& it, size_type n, const_reference v = value_type())\
|
||||||
{ \
|
{ \
|
||||||
for(size_type i = 0; i < n; ++i) \
|
for(size_type i = 0; i < n; ++i) \
|
||||||
Insert(it.m_node, (const_base_reference)v); \
|
Insert(it.m_node, (const_base_reference)v); \
|
||||||
} \
|
} \
|
||||||
void insert(iterator it, const_iterator first, const_iterator last) \
|
void insert(const iterator& it, const_iterator first, const const_iterator& last)\
|
||||||
{ \
|
{ \
|
||||||
for(; first != last; ++first) \
|
for(; first != last; ++first) \
|
||||||
Insert(it.m_node, (const_base_reference)*first); \
|
Insert(it.m_node, (const_base_reference)*first); \
|
||||||
} \
|
} \
|
||||||
iterator erase(iterator it) \
|
iterator erase(const iterator& it) \
|
||||||
{ \
|
{ \
|
||||||
iterator next = iterator(it.m_node->GetNext(), GetLast()); \
|
iterator next = iterator(it.m_node->GetNext(), GetLast()); \
|
||||||
DeleteNode(it.m_node); return next; \
|
DeleteNode(it.m_node); return next; \
|
||||||
} \
|
} \
|
||||||
iterator erase(iterator first, iterator last) \
|
iterator erase(const iterator& first, const iterator& last) \
|
||||||
{ \
|
{ \
|
||||||
iterator next = last; ++next; \
|
iterator next = last; ++next; \
|
||||||
DeleteNodes(first.m_node, last.m_node); \
|
DeleteNodes(first.m_node, last.m_node); \
|
||||||
return next; \
|
return next; \
|
||||||
} \
|
} \
|
||||||
void clear() { Clear(); } \
|
void clear() { Clear(); } \
|
||||||
void splice(iterator it, name& l, iterator first, iterator last) \
|
void splice(const iterator& it, name& l, const iterator& first, const iterator& last)\
|
||||||
{ insert(it, first, last); l.erase(first, last); } \
|
{ insert(it, first, last); l.erase(first, last); } \
|
||||||
void splice(iterator it, name& l) \
|
void splice(const iterator& it, name& l) \
|
||||||
{ splice(it, l, l.begin(), l.end() ); } \
|
{ splice(it, l, l.begin(), l.end() ); } \
|
||||||
void splice(iterator it, name& l, iterator first) \
|
void splice(const iterator& it, name& l, const iterator& first) \
|
||||||
{ \
|
{ \
|
||||||
iterator tmp = first; ++tmp; \
|
iterator tmp = first; ++tmp; \
|
||||||
if(it == first || it == tmp) return; \
|
if(it == first || it == tmp) return; \
|
||||||
|
@@ -418,7 +418,7 @@ int SavePCX(wxImage *image, wxOutputStream& stream)
|
|||||||
unsigned long index;
|
unsigned long index;
|
||||||
|
|
||||||
for (wxImageHistogram::iterator entry = histogram.begin();
|
for (wxImageHistogram::iterator entry = histogram.begin();
|
||||||
entry != histogram.end(); entry++ )
|
entry != histogram.end(); ++entry )
|
||||||
{
|
{
|
||||||
key = entry->first;
|
key = entry->first;
|
||||||
index = entry->second.index;
|
index = entry->second.index;
|
||||||
|
@@ -180,7 +180,7 @@ bool wxXPMHandler::SaveFile(wxImage * image,
|
|||||||
|
|
||||||
// 2b. generate colour table:
|
// 2b. generate colour table:
|
||||||
for (wxImageHistogram::iterator entry = histogram.begin();
|
for (wxImageHistogram::iterator entry = histogram.begin();
|
||||||
entry != histogram.end(); entry++ )
|
entry != histogram.end(); ++entry )
|
||||||
{
|
{
|
||||||
unsigned long index = entry->second.index;
|
unsigned long index = entry->second.index;
|
||||||
symbols[index] = symbols_data + index * (chars_per_pixel+1);
|
symbols[index] = symbols_data + index * (chars_per_pixel+1);
|
||||||
|
@@ -742,7 +742,7 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
|
|||||||
*/
|
*/
|
||||||
if (hasMask)
|
if (hasMask)
|
||||||
{
|
{
|
||||||
for (it = clr_tbl.begin(); it != clr_tbl.end(); it++)
|
for (it = clr_tbl.begin(); it != clr_tbl.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->second.R == 255 && it->second.G == 0 &&
|
if (it->second.R == 255 && it->second.G == 0 &&
|
||||||
it->second.B == 255 &&
|
it->second.B == 255 &&
|
||||||
|
@@ -4713,7 +4713,7 @@ wxArrayInt wxGrid::CalcRowLabelsExposed( const wxRegion& reg )
|
|||||||
rowlabels.Add( row );
|
rowlabels.Add( row );
|
||||||
}
|
}
|
||||||
|
|
||||||
iter++ ;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rowlabels;
|
return rowlabels;
|
||||||
@@ -4764,7 +4764,7 @@ wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg )
|
|||||||
colLabels.Add( col );
|
colLabels.Add( col );
|
||||||
}
|
}
|
||||||
|
|
||||||
iter++ ;
|
++iter;
|
||||||
}
|
}
|
||||||
return colLabels;
|
return colLabels;
|
||||||
}
|
}
|
||||||
@@ -4824,7 +4824,7 @@ wxGridCellCoordsArray wxGrid::CalcCellsExposed( const wxRegion& reg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cellsExposed;
|
return cellsExposed;
|
||||||
|
@@ -4021,7 +4021,7 @@ void wxWindowGTK::GtkSendPaintEvents()
|
|||||||
(char *)"base",
|
(char *)"base",
|
||||||
0, 0, -1, -1 );
|
0, 0, -1, -1 );
|
||||||
|
|
||||||
upd ++;
|
++upd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4021,7 +4021,7 @@ void wxWindowGTK::GtkSendPaintEvents()
|
|||||||
(char *)"base",
|
(char *)"base",
|
||||||
0, 0, -1, -1 );
|
0, 0, -1, -1 );
|
||||||
|
|
||||||
upd ++;
|
++upd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user