This commit is contained in:
rickg%netscape.com 1998-08-05 01:59:34 +00:00
Родитель 86ea166dba
Коммит 3d3143056b
4 изменённых файлов: 168 добавлений и 10 удалений

Просмотреть файл

@ -139,6 +139,22 @@ void* nsDeque::Pop() {
return result;
}
/**
* This method gets called you want to peek at the topmost
* member without removing it.
*
* @update gess4/18/98
* @param nada
* @return last item in container
*/
void* nsDeque::Peek() {
void* result=0;
if(mSize>0) {
result=mData[mOrigin];
}
return result;
}
/**
* Remove and return the last item in the container.
*
@ -219,7 +235,25 @@ nsDequeIterator nsDeque::End(void) const{
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
const void nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
int i=0;
for(i=0;i<mSize;i++){
void* obj=ObjectAt(i);
obj=aFunctor(obj);
}
}
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code. Iteration continues until your
* functor returns a non-null.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDeque::FirstThat(nsDequeFunctor& aFunctor) const{
int i=0;
for(i=0;i<mSize;i++){
void* obj=ObjectAt(i);
@ -230,6 +264,7 @@ const void* nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
return 0;
}
/******************************************************
* Here comes the nsDequeIterator class...
******************************************************/
@ -378,10 +413,22 @@ void* nsDequeIterator::GetCurrent(void) {
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDequeIterator::ForEach(nsDequeFunctor& aFunctor) const{
return mDeque.ForEach(aFunctor);
const void nsDequeIterator::ForEach(nsDequeFunctor& aFunctor) const{
mDeque.ForEach(aFunctor);
}
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDequeIterator::FirstThat(nsDequeFunctor& aFunctor) const{
return mDeque.FirstThat(aFunctor);
}
/**
* conduct automated self test for this class

Просмотреть файл

@ -103,6 +103,15 @@ friend class nsDequeIterator;
*/
void* Pop(void);
/**
* Return topmost item without removing it.
*
* @update gess4/18/98
* @param none
* @return ptr to first item in container
*/
void* Peek(void);
/**
* Remove and return the last item in the container.
*
@ -157,7 +166,19 @@ friend class nsDequeIterator;
* @param aFunctor object to call for each member
* @return *this
*/
const void* ForEach(nsDequeFunctor& aFunctor) const;
const void ForEach(nsDequeFunctor& aFunctor) const;
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code. This process will interupt if
* your function returns a null to this iterator.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* FirstThat(nsDequeFunctor& aFunctor) const;
/**
* Perform automated selftest on the deque
@ -346,7 +367,18 @@ public:
* @param aFunctor object to call for each member
* @return *this
*/
const void* ForEach(nsDequeFunctor& aFunctor) const;
const void ForEach(nsDequeFunctor& aFunctor) const;
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* FirstThat(nsDequeFunctor& aFunctor) const;
protected:
PRInt32 mIndex;

Просмотреть файл

@ -139,6 +139,22 @@ void* nsDeque::Pop() {
return result;
}
/**
* This method gets called you want to peek at the topmost
* member without removing it.
*
* @update gess4/18/98
* @param nada
* @return last item in container
*/
void* nsDeque::Peek() {
void* result=0;
if(mSize>0) {
result=mData[mOrigin];
}
return result;
}
/**
* Remove and return the last item in the container.
*
@ -219,7 +235,25 @@ nsDequeIterator nsDeque::End(void) const{
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
const void nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
int i=0;
for(i=0;i<mSize;i++){
void* obj=ObjectAt(i);
obj=aFunctor(obj);
}
}
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code. Iteration continues until your
* functor returns a non-null.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDeque::FirstThat(nsDequeFunctor& aFunctor) const{
int i=0;
for(i=0;i<mSize;i++){
void* obj=ObjectAt(i);
@ -230,6 +264,7 @@ const void* nsDeque::ForEach(nsDequeFunctor& aFunctor) const{
return 0;
}
/******************************************************
* Here comes the nsDequeIterator class...
******************************************************/
@ -378,10 +413,22 @@ void* nsDequeIterator::GetCurrent(void) {
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDequeIterator::ForEach(nsDequeFunctor& aFunctor) const{
return mDeque.ForEach(aFunctor);
const void nsDequeIterator::ForEach(nsDequeFunctor& aFunctor) const{
mDeque.ForEach(aFunctor);
}
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* nsDequeIterator::FirstThat(nsDequeFunctor& aFunctor) const{
return mDeque.FirstThat(aFunctor);
}
/**
* conduct automated self test for this class

Просмотреть файл

@ -103,6 +103,15 @@ friend class nsDequeIterator;
*/
void* Pop(void);
/**
* Return topmost item without removing it.
*
* @update gess4/18/98
* @param none
* @return ptr to first item in container
*/
void* Peek(void);
/**
* Remove and return the last item in the container.
*
@ -157,7 +166,19 @@ friend class nsDequeIterator;
* @param aFunctor object to call for each member
* @return *this
*/
const void* ForEach(nsDequeFunctor& aFunctor) const;
const void ForEach(nsDequeFunctor& aFunctor) const;
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code. This process will interupt if
* your function returns a null to this iterator.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* FirstThat(nsDequeFunctor& aFunctor) const;
/**
* Perform automated selftest on the deque
@ -346,7 +367,18 @@ public:
* @param aFunctor object to call for each member
* @return *this
*/
const void* ForEach(nsDequeFunctor& aFunctor) const;
const void ForEach(nsDequeFunctor& aFunctor) const;
/**
* Call this method when you wanto to iterate all the
* members of the container, passing a functor along
* to call your code.
*
* @update gess4/20/98
* @param aFunctor object to call for each member
* @return *this
*/
const void* FirstThat(nsDequeFunctor& aFunctor) const;
protected:
PRInt32 mIndex;