reference_list.h
00001 // -*- c-basic-offset: 2 -*- 00002 /* 00003 * This file is part of the KDE libraries 00004 * Copyright (C) 2003 Apple Computer, Inc 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #ifndef _KJS_REFERENCE_LIST_H_ 00024 #define _KJS_REFERENCE_LIST_H_ 00025 00026 #include "types.h" 00027 #include "reference.h" 00028 00029 namespace KJS { 00030 00031 class ReferenceListNode; 00032 class ReferenceListHeadNode; 00033 00037 class KJS_EXPORT ReferenceListIterator { 00038 friend class ReferenceList; 00039 00040 public: 00041 bool operator!=(const ReferenceListIterator &it) const; 00042 const Reference *operator->() const; 00043 const Reference &operator++(int i); 00044 00045 private: 00046 ReferenceListIterator(ReferenceListNode *n); 00047 ReferenceListIterator(); 00048 ReferenceListNode *node; 00049 }; 00050 00054 class KJS_EXPORT ReferenceList { 00055 public: 00056 ReferenceList(); 00057 ReferenceList(const ReferenceList &list); 00058 ReferenceList &operator=(const ReferenceList &list); 00059 ~ReferenceList(); 00060 00061 void append(const Reference& val); 00062 int length(); 00063 00064 ReferenceListIterator begin() const; 00065 ReferenceListIterator end() const; 00066 00067 private: 00068 void swap(ReferenceList &list); 00069 ReferenceListHeadNode *head; 00070 ReferenceListNode *tail; 00071 }; 00072 00073 } 00074 00075 #endif