2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: c_ios.h /main/4 1996/08/21 15:54:50 drk $ */
28 #include <sys/types.h>
29 #include "utility/macro.h"
30 #include "utility/c_streambuf.h"
35 streambuf* sbuf; // buffer that provides char sequence read/write
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 } ;
44 ios(streambuf* sb = 0);
47 int rdstate() { return f_state; };
53 return !(fail() || bad()) ;
56 void set_bad() { f_state |= BAD;};
57 void set_fail() { f_state |= FAIL;};
58 void clear() { f_state = OK; };
60 int operator!() { return fail(); };
61 operator void*() { return (void*)(size_t)good(); };