![]() |
![]() |
![]() |
![]() |
||||
![]() |
![]() |
![]() |
![]() |
||||
|
00001 /* ///////////////////////////////////////////////////////////////////////////// 00002 * File: ReclsFtpSearch.h 00003 * 00004 * Purpose: Definition of the ReclsFtpSearch class. 00005 * 00006 * Created: 31st May 2004 00007 * Updated: 10th January 2005 00008 * 00009 * Home: http://recls.org/ 00010 * 00011 * Copyright 2004-2005, Matthew Wilson and Synesis Software 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are met: 00016 * 00017 * - Redistributions of source code must retain the above copyright notice, this 00018 * list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00023 * any contributors may be used to endorse or promote products derived from 00024 * this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * ////////////////////////////////////////////////////////////////////////// */ 00039 00040 00041 /* ///////////////////////////////////////////////////////////////////////////// 00042 * Includes 00043 */ 00044 00045 #include "recls.h" 00046 #include "recls_internal.h" 00047 00048 #include <inetstl.h> 00049 00050 /* ///////////////////////////////////////////////////////////////////////////// 00051 * Namespace 00052 */ 00053 00054 #if !defined(RECLS_NO_NAMESPACE) 00055 namespace recls 00056 { 00057 #endif /* !RECLS_NO_NAMESPACE */ 00058 00059 /* ///////////////////////////////////////////////////////////////////////////// 00060 * Forward declarations 00061 */ 00062 00063 class ReclsFtpSearchDirectoryNode; 00064 00065 /* ///////////////////////////////////////////////////////////////////////////// 00066 * Classes 00067 */ 00068 00069 // class ReclsFtpSearch 00073 class ReclsFtpSearch 00074 : public ReclsSearch 00075 { 00076 public: 00077 typedef recls_char_t char_type; 00078 typedef ReclsFtpSearch class_type; 00079 00080 // Allocation 00081 private: 00082 void *operator new(size_t cb, int cDirParts, size_t cbRootDir); 00083 #ifdef RECLS_COMPILER_SUPPORTS_PLACEMENT_DELETE 00084 void operator delete(void *pv, int cDirParts, size_t cbRootDir); 00085 #endif /* RECLS_COMPILER_SUPPORTS_PLACEMENT_DELETE */ 00086 public: 00087 void operator delete(void *pv); 00088 00089 // Construction 00090 protected: 00091 ReclsFtpSearch( HINTERNET hSess 00092 , HINTERNET hConn 00093 , int cDirParts 00094 , char_type const *rootDir 00095 , char_type const *pattern 00096 , recls_uint32_t flags); 00097 ~ReclsFtpSearch(); 00098 public: 00099 static recls_rc_t FindAndCreate(char_type const *host 00100 , char_type const *username 00101 , char_type const *password 00102 , char_type const *rootDir 00103 , char_type const *pattern 00104 , recls_uint32_t flags 00105 , ReclsFtpSearch **ppsi); 00106 00107 // ReclsSearch Methods 00108 public: 00109 /* virtual */ recls_rc_t GetNext(); 00110 /* virtual */ recls_rc_t GetDetails(recls_info_t *pinfo); 00111 /* virtual */ recls_rc_t GetNextDetails(recls_info_t *pinfo); 00112 00113 // Accessors 00114 public: 00115 recls_rc_t GetLastError() const; 00116 00117 // Implementation 00118 private: 00119 char_type const *calc_rootDir_(int cDirParts, char_type const *rootDir); 00120 00121 // Members 00122 private: 00123 HINTERNET const m_session; 00124 HINTERNET const m_connection; 00125 recls_uint32_t m_flags; 00126 recls_rc_t m_lastError; 00127 char_type const * const m_rootDir; 00128 ReclsFtpSearchDirectoryNode *m_dnode; 00129 00131 recls_byte_t data[1]; 00132 /* 00133 * The data comprises: 00134 * 00135 * - root dir 00136 * 00137 */ 00138 00139 // Not to be implemented 00140 private: 00141 ReclsFtpSearch(ReclsFtpSearch const &); 00142 ReclsFtpSearch &operator =(ReclsFtpSearch const &); 00143 }; 00144 00145 /* ///////////////////////////////////////////////////////////////////////////// 00146 * Namespace 00147 */ 00148 00149 #if !defined(RECLS_NO_NAMESPACE) 00150 } /* namespace recls */ 00151 #endif /* !RECLS_NO_NAMESPACE */ 00152 00153 /* ////////////////////////////////////////////////////////////////////////// */
|
recls Library documentation © Synesis Software Pty Ltd, 2001-2005 |