pleyo.com

/src/trunk2/BAL/Interfaces/DeprecatedPtrListImpl.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  * 1. Redistributions of source code must retain the above copyright
00008  *    notice, this list of conditions and the following disclaimer.
00009  * 2. Redistributions in binary form must reproduce the above copyright
00010  *    notice, this list of conditions and the following disclaimer in the
00011  *    documentation and/or other materials provided with the distribution.
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00014  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00017  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00018  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00019  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00020  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00021  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00023  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00024  */
00025 
00026 #ifndef DeprecatedPtrListImpl_h
00027 #define DeprecatedPtrListImpl_h
00028 
00029 namespace WebCore {
00030 
00031 class DeprecatedListNode;
00032 class DeprecatedPtrListImplIterator;
00033 
00034 class DeprecatedPtrListImpl
00035 {
00036 public:
00037     
00038     DeprecatedPtrListImpl(void (*deleteFunc)(void *));
00039     DeprecatedPtrListImpl(const DeprecatedPtrListImpl &impl);
00040     ~DeprecatedPtrListImpl();
00041      
00042     bool isEmpty() const { return nodeCount == 0; }
00043     unsigned count() const { return nodeCount; }
00044     void clear(bool deleteItems);
00045 
00046     void *at(unsigned n);
00047 
00048     bool insert(unsigned n, const void *item);
00049     bool remove(bool deleteItem);
00050     bool remove(unsigned n, bool deleteItem);
00051     bool removeFirst(bool deleteItem);
00052     bool removeLast(bool deleteItem);
00053     bool removeRef(const void *item, bool deleteItem);
00054 
00055     void *getFirst() const;
00056     void *getLast() const;
00057     void *getNext() const;
00058     void *getPrev() const;
00059     void *current() const;
00060     void *first();
00061     void *last();
00062     void *next();
00063     void *prev();
00064     void *take(unsigned n);
00065     void *take();
00066 
00067     void append(const void *item);
00068     void prepend(const void *item);
00069 
00070     unsigned containsRef(const void *item) const;
00071     int findRef(const void *item);
00072 
00073     DeprecatedPtrListImpl &assign(const DeprecatedPtrListImpl &impl, bool deleteItems);
00074 
00075  private:
00076     DeprecatedPtrListImpl &operator =(const DeprecatedPtrListImpl &impl);
00077 
00078     void swap(DeprecatedPtrListImpl &impl);
00079 
00080     void addIterator(DeprecatedPtrListImplIterator *iter) const;
00081     void removeIterator(DeprecatedPtrListImplIterator *iter) const;
00082 
00083     DeprecatedListNode *head;
00084     DeprecatedListNode *tail;
00085     DeprecatedListNode *cur;
00086     unsigned nodeCount;
00087     void (*deleteItem)(void *);
00088     mutable DeprecatedPtrListImplIterator *iterators;
00089 
00090     friend class DeprecatedPtrListImplIterator;
00091 };
00092 
00093 
00094 class DeprecatedPtrListImplIterator {
00095 public:
00096     DeprecatedPtrListImplIterator();
00097     DeprecatedPtrListImplIterator(const DeprecatedPtrListImpl &impl);
00098     ~DeprecatedPtrListImplIterator();
00099 
00100     DeprecatedPtrListImplIterator(const DeprecatedPtrListImplIterator &impl);
00101     DeprecatedPtrListImplIterator &operator=(const DeprecatedPtrListImplIterator &impl);
00102 
00103     unsigned count() const;
00104     void *toFirst();
00105     void *toLast();
00106     void *current() const;
00107 
00108     void *operator--();
00109     void *operator++();
00110 
00111 private:
00112     const DeprecatedPtrListImpl *list;
00113     DeprecatedListNode *node;
00114     DeprecatedPtrListImplIterator *next;
00115     DeprecatedPtrListImplIterator *prev;
00116 
00117     friend class DeprecatedPtrListImpl;
00118 };
00119 
00120 }
00121 
00122 #endif

Generated on Wed Nov 21 20:04:16 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com