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
00044
00045
00046
00047
00048
00049 #include <recls/recls.h>
00050 #include "recls_string.h"
00051 #include "recls_util.h"
00052
00053
00054 #include <stlsoft/stlsoft.h>
00055 #if !defined(_STLSOFT_VER_1_9_1) || \
00056 _STLSOFT_VER < _STLSOFT_VER_1_9_1
00057 # error Requires STLSoft 1.9.1, or later. (www.stlsoft.org/downloads.html)
00058 #endif
00059
00060
00061 #include <inetstl/inetstl.h>
00062 #include <inetstl/filesystem/filesystem_traits.hpp>
00063 #include <inetstl/filesystem/findfile_sequence.hpp>
00064
00065
00066 #if defined(RECLS_COMPILER_IS_MSVC) && \
00067 _MSC_VER >= 1310
00068 # include <vector>
00069 #else
00070 # include <list>
00071 #endif
00072
00073
00074
00075
00076
00077 #if !defined(RECLS_NO_NAMESPACE)
00078 namespace recls
00079 {
00080 #endif
00081
00082 inetstl_ns_using(basic_findfile_sequence)
00083
00084
00085
00086
00087
00088 class ReclsFtpSearchDirectoryNode
00089 : public ReclsSearchDirectoryNode
00090 {
00091 public:
00092 typedef ReclsFtpSearchDirectoryNode class_type;
00093 typedef inetstl_ns_qual(filesystem_traits)<recls_char_t> traits_type;
00094 private:
00095 typedef RECLS_STRING_TEMPLATE_1(recls_char_t) string_type;
00096 typedef basic_findfile_sequence<recls_char_t, traits_type> file_find_sequence_type;
00097 #if defined(RECLS_COMPILER_IS_MSVC) && \
00098 _MSC_VER >= 1310
00099 typedef stlsoft_ns_qual_std(vector)<string_type> directory_sequence_type;
00100 #else
00101 typedef stlsoft_ns_qual_std(list)<string_type> directory_sequence_type;
00102 #endif
00103 #ifdef _RECLS_USING_INETSTL_SEARCHSPEC_SEQUENCE
00104 typedef inetstl_ns_qual(searchspec_sequence)<file_find_sequence_type> entry_sequence_type;
00105 #else
00106 typedef file_find_sequence_type entry_sequence_type;
00107 #endif
00108
00109
00110 protected:
00111 ReclsFtpSearchDirectoryNode(HINTERNET connection, recls_uint32_t flags, recls_char_t const *rootDir, recls_char_t const *pattern);
00112 public:
00113 virtual ~ReclsFtpSearchDirectoryNode();
00114
00115 static class_type *FindAndCreate(HINTERNET connection, recls_uint32_t flags, recls_char_t const *rootDir, recls_char_t const *pattern);
00116
00117
00118 public:
00119 recls_rc_t GetNext();
00120 recls_rc_t GetDetails(recls_info_t *pinfo);
00121 recls_rc_t GetNextDetails(recls_info_t *pinfo);
00122
00123
00124 private:
00125 recls_rc_t Initialise();
00126
00127 #ifdef RECLS_ENFORCING_CONTRACTS
00128 recls_bool_t is_valid() const;
00129 #endif
00130
00131 static directory_sequence_type::const_iterator select_iter_if_( unsigned long b
00132 , directory_sequence_type::const_iterator trueVal
00133 , directory_sequence_type::const_iterator falseVal);
00134 static int essFlags_from_reclsFlags_(recls_uint32_t flags);
00135
00136
00137 private:
00138 static directory_sequence_type init_directories_(HINTERNET connection, recls_char_t const *rootDir, recls_uint32_t flags);
00139
00140
00141 private:
00142 HINTERNET m_connection;
00143 recls_info_t m_current;
00144 class_type *m_dnode;
00145 recls_uint32_t const m_flags;
00146 string_type m_rootDir;
00147 string_type m_pattern;
00148 directory_sequence_type m_directories;
00149 directory_sequence_type::const_iterator m_directoriesBegin;
00150 entry_sequence_type m_entries;
00151 entry_sequence_type::const_iterator m_entriesBegin;
00152
00153
00154 private:
00155 ReclsFtpSearchDirectoryNode(class_type const &);
00156 class_type &operator =(class_type const &);
00157 };
00158
00159
00160
00161
00162
00163 #if !defined(RECLS_NO_NAMESPACE)
00164 }
00165 #endif
00166
00167