Added boolean deleteIfOwning parameter to MakeEmpty().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34643 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b1b74111f5
commit
4c06f2b600
|
@ -159,7 +159,7 @@ public:
|
||||||
T *RemoveItemAt(int32);
|
T *RemoveItemAt(int32);
|
||||||
// returns the removed item
|
// returns the removed item
|
||||||
|
|
||||||
void MakeEmpty();
|
void MakeEmpty(bool deleteIfOwning = true);
|
||||||
|
|
||||||
// item access
|
// item access
|
||||||
T *ItemAt(int32) const;
|
T *ItemAt(int32) const;
|
||||||
|
@ -561,9 +561,9 @@ BObjectList<T>::CountItems() const
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void
|
||||||
BObjectList<T>::MakeEmpty()
|
BObjectList<T>::MakeEmpty(bool deleteIfOwning)
|
||||||
{
|
{
|
||||||
if (owning) {
|
if (owning && deleteIfOwning) {
|
||||||
int32 count = CountItems();
|
int32 count = CountItems();
|
||||||
for (int32 index = 0; index < count; index++)
|
for (int32 index = 0; index < count; index++)
|
||||||
delete ItemAt(index);
|
delete ItemAt(index);
|
||||||
|
|
Loading…
Reference in New Issue