| 1 | /* |
| 2 | * Copyright (C) 2001,2006 Dizzy |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #ifndef INCLUDED_PVPGN_PDIR |
| 19 | #define INCLUDED_PVPGN_PDIRcxx . . $ `src/compat/pdir.h:19:9`! |
| 20 | |
| 21 | #include <string> |
| 22 | #include <stdexcept> |
| 23 | |
| 24 | #ifdef HAVE_DIRENT_Hcxx . . $ `build/config.h:25:9`! |
| 25 | # include <dirent.h> |
| 26 | #else |
| 27 | # ifdef HAVE_SYS_NDIR_H |
| 28 | # include <sys/ndir.h> |
| 29 | # endif |
| 30 | # if HAVE_SYS_DIR_H |
| 31 | # include <sys/dir.h> |
| 32 | # endif |
| 33 | # if HAVE_NDIR_H |
| 34 | # include <ndir.h> |
| 35 | # endif |
| 36 | # define dirent direct |
| 37 | #endif |
| 38 | #ifdef WIN32 |
| 39 | # include <io.h> /* for _findfirst(), _findnext(), etc */ |
| 40 | #endif |
| 41 | |
| 42 | #include <vector> |
| 43 | |
| 44 | namespace pvpgncxx . . $ pvpgn/ |
| 45 | { |
| 46 | |
| 47 | class Directorycxx . . $ pvpgn/Directory# |
| 48 | { |
| 49 | public: |
| 50 | class OpenErrorcxx . . $ pvpgn/Directory#OpenError# : public stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# |
| 51 | { |
| 52 | public: |
| 53 | OpenErrorcxx . . $ pvpgn/Directory#OpenError#OpenError(9c546c94e5fcce4e).(const stdcxx . . $ std/::stringcxx . . $ std/string#& path) |
| 54 | :stdcxx . . $ std/runtime_error#runtime_error(9c546c94e5fcce4e).::runtime_errorcxx . . $ std/runtime_error#("Error opening directory: " +cxx . . $ std/operator+(42c652dfebe55ad7). path) {} |
| 55 | ~cxx . . $ pvpgn/Directory#OpenError#`~OpenError`(ced63f7c635d850d).OpenErrorcxx . . $ pvpgn/Directory#OpenError#() throw() {} |
| 56 | }; |
| 57 | |
| 58 | explicit Directorycxx . . $ pvpgn/Directory#Directory(a3b17e0268c60856).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fname, bool lazyread = false); |
| 59 | ~cxx . . $ pvpgn/Directory#`~Directory`(ced63f7c635d850d).Directorycxx . . $ pvpgn/Directory#() throw(); |
| 60 | void rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 61 | char const * readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).() const; |
| 62 | void opencxx . . $ pvpgn/Directory#open(a3b17e0268c60856).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fname, bool lazyread = false); |
| 63 | operatorcxx . . $ pvpgn/Directory#`operator bool`(50ce9a9e25b4a850). bool() const; |
| 64 | |
| 65 | private: |
| 66 | stdcxx . . $ std/::stringcxx . . $ std/string# pathcxx . . $ pvpgn/Directory#path.; |
| 67 | bool lazyreadcxx . . $ pvpgn/Directory#lazyread.; |
| 68 | #ifdef WIN32 |
| 69 | long lFindHandle; |
| 70 | mutable struct _finddata_t fileinfo; |
| 71 | mutable int status; /* -1 == failure, 0 == freshly opened, 1 == opened and read, 2 == eof */ |
| 72 | #else /* POSIX */ |
| 73 | DIR * dircxx . . $ pvpgn/Directory#dir.; |
| 74 | #endif |
| 75 | |
| 76 | /* do not allow copying for the time being */ |
| 77 | Directorycxx . . $ pvpgn/Directory#Directory(fea760b00598a694).(const Directorycxx . . $ pvpgn/Directory#&); |
| 78 | Directorycxx . . $ pvpgn/Directory#& operatorcxx . . $ pvpgn/Directory#`operator=`(ba2fd75f87efd5bd).=(const Directorycxx . . $ pvpgn/Directory#&); |
| 79 | void closecxx . . $ pvpgn/Directory#close(49f6e7a06ebc5aa8).(); |
| 80 | |
| 81 | }; |
| 82 | |
| 83 | extern stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> dir_getfilescxx . . $ pvpgn/dir_getfiles(aac66aa6092d8307).(const char * directory, const char* ext, bool recursive); |
| 84 | |
| 85 | } |
| 86 | |
| 87 | #endif |
| 88 |