C/C++ User's Journal STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - where the Standard Template Library meets the Active Template Library COMSTL - where the Standard Template Library meets the Component Object Model
Synesis Software InetSTL - where the Standard Template Library meets the Internet UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page | Modules | Namespace List | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Dev/src/ReclsFileSearch.h

Go to the documentation of this file.
00001 /* ///////////////////////////////////////////////////////////////////////////// 00002 * File: ReclsFileSearch.h 00003 * 00004 * Purpose: Definition of the ReclsFileSearch 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 /* ///////////////////////////////////////////////////////////////////////////// 00049 * Namespace 00050 */ 00051 00052 #if !defined(RECLS_NO_NAMESPACE) 00053 namespace recls 00054 { 00055 #endif /* !RECLS_NO_NAMESPACE */ 00056 00057 /* ///////////////////////////////////////////////////////////////////////////// 00058 * Forward declarations 00059 */ 00060 00061 class ReclsFileSearchDirectoryNode; 00062 00063 /* ///////////////////////////////////////////////////////////////////////////// 00064 * Classes 00065 */ 00066 00067 // class ReclsFileSearch 00071 class ReclsFileSearch 00072 : public ReclsSearch 00073 { 00074 public: 00075 typedef recls_char_t char_type; 00076 typedef ReclsFileSearch class_type; 00077 00078 // Allocation 00079 private: 00080 void *operator new(size_t cb, int cDirParts, size_t cbRootDir); 00081 #ifdef RECLS_COMPILER_SUPPORTS_PLACEMENT_DELETE 00082 void operator delete(void *pv, int cDirParts, size_t cbRootDir); 00083 #endif /* RECLS_COMPILER_SUPPORTS_PLACEMENT_DELETE */ 00084 public: 00085 void operator delete(void *pv); 00086 00087 // Construction 00088 protected: 00089 ReclsFileSearch(int cDirParts 00090 , char_type const *rootDir 00091 , char_type const *pattern 00092 , recls_uint32_t flags); 00093 ~ReclsFileSearch(); 00094 public: 00095 static recls_rc_t FindAndCreate(char_type const *rootDir 00096 , char_type const *pattern 00097 , recls_uint32_t flags 00098 , ReclsFileSearch **ppsi); 00099 00100 // ReclsSearch Methods 00101 public: 00102 /* virtual */ recls_rc_t GetNext(); 00103 /* virtual */ recls_rc_t GetDetails(recls_info_t *pinfo); 00104 /* virtual */ recls_rc_t GetNextDetails(recls_info_t *pinfo); 00105 00106 // Accessors 00107 public: 00108 recls_rc_t GetLastError() const; 00109 00110 // Implementation 00111 private: 00112 char_type const *calc_rootDir_(int cDirParts, char_type const *rootDir); 00113 00114 // Members 00115 private: 00116 recls_uint32_t m_flags; 00117 recls_rc_t m_lastError; 00118 char_type const * const m_rootDir; 00119 ReclsFileSearchDirectoryNode *m_dnode; 00120 00122 recls_byte_t data[1]; 00123 /* 00124 * The data comprises: 00125 * 00126 * - root dir 00127 * 00128 */ 00129 00130 // Not to be implemented 00131 private: 00132 ReclsFileSearch(ReclsFileSearch const &); 00133 ReclsFileSearch &operator =(ReclsFileSearch const &); 00134 }; 00135 00136 /* ///////////////////////////////////////////////////////////////////////////// 00137 * Namespace 00138 */ 00139 00140 #if !defined(RECLS_NO_NAMESPACE) 00141 } /* namespace recls */ 00142 #endif /* !RECLS_NO_NAMESPACE */ 00143 00144 /* ////////////////////////////////////////////////////////////////////////// */

recls Library documentation © Synesis Software Pty Ltd, 2001-2005