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
00043
00044
00045
00046
00047
00048
00049
00050
00051
00056
00057
00058
00059
00060 #ifndef RECLS_INCL_RECLS_STL_HPP_RECLS
00061 # include <recls/stl/recls.hpp>
00062 #endif
00063 #ifndef RECLS_INCL_RECLS_STL_HPP_TRAITS
00064 # include <recls/stl/traits.hpp>
00065 #endif
00066 #ifndef STLSOFT_INCL_H_STLSOFT_NEW_ALLOCATOR
00067 # include <stlsoft_new_allocator.h>
00068 #endif
00069 #ifndef STLSOFT_INCL_H_STLSOFT_PROXY_SEQUENCE
00070 # include <stlsoft_proxy_sequence.h>
00071 #endif
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
00096
00097 #ifdef __STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00098 , typename T = reclstl_traits<C>
00099 , typename A = stlsoft::new_allocator<C>
00100 #else
00101 , typename T
00102 , typename A
00103 #endif
00104 >
00105 class basic_root_sequence
00106 {
00109 public:
00111 typedef C char_type;
00113 typedef T traits_type;
00115 typedef A allocator_type;
00117 typedef basic_root_sequence<C, T, A> class_type;
00119 typedef char_type const *value_type;
00120 private:
00121 struct proxy_traits_type
00122 {
00123 static recls_char_t const *make_value(recls_root_t const &root)
00124 {
00125 return root.name;
00126 }
00127 };
00128
00129 typedef stlsoft::proxy_sequence< const recls_root_t
00130 , recls_char_t const*
00131 , proxy_traits_type
00132 > sequence_type;
00133 public:
00135 typedef typename sequence_type::const_iterator const_iterator;
00137 typedef value_type &reference;
00139 typedef value_type const &const_reference;
00141 typedef size_t size_type;
00143
00146 public:
00148 basic_root_sequence();
00150 ~basic_root_sequence();
00152
00155 public:
00159 const_iterator begin() const;
00163 const_iterator end() const;
00165
00168 public:
00170 size_type size() const;
00172 recls_bool_t empty() const;
00174 static size_type max_size();
00176
00179 private:
00180 recls_root_t *m_roots;
00181 size_type m_cRoots;
00183
00184
00185 private:
00186 basic_root_sequence(class_type const &);
00187 basic_root_sequence const &operator =(class_type const &);
00188 };
00189
00190
00191
00192
00193
00195 typedef basic_root_sequence<recls_char_a_t, reclstl_traits<recls_char_a_t>, stlsoft::new_allocator<recls_char_a_t> > root_sequence_a;
00197 typedef basic_root_sequence<recls_char_w_t, reclstl_traits<recls_char_w_t>, stlsoft::new_allocator<recls_char_w_t> > root_sequence_w;
00199 typedef basic_root_sequence<recls_char_t, reclstl_traits<recls_char_t>, stlsoft::new_allocator<recls_char_t> > root_sequence;
00200
00202
00203
00214 template <typename C, typename T, typename A>
00215 inline recls_bool_t is_empty(basic_root_sequence<C, T, A> const &s)
00216 {
00217 return s.empty();
00218 }
00219
00221
00222
00223 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00224
00225
00226
00227
00228
00229 template <typename C, typename T, typename A>
00230 inline basic_root_sequence<C, T, A>::basic_root_sequence()
00231 #ifdef RECLS_COMPILER_IS_BORLAND
00232 : m_cRoots(26)
00233 #else
00234 : m_cRoots(Recls_GetRoots(NULL, 0))
00235 #endif
00236 {
00237 m_roots = new recls_root_t[m_cRoots];
00238
00239 m_cRoots = Recls_GetRoots(m_roots, m_cRoots);
00240 }
00241
00242 template <typename C, typename T, typename A>
00243 inline basic_root_sequence<C, T, A>::~basic_root_sequence()
00244 {
00245 delete [] m_roots;
00246 }
00247
00248
00249
00250 template <typename C, typename T, typename A>
00251 inline typename basic_root_sequence<C, T, A>::const_iterator basic_root_sequence<C, T, A>::begin() const
00252 {
00253 return const_iterator(&m_roots[0], &m_roots[m_cRoots]);
00254 }
00255
00256 template <typename C, typename T, typename A>
00257 inline typename basic_root_sequence<C, T, A>::const_iterator basic_root_sequence<C, T, A>::end() const
00258 {
00259 return const_iterator();
00260 }
00261
00262
00263
00264 template <typename C, typename T, typename A>
00265 inline typename basic_root_sequence<C, T, A>::size_type basic_root_sequence<C, T, A>::size() const
00266 {
00267 return m_cRoots;
00268 }
00269
00270 template <typename C, typename T, typename A>
00271 inline recls_bool_t basic_root_sequence<C, T, A>::empty() const
00272 {
00273 return 0 == m_cRoots;
00274 }
00275
00276 template <typename C, typename T, typename A>
00277 inline typename basic_root_sequence<C, T, A>::size_type basic_root_sequence<C, T, A>::max_size()
00278 {
00279 return static_cast<size_type>(-1) / sizeof(value_type);
00280 }
00281
00282 #endif
00283
00284
00285
00286
00287
00288 }
00289 #endif
00290
00291
00292
00293
00294
00295