|
reSIProcate/rutil
9694
|
00001 #ifndef RESIP_FileSystem_hxx 00002 #define RESIP_FileSystem_hxx 00003 00004 #include "rutil/Data.hxx" 00005 00006 #if !defined(WIN32) 00007 #include <sys/types.h> 00008 #include <sys/uio.h> 00009 #include <sys/fcntl.h> 00010 #include <unistd.h> 00011 #include <dirent.h> 00012 #else 00013 #include "rutil/Socket.hxx" 00014 #endif 00015 00016 00017 namespace resip 00018 { 00019 00024 class FileSystem 00025 { 00026 public: 00027 class Directory 00028 { 00029 public: 00030 typedef Data value_type; 00031 typedef value_type* pointer; 00032 typedef const value_type* const_pointer; 00033 typedef value_type& reference; 00034 typedef const value_type& const_reference; 00035 00036 Directory(const Data& path); 00037 00038 class iterator 00039 { 00040 public: 00041 iterator(const Directory& dir); 00042 iterator(); 00043 ~iterator(); 00044 00045 iterator& operator++(); 00046 bool operator!=(const iterator& rhs) const; 00047 bool operator==(const iterator& rhs) const; 00048 const Data& operator*() const; 00049 const Data* operator->() const; 00050 private: 00051 #ifdef WIN32 00052 HANDLE mWinSearch; 00053 #else 00054 DIR* mNixDir; 00055 struct dirent* mDirent; 00056 #endif 00057 Data mFile; 00058 }; 00059 00060 iterator begin() const; 00061 iterator end() const; 00062 const Data& getPath() const { return mPath; } 00063 private: 00064 Data mPath; 00065 }; 00066 }; 00067 00068 } 00069 00070 #endif 00071 00072 /* ==================================================================== 00073 * The Vovida Software License, Version 1.0 00074 * 00075 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00076 * 00077 * Redistribution and use in source and binary forms, with or without 00078 * modification, are permitted provided that the following conditions 00079 * are met: 00080 * 00081 * 1. Redistributions of source code must retain the above copyright 00082 * notice, this list of conditions and the following disclaimer. 00083 * 00084 * 2. Redistributions in binary form must reproduce the above copyright 00085 * notice, this list of conditions and the following disclaimer in 00086 * the documentation and/or other materials provided with the 00087 * distribution. 00088 * 00089 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00090 * and "Vovida Open Communication Application Library (VOCAL)" must 00091 * not be used to endorse or promote products derived from this 00092 * software without prior written permission. For written 00093 * permission, please contact vocal@vovida.org. 00094 * 00095 * 4. Products derived from this software may not be called "VOCAL", nor 00096 * may "VOCAL" appear in their name, without prior written 00097 * permission of Vovida Networks, Inc. 00098 * 00099 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00100 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00101 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00102 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00103 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00104 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00105 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00106 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00107 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00108 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00109 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00110 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00111 * DAMAGE. 00112 * 00113 * ==================================================================== 00114 * 00115 * This software consists of voluntary contributions made by Vovida 00116 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00117 * Inc. For more information on Vovida Networks, Inc., please see 00118 * <http://www.vovida.org/>. 00119 * 00120 */
1.7.5.1