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 #ifndef RECLS_INCL_RECLSTL_STL_HPP_TRAITS
00042 #define RECLS_INCL_RECLSTL_STL_HPP_TRAITS
00043
00044 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00045 # define RECLS_VER_RECLSTL_STL_HPP_TRAITS_MAJOR 4
00046 # define RECLS_VER_RECLSTL_STL_HPP_TRAITS_MINOR 0
00047 # define RECLS_VER_RECLSTL_STL_HPP_TRAITS_REVISION 3
00048 # define RECLS_VER_RECLSTL_STL_HPP_TRAITS_EDIT 17
00049 #endif
00050
00059
00060
00061
00062
00063 #ifndef RECLS_INCL_RECLS_STL_HPP_RECLS
00064 # include <recls/stl/recls.hpp>
00065 #endif
00066 #ifndef RECLS_INCL_H_RECLS_ASSERT
00067 # include <recls/assert.h>
00068 #endif
00069 #include <stlsoft/obsolete/proxy_sequence.hpp>
00070
00071
00072
00073
00074
00075 #if !defined(RECLS_NO_NAMESPACE)
00076 namespace recls
00077 {
00078
00079 namespace stl
00080 {
00081 #endif
00082
00083
00084
00085
00086
00090 template <typename C>
00091 struct reclstl_traits
00092 {
00093 public:
00098 typedef void char_type;
00103 typedef void *entry_type;
00104
00105 public:
00106 #if defined(RECLS_API_FTP)
00108 static recls_rc_t SearchFtp(char_type const *host, char_type const *username, char_type const *password, char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags, hrecls_t *phSrch);
00109 #endif
00110
00112 static recls_rc_t Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags, hrecls_t *phSrch);
00113
00115 static recls_rc_t GetDetails(hrecls_t hSrch, entry_type *pinfo);
00117 static recls_rc_t GetNextDetails(hrecls_t hSrch, entry_type *pinfo);
00118
00120 static void CloseDetails(entry_type fileInfo);
00122 static entry_type CopyDetails(entry_type fileInfo);
00123
00125 static char_type *str_copy(char_type *, char_type const *);
00126 };
00127
00128 #ifndef RECLS_DOCUMENTATION_SKIP_SECTION
00129
00130 # ifdef RECLS_CHAR_TYPE_IS_CHAR
00131
00132 template <>
00133 struct reclstl_traits<recls_char_a_t>
00134 {
00135 public:
00136 typedef reclstl_traits<recls_char_a_t> traits_type;
00137 typedef recls_char_a_t char_type;
00138 typedef recls_info_t entry_type;
00139 typedef recls_strptrs_t strptrs_type;
00140 typedef recls_strptrsptrs_t strptrsptrs_type;
00141
00143 typedef stlsoft::proxy_sequence< const strptrs_type
00144 , string_t
00145 , traits_type
00146 > directory_parts_type;
00147
00151 static string_t make_value(strptrs_type const &ptrs)
00152 {
00153 return string_t(ptrs.begin, ptrs.end);
00154 }
00155
00156 public:
00157 #if defined(RECLS_API_FTP)
00158 static recls_rc_t SearchFtp(char_type const *host, char_type const *username, char_type const *password, char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags, hrecls_t *phSrch)
00159 {
00160 return Recls_SearchFtp(host, username, password, searchRoot, pattern, flags, phSrch);
00161 }
00162 #endif
00163
00164 static recls_rc_t Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags, hrecls_t *phSrch)
00165 {
00166 return Recls_Search(searchRoot, pattern, flags, phSrch);
00167 }
00168
00169 static recls_rc_t GetDetails(hrecls_t hSrch, entry_type *pinfo)
00170 {
00171 return Recls_GetDetails(hSrch, pinfo);
00172 }
00173
00174 static recls_rc_t GetNextDetails(hrecls_t hSrch, entry_type *pinfo)
00175 {
00176 return Recls_GetNextDetails(hSrch, pinfo);
00177 }
00178
00179 static void CloseDetails(entry_type fileInfo)
00180 {
00181 Recls_CloseDetails(fileInfo);
00182 }
00183 static entry_type CopyDetails(entry_type fileInfo)
00184 {
00185 entry_type infoCopy;
00186
00187 return RECLS_SUCCEEDED(Recls_CopyDetails(fileInfo, &infoCopy)) ? infoCopy : static_cast<entry_type>(NULL);
00188 }
00189
00190 static char_type *str_copy(char_type *dest, char_type const *src)
00191 {
00192 return ::strcpy(dest, src);
00193 }
00194 };
00195
00196 # elif defined(RECLS_CHAR_TYPE_IS_WCHAR)
00197
00198 template <>
00199 struct reclstl_traits<recls_char_w_t>
00200 {
00201 public:
00202 typedef reclstl_traits<recls_char_w_t> traits_type;
00203 typedef recls_char_w_t char_type;
00204 typedef recls_info_t entry_type;
00205 typedef recls_strptrs_t strptrs_type;
00206 typedef recls_strptrsptrs_t strptrsptrs_type;
00207
00209 typedef stlsoft::proxy_sequence< const strptrs_type
00210 , string_t
00211 , traits_type
00212 > directory_parts_type;
00213
00217 static string_t make_value(strptrs_type const &ptrs)
00218 {
00219 return string_t(ptrs.begin, ptrs.end);
00220 }
00221
00222 public:
00223 #if defined(RECLS_API_FTP)
00224 static recls_rc_t SearchFtp(char_type const *host, char_type const *username, char_type const *password, char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags, hrecls_t *phSrch)
00225 {
00226 return Recls_SearchFtp(host, username, password, searchRoot, pattern, flags, phSrch);
00227 }
00228 #endif
00229
00230 static recls_rc_t Search(char_type const *searchRoot, char_type const *pattern, recls_uint32_t flags, hrecls_t *phSrch)
00231 {
00232 return Recls_Search(searchRoot, pattern, flags, phSrch);
00233 }
00234
00235 static recls_rc_t GetDetails(hrecls_t hSrch, entry_type *pinfo)
00236 {
00237 return Recls_GetDetails(hSrch, pinfo);
00238 }
00239
00240 static recls_rc_t GetNextDetails(hrecls_t hSrch, entry_type *pinfo)
00241 {
00242 return Recls_GetNextDetails(hSrch, pinfo);
00243 }
00244
00245 static void CloseDetails(entry_type fileInfo)
00246 {
00247 Recls_CloseDetails(fileInfo);
00248 }
00249 static entry_type CopyDetails(entry_type fileInfo)
00250 {
00251 entry_type infoCopy;
00252
00253 return RECLS_SUCCEEDED(Recls_CopyDetails(fileInfo, &infoCopy)) ? infoCopy : static_cast<entry_type>(NULL);
00254 }
00255
00256 static char_type *str_copy(char_type *dest, char_type const *src)
00257 {
00258 return wcscpy(dest, src);
00259 }
00260 };
00261
00262 # else
00263
00264 # error Neither RECLS_CHAR_TYPE_IS_WCHAR nor RECLS_CHAR_TYPE_IS_CHAR are defined
00265
00266 # endif
00267
00268
00269 #endif
00270
00271
00272
00273 #if !defined(RECLS_NO_NAMESPACE)
00274 }
00275 }
00276 #endif
00277
00278
00279
00280 #endif
00281
00282