Implement getPrimitiveForTag.
1 /* vim: set ts=4 sw=4 tw=99 et:
3 * Copyright (C) 2004-2012 David Anderson
5 * This file is part of SourcePawn.
7 * SourcePawn is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 3 of the License, or (at your option)
12 * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with
17 * SourcePawn. If not, see http://www.gnu.org/licenses/.
19 #ifndef _include_ke_inline_list_h_
20 #define _include_ke_inline_list_h_
26 template <typename T> class InlineList;
31 friend class InlineList<T>;
40 InlineListNode(InlineListNode *next, InlineListNode *prev)
47 InlineListNode *next_;
48 InlineListNode *prev_;
54 typedef InlineListNode<T> Node;
60 : head_(&head_, &head_)
67 friend class InlineList;
76 iterator & operator++() {
80 iterator operator ++(int) {
86 return static_cast<T *>(iter_);
89 return static_cast<T *>(iter_);
91 bool operator !=(const iterator &where) const {
92 return iter_ != where.iter_;
94 bool operator ==(const iterator &where) const {
95 return iter_ == where.iter_;
97 iterator prev() const {
98 return iterator(iter_->prev_);
100 iterator next() const {
101 return iterator(iter_->next_);
106 return iterator(head_.next_);
109 return iterator(&head_);
111 void append(Node *t) {
112 t->prev_ = head_.prev_;
114 head_.prev_->next_ = t;
117 iterator erase(iterator i) {
122 void remove(Node *t) {
123 t->prev_->next_ = t->next_;
124 t->next_->prev_ = t->prev_;
130 #endif // _include_ke_inline_list_h_