00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef RECLS_INCL_RECLSTL_STL_HPP_ROOT_SEQUENCE
00043 #define RECLS_INCL_RECLSTL_STL_HPP_ROOT_SEQUENCE
00044
00045 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00046 # define RECLS_VER_RECLSTL_STL_HPP_ROOT_SEQUENCE_MAJOR 3
00047 # define RECLS_VER_RECLSTL_STL_HPP_ROOT_SEQUENCE_MINOR 1
00048 # define RECLS_VER_RECLSTL_STL_HPP_ROOT_SEQUENCE_REVISION 3
00049 # define RECLS_VER_RECLSTL_STL_HPP_ROOT_SEQUENCE_EDIT 17
00050 #endif
00051
00060
00061
00062
00063
00064 #ifndef RECLS_INCL_RECLS_STL_HPP_RECLS
00065 # include <recls/stl/recls.hpp>
00066 #endif
00067 #ifndef RECLS_INCL_RECLS_STL_HPP_TRAITS
00068 # include <recls/stl/traits.hpp>
00069 #endif
00070 #include <stlsoft/memory/new_allocator.hpp>
00071 #include <stlsoft/obsolete/proxy_sequence.hpp>
00072
00073
00074
00075
00076
00077 #if !defined(RECLS_NO_NAMESPACE)
00078 namespace recls
00079 {
00080
00081 namespace stl
00082 {
00083 #endif
00084
00085
00086
00087
00088
00089
00104 template< typename C
00105 #ifdef STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00106 , typename T = reclstl_traits<C>
00107 , typename A = stlsoft::new_allocator<C>
00108 #else
00109 , typename T
00110 , typename A
00111 #endif
00112 >
00113 class basic_root_sequence
00114 {
00117 public:
00119 typedef C char_type;
00121 typedef T traits_type;
00123 typedef A allocator_type;
00125 typedef basic_root_sequence<C, T, A> class_type;
00127 typedef char_type const *value_type;
00128 private:
00129 struct proxy_traits_type
00130 {
00131 static recls_char_t const *make_value(recls_root_t const &root)
00132 {
00133 return root.name;
00134 }
00135 };
00136
00137 typedef stlsoft::proxy_sequence< const recls_root_t
00138 , recls_char_t const*
00139 , proxy_traits_type
00140 > sequence_type;
00141 public:
00143 typedef typename sequence_type::const_iterator const_iterator;
00145 typedef value_type &reference;
00147 typedef value_type const &const_reference;
00149 typedef size_t size_type;
00151
00154 public:
00157 basic_root_sequence();
00160 basic_root_sequence(unsigned flags);
00162 ~basic_root_sequence();
00164
00167 public:
00171 const_iterator begin() const;
00175 const_iterator end() const;
00177
00180 public:
00182 size_type size() const;
00184 recls_bool_t empty() const;
00186 static size_type max_size();
00188
00191 private:
00192 recls_root_t *m_roots;
00193 size_type m_cRoots;
00195
00196
00197 private:
00198 basic_root_sequence(class_type const &);
00199 basic_root_sequence const &operator =(class_type const &);
00200 };
00201
00202
00203
00204
00205
00207 typedef basic_root_sequence<recls_char_a_t, reclstl_traits<recls_char_a_t>, stlsoft::new_allocator<recls_char_a_t> > root_sequence_a;
00209 typedef basic_root_sequence<recls_char_w_t, reclstl_traits<recls_char_w_t>, stlsoft::new_allocator<recls_char_w_t> > root_sequence_w;
00211 typedef basic_root_sequence<recls_char_t, reclstl_traits<recls_char_t>, stlsoft::new_allocator<recls_char_t> > root_sequence;
00212
00214
00215
00226 template <typename C, typename T, typename A>
00227 inline recls_bool_t is_empty(basic_root_sequence<C, T, A> const &s)
00228 {
00229 return s.empty();
00230 }
00231
00233
00234
00235 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00236
00237
00238
00239
00240
00241 template <typename C, typename T, typename A>
00242 inline basic_root_sequence<C, T, A>::basic_root_sequence()
00243 #ifdef RECLS_COMPILER_IS_BORLAND
00244 : m_cRoots(26)
00245 #else
00246 : m_cRoots(Recls_GetRoots(NULL, 0))
00247 #endif
00248 {
00249 m_roots = new recls_root_t[m_cRoots];
00250
00251 m_cRoots = Recls_GetRoots(m_roots, m_cRoots);
00252 }
00253
00254 template <typename C, typename T, typename A>
00255 inline basic_root_sequence<C, T, A>::basic_root_sequence(unsigned flags)
00256 #ifdef RECLS_COMPILER_IS_BORLAND
00257 : m_cRoots(26)
00258 #else
00259 : m_cRoots(Recls_GetSelectedRoots(NULL, 0, flags))
00260 #endif
00261 {
00262 m_roots = new recls_root_t[m_cRoots];
00263
00264 m_cRoots = Recls_GetSelectedRoots(m_roots, m_cRoots, flags);
00265 }
00266
00267 template <typename C, typename T, typename A>
00268 inline basic_root_sequence<C, T, A>::~basic_root_sequence()
00269 {
00270 delete [] m_roots;
00271 }
00272
00273
00274
00275 template <typename C, typename T, typename A>
00276 inline typename basic_root_sequence<C, T, A>::const_iterator basic_root_sequence<C, T, A>::begin() const
00277 {
00278 return const_iterator(&m_roots[0], &m_roots[0] + m_cRoots);
00279 }
00280
00281 template <typename C, typename T, typename A>
00282 inline typename basic_root_sequence<C, T, A>::const_iterator basic_root_sequence<C, T, A>::end() const
00283 {
00284 return const_iterator();
00285 }
00286
00287
00288
00289 template <typename C, typename T, typename A>
00290 inline typename basic_root_sequence<C, T, A>::size_type basic_root_sequence<C, T, A>::size() const
00291 {
00292 return m_cRoots;
00293 }
00294
00295 template <typename C, typename T, typename A>
00296 inline recls_bool_t basic_root_sequence<C, T, A>::empty() const
00297 {
00298 return 0 == m_cRoots;
00299 }
00300
00301 template <typename C, typename T, typename A>
00302 inline typename basic_root_sequence<C, T, A>::size_type basic_root_sequence<C, T, A>::max_size()
00303 {
00304 return static_cast<size_type>(-1) / sizeof(value_type);
00305 }
00306
00307 #endif
00308
00309
00310
00311 #if !defined(RECLS_NO_NAMESPACE)
00312 }
00313 }
00314 #endif
00315
00316
00317
00318 #endif
00319
00320