BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstp_slistbase.h
Go to the documentation of this file.
1/// @file bslstp_slistbase.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstp_slistbase.h -*-C++-*-
8#ifndef INCLUDED_BSLSTP_SLISTBASE
9#define INCLUDED_BSLSTP_SLISTBASE
10
11/// @defgroup bslstp_slistbase bslstp_slistbase
12/// @brief Provide facility for STLPort implementation.
13/// @addtogroup bsl
14/// @{
15/// @addtogroup bslstp
16/// @{
17/// @addtogroup bslstp_slistbase
18/// @{
19///
20/// <h1> Outline </h1>
21/// * <a href="#bslstp_slistbase-purpose"> Purpose</a>
22/// * <a href="#bslstp_slistbase-classes"> Classes </a>
23/// * <a href="#bslstp_slistbase-description"> Description </a>
24///
25/// # Purpose {#bslstp_slistbase-purpose}
26/// Provide facility for STLPort implementation.
27///
28/// @deprecated Do not use directly.
29///
30/// # Classes {#bslstp_slistbase-classes}
31///
32///
33/// @see bslstp_slist
34///
35/// # Description {#bslstp_slistbase-description}
36/// This component is for internal use only.
37///
38/// Note that the functions in this component are based on STLPort's
39/// implementation, with copyright notice as follows:
40/// @code
41//*
42/ *
43/ * Copyright (c) 1996,1997
44/ * Silicon Graphics Computer Systems, Inc.
45/ *
46/ * Copyright (c) 1997
47/ * Moscow Center for SPARC Technology
48/ *
49/ * Copyright (c) 1999
50/ * Boris Fomitchev
51/ *
52/ * This material is provided "as is", with absolutely no warranty expressed
53/ * or implied. Any use is at your own risk.
54/ *
55/ * Permission to use or copy this software for any purpose is hereby granted
56/ * without fee, provided the above notices are retained on all copies.
57/ * Permission to modify the code and to distribute modified code is granted,
58/ * provided the above notices are retained, and a notice that the code was
59/ * modified is included with the above copyright notice.
60/ *
61/ */
62/// @endcode
63///
64/// /Usage
65/// /-----
66/// This component is for internal use only.
67/// @}
68/** @} */
69/** @} */
70
71/** @addtogroup bsl
72 * @{
73 */
74/** @addtogroup bslstp
75 * @{
76 */
77/** @addtogroup bslstp_slistbase
78 * @{
79 */
80
81#ifdef BDE_OPENSOURCE_PUBLICATION // STP
82#error "bslstp_slistbase is not for publication"
83#endif
84
85#include <cstddef> // for std::size_t
86
87namespace bsl {
88
93
94inline
96 _Slist_node_base *__new_node)
97{
98 __new_node->_M_next = __prev_node->_M_next;
99 __prev_node->_M_next = __new_node;
100 return __new_node;
101}
102
103
104template <class _Dummy>
106public:
107 // those used to be global functions
108 // moved here to reduce code bloat without templatizing _Slist_iterator_base
109 static std::size_t size(_Slist_node_base* __node);
111 static void __splice_after(_Slist_node_base *__pos,
112 _Slist_node_base *__before_first,
113 _Slist_node_base *__before_last);
114
115 static void __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head);
116
118 const _Slist_node_base *__node);
119 static const _Slist_node_base* __previous(const _Slist_node_base *__head,
120 const _Slist_node_base *__node) {
121 return _Sl_global<_Dummy>::__previous(const_cast<_Slist_node_base*>(__head), __node);
122 }
123};
124
126
127} // close namespace bsl
128
129// BEGIN FORMER CONTENTS OF bslstp_slistbase.c
130/*
131 *
132 *
133 * Copyright (c) 1994
134 * Hewlett-Packard Company
135 *
136 * Copyright (c) 1996,1997
137 * Silicon Graphics Computer Systems, Inc.
138 *
139 * Copyright (c) 1997
140 * Moscow Center for SPARC Technology
141 *
142 * Copyright (c) 1999
143 * Boris Fomitchev
144 *
145 * This material is provided "as is", with absolutely no warranty expressed
146 * or implied. Any use is at your own risk.
147 *
148 * Permission to use or copy this software for any purpose is hereby granted
149 * without fee, provided the above notices are retained on all copies.
150 * Permission to modify the code and to distribute modified code is granted,
151 * provided the above notices are retained, and a notice that the code was
152 * modified is included with the above copyright notice.
153 *
154 */
155
156// #ifndef INCLUDED_BSLSTP_STL_SLIST_BASE
157// # include <bslstp_stl_slist_base.h>
158// #endif
159
160namespace bsl {
161
162
163template <class _Dummy>
164_Slist_node_base*
166 const _Slist_node_base *__node)
167{
168 while (__head && __head->_M_next != __node)
169 __head = __head->_M_next;
170 return __head;
171}
172
173template <class _Dummy>
174void
176{
177 _Slist_node_base* __before_last = __previous(__head, 0);
178 if (__before_last != __head) {
179 _Slist_node_base* __after = __pos->_M_next;
180 __pos->_M_next = __head->_M_next;
181 __head->_M_next = 0;
182 __before_last->_M_next = __after;
183 }
184}
185
186template <class _Dummy>
187void
189 _Slist_node_base *__before_first,
190 _Slist_node_base *__before_last)
191{
192 if (__pos != __before_first && __pos != __before_last) {
193 _Slist_node_base* __first = __before_first->_M_next;
194 _Slist_node_base* __after = __pos->_M_next;
195 __before_first->_M_next = __before_last->_M_next;
196 __pos->_M_next = __first;
197 __before_last->_M_next = __after;
198 }
199}
200
201template <class _Dummy>
204{
205 _Slist_node_base* __result = __node;
206 __node = __node->_M_next;
207 __result->_M_next = 0;
208 while(__node) {
209 _Slist_node_base* __next = __node->_M_next;
210 __node->_M_next = __result;
211 __result = __node;
212 __node = __next;
213 }
214 return __result;
215}
216
217template <class _Dummy>
218std::size_t
220{
221 size_t __result = 0;
222 for ( ; __node != 0; __node = __node->_M_next)
223 ++__result;
224 return __result;
225}
226
227
228} // close namespace bsl
229
230
231// Local Variables:
232// mode:C++
233// End:
234// END FORMER CONTENTS OF bslstp_slistbase.c
235
236#endif /* INCLUDED_BSLSTP_SLISTBASE */
237
238// Local Variables:
239// mode:C++
240// End:
241
242/** @} */
243/** @} */
244/** @} */
Definition bslstp_slistbase.h:105
static void __splice_after(_Slist_node_base *__pos, _Slist_node_base *__before_first, _Slist_node_base *__before_last)
Definition bslstp_slistbase.h:188
static std::size_t size(_Slist_node_base *__node)
Definition bslstp_slistbase.h:219
static _Slist_node_base * __previous(_Slist_node_base *__head, const _Slist_node_base *__node)
Definition bslstp_slistbase.h:165
static const _Slist_node_base * __previous(const _Slist_node_base *__head, const _Slist_node_base *__node)
Definition bslstp_slistbase.h:119
static _Slist_node_base * __reverse(_Slist_node_base *__node)
Definition bslstp_slistbase.h:203
Definition bdlb_printmethods.h:283
_Sl_global< bool > _Sl_global_inst
Definition bslstp_slistbase.h:125
_Slist_node_base * __slist_make_link(_Slist_node_base *__prev_node, _Slist_node_base *__new_node)
Definition bslstp_slistbase.h:95
Definition bslstp_slistbase.h:90
_Slist_node_base * _M_next
Definition bslstp_slistbase.h:91