source: libcfa/src/fstream.hfa @ 0efb269

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 0efb269 was 0efb269, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

add feature to input streams to read/not-read newline characters

  • Property mode set to 100644
File size: 2.5 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// fstream --
8//
9// Author           : Peter A. Buhr
10// Created On       : Wed May 27 17:56:53 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Apr 20 12:03:58 2019
13// Update Count     : 151
14//
15
16#pragma once
17
18#include "iostream.hfa"
19
20enum { sepSize = 16 };
21struct ofstream {
22        void * file;
23        bool sepDefault;
24        bool sepOnOff;
25        bool nlOnOff;
26        bool prt;                                                                                       // print text
27        bool sawNL;
28        const char * sepCur;
29        char separator[sepSize];
30        char tupleSeparator[sepSize];
31}; // ofstream
32
33// private
34bool sepPrt( ofstream & );
35void sepReset( ofstream & );
36void sepReset( ofstream &, bool );
37const char * sepGetCur( ofstream & );
38void sepSetCur( ofstream &, const char * );
39bool getNL( ofstream & );
40void setNL( ofstream &, bool );
41bool getANL( ofstream & );
42bool getPrt( ofstream & );
43void setPrt( ofstream &, bool );
44
45// public
46void sepOn( ofstream & );
47void sepOff( ofstream & );
48bool sepDisable( ofstream & );
49bool sepEnable( ofstream & );
50void nlOn( ofstream & );
51void nlOff( ofstream & );
52
53const char * sepGet( ofstream & );
54void sepSet( ofstream &, const char * );
55const char * sepGetTuple( ofstream & );
56void sepSetTuple( ofstream &, const char * );
57
58int fail( ofstream & );
59int flush( ofstream & );
60void open( ofstream &, const char * name, const char * mode );
61void open( ofstream &, const char * name );
62void close( ofstream & );
63ofstream & write( ofstream &, const char * data, size_t size );
64int fmt( ofstream &, const char format[], ... );
65
66void ?{}( ofstream & os );
67void ?{}( ofstream & os, const char * name, const char * mode );
68void ?{}( ofstream & os, const char * name );
69
70extern ofstream & sout, & serr;
71
72
73struct ifstream {
74        void * file;
75        bool nlOnOff;
76}; // ifstream
77
78// public
79void nlOn( ifstream & );
80void nlOff( ifstream & );
81bool getANL( ifstream & );
82int fail( ifstream & is );
83int eof( ifstream & is );
84void open( ifstream & is, const char * name, const char * mode );
85void open( ifstream & is, const char * name );
86void close( ifstream & is );
87ifstream & read( ifstream & is, char * data, size_t size );
88ifstream & ungetc( ifstream & is, char c );
89int fmt( ifstream &, const char format[], ... );
90
91void ?{}( ifstream & is );
92void ?{}( ifstream & is, const char * name, const char * mode );
93void ?{}( ifstream & is, const char * name );
94
95extern ifstream & sin;
96
97// Local Variables: //
98// mode: c //
99// tab-width: 4 //
100// End: //
Note: See TracBrowser for help on using the repository browser.