96 lines
4.2 KiB
C++
96 lines
4.2 KiB
C++
|
|
/***************************************************************************
|
|
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
|
Business Machines Corporation and Siemens Rolm Communications Inc.
|
|
|
|
For purposes of this license notice, the term Licensors shall mean,
|
|
collectively, Apple Computer, Inc., AT&T Corp., International
|
|
Business Machines Corporation and Siemens Rolm Communications Inc.
|
|
The term Licensor shall mean any of the Licensors.
|
|
|
|
Subject to acceptance of the following conditions, permission is hereby
|
|
granted by Licensors without the need for written agreement and without
|
|
license or royalty fees, to use, copy, modify and distribute this
|
|
software for any purpose.
|
|
|
|
The above copyright notice and the following four paragraphs must be
|
|
reproduced in all copies of this software and any software including
|
|
this software.
|
|
|
|
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
|
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
|
MODIFICATIONS.
|
|
|
|
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
|
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
|
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
DAMAGE.
|
|
|
|
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
|
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
PURPOSE.
|
|
|
|
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
|
disclosure by the government are subject to restrictions set forth in
|
|
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
|
|
|
***************************************************************************/
|
|
|
|
// Class List
|
|
|
|
#ifndef __CLIST_H__
|
|
#define __CLIST_H__
|
|
|
|
#include "vcenv.h"
|
|
|
|
class CListElement
|
|
{
|
|
public:
|
|
CListElement *m_prev;
|
|
CListElement *m_next;
|
|
void *m_item;
|
|
CListElement();
|
|
~CListElement();
|
|
};
|
|
|
|
typedef CListElement *CLISTPOSITION;
|
|
typedef int (*CListSearchFunc)(void *item, void *context);
|
|
|
|
class CList
|
|
{
|
|
protected:
|
|
CListElement *m_head;
|
|
CListElement *m_tail;
|
|
U32 m_count;
|
|
public:
|
|
void *GetHead(void);
|
|
void *GetTail(void);
|
|
CListElement *GetHeadPosition(void);
|
|
CListElement *GetTailPosition(void);
|
|
CListElement *Find( void * );
|
|
CListElement *Search(CListSearchFunc compare, void *context);
|
|
void *GetNext(CLISTPOSITION& );
|
|
void *GetPrev(CLISTPOSITION& );
|
|
void RemoveAt( CListElement * );
|
|
void RemoveNoDel( CListElement * );
|
|
void RemoveAll(void);
|
|
void *GetAt( CListElement * );
|
|
void InsertAfter( CListElement *, CListElement * );
|
|
CListElement *InsertAfter( CListElement *, void * );
|
|
void InsertBefore( CListElement *, CListElement * );
|
|
CListElement *InsertBefore( CListElement *, void * );
|
|
void InsertAtTail( CListElement * );
|
|
void InsertAtHead( CListElement * );
|
|
CListElement *AddTail( void * );
|
|
CListElement *AddHead( void * );
|
|
void MoveToTail( CListElement * );
|
|
void MoveToHead( CListElement * );
|
|
S32 GetCount(void);
|
|
U32 IsEmpty(void);
|
|
CList();
|
|
~CList();
|
|
};
|
|
|
|
#endif
|