annotate src/wadlist.cc @ 111:51d5549a1bdc

Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 15:23:36 +0300
parents a68786b9c74b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
2 * wadlist.cc - Wad_list class
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
3 * AYM 2001-09-23
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 /*
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 This file is part of Yadex.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 Yadex incorporates code from DEU 5.21 that was put in the public domain in
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 1994 by Raphaël Quinet and Brendon Wyber.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 The rest of Yadex is Copyright © 1997-2003 André Majorel and others.and others.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 This program is free software; you can redistribute it and/or modify it under
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 the terms of the GNU General Public License as published by the Free Software
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 Foundation; either version 2 of the License, or (at your option) any later
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 version.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 This program is distributed in the hope that it will be useful, but WITHOUT
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 You should have received a copy of the GNU General Public License along with
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 Place, Suite 330, Boston, MA 02111-1307, USA.
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 */
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #include "yadex.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #include "wadfile.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 #include "wadlist.h"
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #include <list>
111
51d5549a1bdc Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
34 #include <memory>
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
37 Wad_list wad_list; // One global instance
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
111
51d5549a1bdc Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
40 typedef std::list < std::shared_ptr < Wad_file > >list_t;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 class Wad_list_priv
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
45 public: Wad_list_priv();
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 list_t list;
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
47 mutable list_t::iterator iter; // Current element
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
48 mutable bool rewound; // If true, next get() will return head
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 };
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
52 Wad_list_priv::Wad_list_priv()
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
54 rewound = true;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
59 * Wad_list::Wad_list - default ctor
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
61 Wad_list::Wad_list()
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
63 priv = new Wad_list_priv;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
68 * Wad_list::~Wad_list - dtor
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
70 Wad_list::~Wad_list()
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
72 delete priv;
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
73 priv = 0; // Catch bugs
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
78 * Wad_list::rewind - arrange so that the next get() will return head
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
80 void Wad_list::rewind() const
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
82 priv->rewound = true;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
87 * Wad_list::get - retrieve the next wad from the list
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 *
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
89 * If get() was not called since the last call to rewind(),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
90 * the first wad is returned. Otherwise, the wad returned
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
91 * is the one that follows the one returned by the previous
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
92 * call to get().
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 *
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
94 * Return false if already at the end of the list, true
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
95 * otherwise.
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
97 bool Wad_list::get(Wad_file * &wf)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
99 if (priv->rewound)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
100 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
101 priv->iter = priv->list.begin();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
102 priv->rewound = false;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
103 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
104 else
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
105 ++priv->iter;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
107 if (priv->iter == priv->list.end())
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
108 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
109 wf = 0;
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
110 return false;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
111 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
113 wf = priv->iter->get();
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
114 return true;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
118 bool Wad_list::get(const Wad_file * &wf) const
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
120 if (priv->rewound)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
121 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
122 priv->iter = priv->list.begin();
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
123 priv->rewound = false;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
124 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
125 else
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
126 ++priv->iter;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
128 if (priv->iter == priv->list.end())
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
129 return false;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
131 wf = priv->iter->get();
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
132 return true;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
137 * Wad_list::insert - insert a new wad at the pointer
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
139 void Wad_list::insert(Wad_file * wf)
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 {
111
51d5549a1bdc Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents: 33
diff changeset
141 priv->list.insert(priv->iter, std::shared_ptr < Wad_file > (wf));
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 }
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 /*
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
146 * Wad_list::del - delete from the list the wad under the pointer
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 *
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
148 * If get() was not called since the last call to rewind(),
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
149 * the first wad is deleted. Otherwise, the wad deleted is
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
150 * the one returned by the last call to get().
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 *
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
152 * After a call to del(), a call to get will return the wad
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
153 * the followed the one that was deleted.
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 *
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
155 * If already at the end of the list, nf_bug() is called.
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 */
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
157 void Wad_list::del()
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 {
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
159 list_t::iterator i;
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
161 if (priv->rewound)
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
162 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
163 i = priv->list.begin();
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
164 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
165 else
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
166 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
167 i = priv->iter;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
168 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
169 if (i == priv->list.end())
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
170 {
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
171 nf_bug("Wad_list::del: attempt to delete last item");
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
172 return;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
173 }
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
174 priv->iter = priv->list.erase(i);
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
175 if (priv->iter == priv->list.begin())
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
176 {
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
177 // priv->iter = 0; // Catch bugs
33
a68786b9c74b Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents: 25
diff changeset
178 priv->rewound = true;
25
8eaf72e2041b Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
179 }
0
241c93442be0 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 }