![]() |
![]() |
![]() |
![]() |
||||
![]() |
![]() |
![]() |
![]() |
||||
|
00001 /* ///////////////////////////////////////////////////////////////////////////// 00002 * File: ReclsFileSearch.hpp 00003 * 00004 * Purpose: Definition of the ReclsFileSearch class. 00005 * 00006 * Created: 31st May 2004 00007 * Updated: 3rd October 2006 00008 * 00009 * Home: http://recls.org/ 00010 * 00011 * Copyright (c) 2004-2006, 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 00044 /* ///////////////////////////////////////////////////////////////////////////// 00045 * Includes 00046 */ 00047 00048 #include <recls/recls.h> 00049 #include "ReclsSearch.hpp" 00050 00051 /* ///////////////////////////////////////////////////////////////////////////// 00052 * Namespace 00053 */ 00054 00055 #if !defined(RECLS_NO_NAMESPACE) 00056 namespace recls 00057 { 00058 #endif /* !RECLS_NO_NAMESPACE */ 00059 00060 /* ///////////////////////////////////////////////////////////////////////////// 00061 * Forward declarations 00062 */ 00063 00064 class ReclsFileSearchDirectoryNode; 00065 00066 /* ///////////////////////////////////////////////////////////////////////////// 00067 * Classes 00068 */ 00069 00070 // class ReclsFileSearch 00074 class ReclsFileSearch 00075 : public ReclsSearch 00076 { 00077 public: 00078 typedef ReclsFileSearch class_type; 00079 00080 // Allocation 00081 private: 00082 void *operator new(size_t cb, size_t cDirParts, size_t cbRootDir); 00083 #ifdef RECLS_COMPILER_REQUIRES_MATCHING_PLACEMENT_DELETE 00084 void operator delete(void *pv, size_t cDirParts, size_t cbRootDir); 00085 #endif /* RECLS_COMPILER_REQUIRES_MATCHING_PLACEMENT_DELETE */ 00086 public: 00087 void operator delete(void *pv); 00088 00089 // Construction 00090 protected: 00091 ReclsFileSearch(size_t cDirParts 00092 , recls_char_t const *rootDir 00093 , size_t rootDirLen 00094 , recls_char_t const *pattern 00095 , hrecls_progress_fn_t pfn 00096 , recls_process_fn_param_t param 00097 , recls_uint32_t flags); 00098 ~ReclsFileSearch(); 00099 public: 00100 static recls_rc_t FindAndCreate(recls_char_t const *rootDir 00101 // , size_t rootDirLen 00102 , recls_char_t const *pattern 00103 , recls_uint32_t flags 00104 , hrecls_progress_fn_t pfn 00105 , recls_process_fn_param_t param 00106 , class_type **ppsi); 00107 00108 static recls_rc_t Stat( recls_char_t const *path 00109 , recls_uint32_t flags 00110 , recls_info_t *phEntry); 00111 00112 // Implementation 00113 private: 00114 recls_char_t const *calc_rootDir_(size_t cDirParts, recls_char_t const *rootDir); 00115 00116 // Members 00117 private: 00118 recls_uint32_t m_flags; 00119 recls_char_t const * const m_rootDir; 00120 const size_t m_rootDirLen; 00121 const hrecls_progress_fn_t m_pfn; 00122 const recls_process_fn_param_t m_param; 00123 00125 recls_byte_t data[1]; 00126 /* 00127 * The data comprises: 00128 * 00129 * - root dir 00130 * 00131 */ 00132 00133 // Not to be implemented 00134 private: 00135 ReclsFileSearch(class_type const &); 00136 class_type &operator =(class_type const &); 00137 }; 00138 00139 /* ///////////////////////////////////////////////////////////////////////////// 00140 * Namespace 00141 */ 00142 00143 #if !defined(RECLS_NO_NAMESPACE) 00144 } /* namespace recls */ 00145 #endif /* !RECLS_NO_NAMESPACE */ 00146 00147 /* ////////////////////////////////////////////////////////////////////////// */
|
recls Library documentation © Synesis Software Pty Ltd, 2001-2006 |