Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / utility / c_ios.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: c_ios.h /main/4 1996/08/21 15:54:50 drk $ */
24
25 #ifndef _ios_h
26 #define _ios_h
27
28 #include <sys/types.h>
29 #include "utility/macro.h"
30 #include "utility/c_streambuf.h"
31
32 class ios
33 {
34 protected:
35   streambuf*      sbuf; // buffer that provides char sequence read/write
36   int f_state;
37
38 public:
39
40   enum open_mode { in=1, out=2, app=4, trunc=8 };
41   enum seek_dir   { beg=0, cur=1, end=2 } ;
42   enum states { OK=0, BAD=1, FAIL=2 } ;
43
44   ios(streambuf* sb = 0);
45   virtual ~ios();
46
47   int rdstate() { return f_state; };
48
49   int fail() ;
50   int bad() ;
51
52   int good() { 
53     return !(fail() || bad()) ;
54   };
55
56   void set_bad() { f_state |= BAD;};
57   void set_fail() { f_state |= FAIL;};
58   void clear() { f_state = OK; };
59
60   int operator!() { return fail(); };
61   operator void*() { return (void*)(size_t)good(); };
62
63 };
64
65 #endif