WvStreams
wvfile.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * A simple class to access filesystem files using WvStreams.
6  */
7 #ifndef __WVFILE_H
8 #define __WVFILE_H
9 
10 #include "wvfdstream.h"
11 #include <fcntl.h>
12 
13 #ifdef _WIN32
14 #define O_NONBLOCK 0
15 #define O_LARGEFILE 0
16 #define fcntl(a,b,c)
17 #endif
18 
28 class WvFile : public WvFDStream
29 {
30 public:
32  WvFile();
33 
35  WvFile(int rwfd);
36 
38  WvFile(WvStringParm filename, int mode, int create_mode = 0666);
39  bool open(WvStringParm filename, int mode, int create_mode = 0666);
40  bool open(int _rwfd);
41 
42  bool readable, writable;
43 
44  virtual void pre_select(SelectInfo &si);
45  virtual bool post_select(SelectInfo &si);
46 
47 public:
48  const char *wstype() const { return "WvFile"; }
49 };
50 
51 #endif // __WVFILE_H
WvFile
WvFile implements a stream connected to a file or Unix device.
Definition: wvfile.h:28
WvFile::WvFile
WvFile()
Create an empty WvFile that you'll open later with open()
Definition: wvfile.cc:10
IWvStream::SelectInfo
the data structure used by pre_select()/post_select() and internally by select().
Definition: iwvstream.h:50
WvFile::pre_select
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
Definition: wvfile.cc:129
WvFile::post_select
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
Definition: wvfile.cc:138
WvFdStream
Base class for streams built on Unix file descriptors.
Definition: wvfdstream.h:20