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
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00075
00076
00077
00078
00079 #ifndef RECLS_INCL_H_RECLSTL
00080 # include "reclstl.h"
00081 #endif
00082 #ifndef RECLS_INCL_H_RECLSTL_TRAITS
00083 # include "reclstl_traits.h"
00084 #endif
00085 #ifndef _STLSOFT_INCL_H_STLSOFT_NEW_ALLOCATOR
00086 # include <stlsoft_new_allocator.h>
00087 #endif
00088
00089
00090
00091
00092
00093 #if !defined(RECLS_NO_NAMESPACE)
00094 namespace recls
00095 {
00096
00097 namespace stl
00098 {
00099 #endif
00100
00101
00102
00103
00104
00105
00112
00113 #ifdef __STLSOFT_CF_TEMPLATE_CLASS_DEFAULT_CLASS_ARGUMENT_SUPPORT
00114 , typename T = reclstl_traits<C>
00115 , typename A = stlsoft::new_allocator<C>
00116 #else
00117 , typename T
00118 , typename A
00119 #endif
00120 >
00121 class basic_root_sequence
00122 {
00125 public:
00127 typedef C char_type;
00129 typedef T traits_type;
00131 typedef A allocator_type;
00133 typedef basic_root_sequence<C, T, A> class_type;
00135 typedef char_type const *value_type;
00136 private:
00137 struct proxy_traits_type
00138 {
00139 static recls_char_t const *make_value(recls_root_t const &root)
00140 {
00141 return root.name;
00142 }
00143 };
00144
00145 typedef stlsoft::proxy_sequence< const recls_root_t
00146 , recls_char_t const*
00147 , proxy_traits_type
00148 > sequence_type;
00149 public:
00151 typedef typename sequence_type::const_iterator const_iterator;
00153 typedef value_type &reference;
00155 typedef value_type const &const_reference;
00157 typedef size_t size_type;
00159
00162 public:
00164 basic_root_sequence();
00166 ~basic_root_sequence();
00168
00171 public:
00175 const_iterator begin() const;
00179 const_iterator end() const;
00181
00184 public:
00186 size_type size() const;
00188 recls_bool_t empty() const;
00190 static size_type max_size();
00192
00195 private:
00196 recls_root_t *m_roots;
00197 size_type m_cRoots;
00199
00200
00201 private:
00202 basic_root_sequence(class_type const &);
00203 basic_root_sequence const &operator =(class_type const &);
00204 };
00205
00206
00207
00208
00209
00211 typedef basic_root_sequence<recls_char_a_t, reclstl_traits<recls_char_a_t>, stlsoft::new_allocator<recls_char_a_t> > root_sequence_a;
00213 typedef basic_root_sequence<recls_char_w_t, reclstl_traits<recls_char_w_t>, stlsoft::new_allocator<recls_char_w_t> > root_sequence_w;
00215 typedef basic_root_sequence<recls_char_t, reclstl_traits<recls_char_t>, stlsoft::new_allocator<recls_char_t> > root_sequence;
00216
00218
00219
00230 template <typename C, typename T, typename A>
00231 inline recls_bool_t is_empty(basic_root_sequence<C, T, A> const &s)
00232 {
00233 return s.empty();
00234 }
00235
00237
00238
00239 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00240
00241
00242
00243
00244
00245 template <typename C, typename T, typename A>
00246 inline basic_root_sequence<C, T, A>::basic_root_sequence()
00247 #ifdef RECLS_COMPILER_IS_BORLAND
00248 : m_cRoots(26)
00249 #else
00250 : m_cRoots(Recls_GetRoots(NULL, 0))
00251 #endif
00252 {
00253 m_roots = new recls_root_t[m_cRoots];
00254
00255 m_cRoots = Recls_GetRoots(m_roots, m_cRoots);
00256 }
00257
00258 template <typename C, typename T, typename A>
00259 inline basic_root_sequence<C, T, A>::~basic_root_sequence()
00260 {
00261 delete [] m_roots;
00262 }
00263
00264
00265
00266 template <typename C, typename T, typename A>
00267 inline typename basic_root_sequence<C, T, A>::const_iterator basic_root_sequence<C, T, A>::begin() const
00268 {
00269 return sequence_type(&m_roots[0], &m_roots[m_cRoots]).begin();
00270 }
00271
00272 template <typename C, typename T, typename A>
00273 inline typename basic_root_sequence<C, T, A>::const_iterator basic_root_sequence<C, T, A>::end() const
00274 {
00275 return sequence_type(&m_roots[0], &m_roots[m_cRoots]).end();
00276 }
00277
00278
00279
00280 template <typename C, typename T, typename A>
00281 inline typename basic_root_sequence<C, T, A>::size_type basic_root_sequence<C, T, A>::size() const
00282 {
00283 return m_cRoots;
00284 }
00285
00286 template <typename C, typename T, typename A>
00287 inline recls_bool_t basic_root_sequence<C, T, A>::empty() const
00288 {
00289 return 0 == m_cRoots;
00290 }
00291
00292 template <typename C, typename T, typename A>
00293 inline typename basic_root_sequence<C, T, A>::size_type basic_root_sequence<C, T, A>::max_size()
00294 {
00295 return static_cast<size_type>(-1) / sizeof(value_type);
00296 }
00297
00298 #endif
00299
00300
00301
00302
00303
00304 }
00305 #endif
00306
00307
00308
00309
00310
00311