зеркало из https://github.com/mozilla/gecko-dev.git
added enumerate methods
This commit is contained in:
Родитель
0e1e2f78b2
Коммит
79851b1d53
|
@ -170,3 +170,26 @@ void nsVoidArray::Compact()
|
|||
mArraySize = count;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsVoidArray::EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (++index < mCount)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
PRBool nsVoidArray::EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
PRInt32 index = mCount;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (0 <= --index)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
#include "nscore.h"
|
||||
|
||||
// Enumerator callback function. Return PR_FALSE to stop
|
||||
typedef PRBool (*nsVoidArrayEnumFunc)(void* aElement, void *aData);
|
||||
|
||||
/// A basic zero-based array of void*'s that manages its own memory
|
||||
class NS_BASE nsVoidArray {
|
||||
public:
|
||||
|
@ -51,6 +54,9 @@ public:
|
|||
|
||||
void Compact();
|
||||
|
||||
PRBool EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData);
|
||||
PRBool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData);
|
||||
|
||||
protected:
|
||||
void** mArray;
|
||||
PRInt32 mArraySize;
|
||||
|
|
|
@ -170,3 +170,26 @@ void nsVoidArray::Compact()
|
|||
mArraySize = count;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsVoidArray::EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (++index < mCount)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
PRBool nsVoidArray::EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
PRInt32 index = mCount;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (0 <= --index)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
#include "nscore.h"
|
||||
|
||||
// Enumerator callback function. Return PR_FALSE to stop
|
||||
typedef PRBool (*nsVoidArrayEnumFunc)(void* aElement, void *aData);
|
||||
|
||||
/// A basic zero-based array of void*'s that manages its own memory
|
||||
class NS_BASE nsVoidArray {
|
||||
public:
|
||||
|
@ -51,6 +54,9 @@ public:
|
|||
|
||||
void Compact();
|
||||
|
||||
PRBool EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData);
|
||||
PRBool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData);
|
||||
|
||||
protected:
|
||||
void** mArray;
|
||||
PRInt32 mArraySize;
|
||||
|
|
|
@ -170,3 +170,26 @@ void nsVoidArray::Compact()
|
|||
mArraySize = count;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsVoidArray::EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
PRInt32 index = -1;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (++index < mCount)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
PRBool nsVoidArray::EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
PRInt32 index = mCount;
|
||||
PRBool running = PR_TRUE;
|
||||
|
||||
while (running && (0 <= --index)) {
|
||||
running = (*aFunc)(mArray[index], aData);
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
#include "nscore.h"
|
||||
|
||||
// Enumerator callback function. Return PR_FALSE to stop
|
||||
typedef PRBool (*nsVoidArrayEnumFunc)(void* aElement, void *aData);
|
||||
|
||||
/// A basic zero-based array of void*'s that manages its own memory
|
||||
class NS_BASE nsVoidArray {
|
||||
public:
|
||||
|
@ -51,6 +54,9 @@ public:
|
|||
|
||||
void Compact();
|
||||
|
||||
PRBool EnumerateForwards(nsVoidArrayEnumFunc aFunc, void* aData);
|
||||
PRBool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData);
|
||||
|
||||
protected:
|
||||
void** mArray;
|
||||
PRInt32 mArraySize;
|
||||
|
|
Загрузка…
Ссылка в новой задаче