pleyo.com

/src/trunk2/BAL/Interfaces/DeprecatedValueListImpl.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 DeprecatedValueListImpl_h
00027 #define DeprecatedValueListImpl_h
00028 
00029 #include <wtf/RefPtr.h>
00030 
00031 namespace WebCore {
00032 
00033 class DeprecatedValueListImplNode;
00034 
00035 class DeprecatedValueListImplIterator
00036 {
00037 public: 
00038     DeprecatedValueListImplIterator();
00039     
00040     bool operator==(const DeprecatedValueListImplIterator &other);
00041     bool operator!=(const DeprecatedValueListImplIterator &other);
00042 
00043     DeprecatedValueListImplNode *node();
00044     const DeprecatedValueListImplNode *node() const;
00045 
00046     DeprecatedValueListImplIterator& operator++();
00047     DeprecatedValueListImplIterator operator++(int);
00048     DeprecatedValueListImplIterator& operator--();
00049 
00050 private:
00051     DeprecatedValueListImplIterator(const DeprecatedValueListImplNode *n);
00052 
00053     DeprecatedValueListImplNode *nodeImpl;
00054 
00055     friend class DeprecatedValueListImpl;
00056 };
00057 
00058 class DeprecatedValueListImpl 
00059 {
00060 public:
00061     DeprecatedValueListImpl(void (*deleteFunc)(DeprecatedValueListImplNode *), DeprecatedValueListImplNode *(*copyNode)(DeprecatedValueListImplNode *));
00062     ~DeprecatedValueListImpl();
00063     
00064     DeprecatedValueListImpl(const DeprecatedValueListImpl&);
00065     DeprecatedValueListImpl& operator=(const DeprecatedValueListImpl&);
00066         
00067     void clear();
00068     unsigned count() const;
00069     bool isEmpty() const;
00070 
00071     DeprecatedValueListImplIterator appendNode(DeprecatedValueListImplNode *node);
00072     DeprecatedValueListImplIterator prependNode(DeprecatedValueListImplNode *node);
00073     void removeEqualNodes(DeprecatedValueListImplNode *node, bool (*equalFunc)(const DeprecatedValueListImplNode *, const DeprecatedValueListImplNode *));
00074     unsigned containsEqualNodes(DeprecatedValueListImplNode *node, bool (*equalFunc)(const DeprecatedValueListImplNode *, const DeprecatedValueListImplNode *)) const;
00075     
00076     DeprecatedValueListImplIterator findEqualNode(DeprecatedValueListImplNode *node, bool (*equalFunc)(const DeprecatedValueListImplNode *, const DeprecatedValueListImplNode *)) const;
00077 
00078     DeprecatedValueListImplIterator insert(const DeprecatedValueListImplIterator &iterator, DeprecatedValueListImplNode* node);
00079     DeprecatedValueListImplIterator removeIterator(DeprecatedValueListImplIterator &iterator);
00080     DeprecatedValueListImplIterator fromLast();
00081 
00082     DeprecatedValueListImplNode *firstNode();
00083     DeprecatedValueListImplNode *lastNode();
00084 
00085     DeprecatedValueListImplNode *firstNode() const;
00086     DeprecatedValueListImplNode *lastNode() const;
00087 
00088     DeprecatedValueListImplIterator begin();
00089     DeprecatedValueListImplIterator end();
00090 
00091     DeprecatedValueListImplIterator begin() const;
00092     DeprecatedValueListImplIterator end() const;
00093     DeprecatedValueListImplIterator fromLast() const;
00094     
00095     DeprecatedValueListImplNode *nodeAt(unsigned index);
00096     DeprecatedValueListImplNode *nodeAt(unsigned index) const;
00097     
00098     bool isEqual(const DeprecatedValueListImpl &other, bool (*equalFunc)(const DeprecatedValueListImplNode *, const DeprecatedValueListImplNode *)) const;
00099     
00100 private:
00101     void copyOnWrite();
00102 
00103     class Private;
00104 
00105     RefPtr<Private> d;
00106     
00107     friend class DeprecatedValueListImplNode;
00108 };
00109 
00110 class DeprecatedValueListImplNode
00111 {
00112 protected:
00113     DeprecatedValueListImplNode();
00114 
00115 private:
00116     DeprecatedValueListImplNode *prev;
00117     DeprecatedValueListImplNode *next;
00118 
00119     friend class DeprecatedValueListImpl;
00120     friend class DeprecatedValueListImplIterator;
00121     friend class DeprecatedValueListImpl::Private;
00122 };
00123 
00124 inline DeprecatedValueListImplIterator::DeprecatedValueListImplIterator() : 
00125     nodeImpl(NULL)
00126 {
00127 }
00128 
00129 inline bool DeprecatedValueListImplIterator::operator==(const DeprecatedValueListImplIterator &other)
00130 {
00131     return nodeImpl == other.nodeImpl;
00132 }
00133 
00134 inline bool DeprecatedValueListImplIterator::operator!=(const DeprecatedValueListImplIterator &other)
00135 {
00136     return nodeImpl != other.nodeImpl;
00137 }
00138 
00139 inline DeprecatedValueListImplNode *DeprecatedValueListImplIterator::node()
00140 {
00141     return nodeImpl;
00142 }
00143 
00144 inline const DeprecatedValueListImplNode *DeprecatedValueListImplIterator::node() const
00145 {
00146     return nodeImpl;
00147 }
00148 
00149 inline DeprecatedValueListImplIterator& DeprecatedValueListImplIterator::operator++()
00150 {
00151     if (nodeImpl != NULL) {
00152         nodeImpl = nodeImpl->next;
00153     }
00154     return *this;
00155 }
00156 
00157 inline DeprecatedValueListImplIterator DeprecatedValueListImplIterator::operator++(int)
00158 {
00159     DeprecatedValueListImplIterator tmp(*this);
00160 
00161     if (nodeImpl != NULL) {
00162         nodeImpl = nodeImpl->next;
00163     }
00164 
00165     return tmp;
00166 }
00167 
00168 inline DeprecatedValueListImplIterator& DeprecatedValueListImplIterator::operator--()
00169 {
00170     if (nodeImpl != NULL) {
00171         nodeImpl = nodeImpl->prev;
00172     }
00173     return *this;
00174 }
00175 
00176 inline DeprecatedValueListImplIterator::DeprecatedValueListImplIterator(const DeprecatedValueListImplNode *n) :
00177     nodeImpl((DeprecatedValueListImplNode *)n)
00178 {
00179 }
00180 
00181 inline DeprecatedValueListImplNode::DeprecatedValueListImplNode() : 
00182     prev(NULL), 
00183     next(NULL)
00184 {
00185 }
00186 
00187 }
00188 
00189 #endif

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

pleyo.com
pleyo.com