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
00076
00077
00078
00079
00080 #ifndef RECLS_INCL_H_RECLSTL
00081 # include "reclstl.h"
00082 #endif
00083 #ifndef RECLS_INCL_H_RECLS_ASSERT
00084 # include <recls_assert.h>
00085 #endif
00086 #ifndef _STLSOFT_INCL_H_STLSOFT_ITERATOR
00087 # include <stlsoft_iterator.h>
00088 #endif
00089 #ifndef _STLSOFT_INCL_H_STLSOFT_PROXY_SEQUENCE
00090 # include <stlsoft_proxy_sequence.h>
00091 #endif
00092
00093
00094
00095
00096
00097 #if !defined(RECLS_NO_NAMESPACE)
00098 namespace recls
00099 {
00100
00101 namespace stl
00102 {
00103 #endif
00104
00105
00106
00107
00108
00112 template <typename C>
00113 struct reclstl_traits
00114 {
00115 public:
00120 typedef void char_type;
00125 typedef void *entry_type;
00126
00127 public:
00129 static hrecls_t Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags);
00130
00132 static recls_rc_t GetDetails(hrecls_t hSrch, entry_type *pinfo);
00134 static recls_rc_t GetNextDetails(hrecls_t hSrch, entry_type *pinfo);
00135
00137 static void CloseDetails(entry_type fileInfo);
00139 static entry_type CopyDetails(entry_type fileInfo);
00140
00142 static char_type *str_copy(char_type *, char_type const *);
00143 };
00144
00145 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00146 template <>
00147 struct reclstl_traits<recls_char_a_t>
00148 {
00149 public:
00150 typedef reclstl_traits<recls_char_a_t> traits_type;
00151 typedef recls_char_a_t char_type;
00152 typedef recls_info_t entry_type;
00153 typedef recls_strptrs_t strptrs_type;
00154 typedef recls_strptrsptrs_t strptrsptrs_type;
00155
00157 typedef stlsoft::proxy_sequence< const strptrs_type
00158 , string_t
00159 , traits_type
00160 > directory_parts_type;
00161
00165 static string_t make_value(strptrs_type const &ptrs)
00166 {
00167 return string_t(ptrs.begin, ptrs.end);
00168 }
00169
00170 public:
00171 static hrecls_t Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags)
00172 {
00173 hrecls_t hSrch;
00174 recls_rc_t rc = Recls_Search(searchRoot, pattern, flags, &hSrch);
00175
00176 return RECLS_SUCCEEDED(rc) ? hSrch : static_cast<hrecls_t>(NULL);
00177 }
00178
00179 static recls_rc_t GetDetails(hrecls_t hSrch, entry_type *pinfo)
00180 {
00181 return Recls_GetDetails(hSrch, pinfo);
00182 }
00183
00184 static recls_rc_t GetNextDetails(hrecls_t hSrch, entry_type *pinfo)
00185 {
00186 return Recls_GetNextDetails(hSrch, pinfo);
00187 }
00188
00189 static void CloseDetails(entry_type fileInfo)
00190 {
00191 Recls_CloseDetails(fileInfo);
00192 }
00193 static entry_type CopyDetails(entry_type fileInfo)
00194 {
00195 entry_type infoCopy;
00196
00197 return RECLS_SUCCEEDED(Recls_CopyDetails(fileInfo, &infoCopy)) ? infoCopy : static_cast<entry_type>(NULL);
00198 }
00199
00200 static char_type *str_copy(char_type *dest, char_type const *src)
00201 {
00202 return strcpy(dest, src);
00203 }
00204 };
00205 #endif
00206
00207
00208
00209
00210
00211 }
00212 #endif
00213
00214
00215
00216
00217
00218