]>
Commit | Line | Data |
---|---|---|
b24c88b3 RC |
1 | /* |
2 | * Copyright (c) 2001, Robert Collins. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by Robert Collins <rbtcollins@hotmail.com> | |
13 | * | |
14 | */ | |
15 | ||
c93bc6d0 MB |
16 | #ifndef SETUP_IO_STREAM_CYGFILE_H |
17 | #define SETUP_IO_STREAM_CYGFILE_H | |
b24c88b3 | 18 | |
3c054baf | 19 | #include "io_stream.h" |
a3a02820 | 20 | |
b24c88b3 RC |
21 | |
22 | /* io_stream on disk files using cygwin paths | |
23 | * and potentially understanding links in the future | |
24 | */ | |
25 | ||
ef3be327 | 26 | extern int cygmkdir_p (path_type_t isadir, const std::string& path, mode_t mode); |
b24c88b3 RC |
27 | |
28 | class io_stream_cygfile:public io_stream | |
29 | { | |
30 | public: | |
a3a02820 MB |
31 | static int exists (const std::string& ); |
32 | static int remove (const std::string& ); | |
33 | static int mklink (const std::string& , const std::string& , io_stream_link_t); | |
26922cd2 | 34 | io_stream_cygfile (const std::string&, const std::string&, mode_t); |
7c7034e8 | 35 | virtual ~ io_stream_cygfile (); |
b24c88b3 RC |
36 | /* read data (duh!) */ |
37 | virtual ssize_t read (void *buffer, size_t len); | |
38 | /* provide data to (double duh!) */ | |
ca9506cc | 39 | virtual ssize_t write (const void *buffer, size_t len); |
b24c88b3 RC |
40 | /* read data without removing it from the class's internal buffer */ |
41 | virtual ssize_t peek (void *buffer, size_t len); | |
44d31ea0 CV |
42 | virtual off_t tell (); |
43 | virtual off_t seek (off_t where, io_stream_seek_t whence); | |
b24c88b3 RC |
44 | /* can't guess, oh well */ |
45 | virtual int error (); | |
26922cd2 | 46 | virtual int set_mtime (time_t); |
b24c88b3 | 47 | /* not relevant yet */ |
b41c2908 CV |
48 | virtual time_t get_mtime () { return 0; }; |
49 | virtual mode_t get_mode () { return 0; }; | |
341988b9 | 50 | virtual size_t get_size (); |
a3a02820 | 51 | static int move (const std::string& ,const std::string& ); |
b24c88b3 RC |
52 | private: |
53 | /* always require parameters */ | |
7c7034e8 | 54 | io_stream_cygfile () |
b24c88b3 RC |
55 | { |
56 | }; | |
b41c2908 | 57 | friend int cygmkdir_p (path_type_t isadir, const std::string& _name, mode_t mode); |
a3a02820 | 58 | static std::string normalise (const std::string& unixpath); |
b24c88b3 RC |
59 | FILE *fp; |
60 | int lasterr; | |
a3a02820 | 61 | std::string fname; |
2f0315ad CV |
62 | wchar_t *wname; |
63 | wchar_t *w_str (); | |
b6dab3ea | 64 | int compact_os_algorithm; |
a3a02820 | 65 | static std::string cwd; |
b6dab3ea | 66 | static bool compact_os_is_available; |
b24c88b3 RC |
67 | }; |
68 | ||
c93bc6d0 | 69 | #endif /* SETUP_IO_STREAM_CYGFILE_H */ |