]> cygwin.com Git - cygwin-apps/setup.git/blob - io_stream_cygfile.h
Merged across diffs between setup_crypto_branch_branchpoint and
[cygwin-apps/setup.git] / io_stream_cygfile.h
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
16 #ifndef SETUP_IO_STREAM_CYGFILE_H
17 #define SETUP_IO_STREAM_CYGFILE_H
18
19 #include "io_stream.h"
20
21
22 /* io_stream on disk files using cygwin paths
23 * and potentially understanding links in the future
24 */
25
26 extern int cygmkdir_p (path_type_t isadir, const std::string& path);
27
28 class io_stream_cygfile:public io_stream
29 {
30 public:
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);
34 io_stream_cygfile (const std::string& , const std::string& );
35 virtual ~ io_stream_cygfile ();
36 /* read data (duh!) */
37 virtual ssize_t read (void *buffer, size_t len);
38 /* provide data to (double duh!) */
39 virtual ssize_t write (const void *buffer, size_t len);
40 /* read data without removing it from the class's internal buffer */
41 virtual ssize_t peek (void *buffer, size_t len);
42 virtual long tell ();
43 virtual int seek (long where, io_stream_seek_t whence);
44 /* can't guess, oh well */
45 virtual int error ();
46 virtual int set_mtime (int);
47 /* not relevant yet */
48 virtual int get_mtime ()
49 {
50 return 0;
51 };
52 virtual size_t get_size ();
53 static int move (const std::string& ,const std::string& );
54 private:
55 /* always require parameters */
56 io_stream_cygfile ()
57 {
58 };
59 friend int cygmkdir_p (path_type_t isadir, const std::string& _name);
60 static std::string normalise (const std::string& unixpath);
61 FILE *fp;
62 int lasterr;
63 std::string fname;
64 std::string lmode;
65 static std::string cwd;
66 };
67
68 #endif /* SETUP_IO_STREAM_CYGFILE_H */
This page took 0.038922 seconds and 5 git commands to generate.