source: libcfa/src/fstream.hfa @ 2a3d446

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 2a3d446 was 4cae032, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

add missing destructor for ofstream nad ifstream

  • Property mode set to 100644
File size: 2.8 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 : Fri Nov 29 06:56:02 2019
13// Update Count     : 168
14//
15
16#pragma once
17
18#include "iostream.hfa"
19
20
21//*********************************** ofstream ***********************************
22
23
24enum { sepSize = 16 };
25struct ofstream {
26        void * file;
27        bool sepDefault;
28        bool sepOnOff;
29        bool nlOnOff;
30        bool prt;                                                                                       // print text
31        bool sawNL;
32        const char * sepCur;
33        char separator[sepSize];
34        char tupleSeparator[sepSize];
35}; // ofstream
36
37// private
38bool sepPrt( ofstream & );
39void sepReset( ofstream & );
40void sepReset( ofstream &, bool );
41const char * sepGetCur( ofstream & );
42void sepSetCur( ofstream &, const char * );
43bool getNL( ofstream & );
44void setNL( ofstream &, bool );
45bool getANL( ofstream & );
46bool getPrt( ofstream & );
47void setPrt( ofstream &, bool );
48
49// public
50void sepOn( ofstream & );
51void sepOff( ofstream & );
52bool sepDisable( ofstream & );
53bool sepEnable( ofstream & );
54void nlOn( ofstream & );
55void nlOff( ofstream & );
56
57const char * sepGet( ofstream & );
58void sepSet( ofstream &, const char * );
59const char * sepGetTuple( ofstream & );
60void sepSetTuple( ofstream &, const char * );
61
62void ends( ofstream & os );
63int fail( ofstream & );
64int flush( ofstream & );
65void open( ofstream &, const char * name, const char * mode );
66void open( ofstream &, const char * name );
67void close( ofstream & );
68ofstream & write( ofstream &, const char * data, size_t size );
69int fmt( ofstream &, const char format[], ... );
70
71void ?{}( ofstream & os );
72void ?{}( ofstream & os, const char * name, const char * mode );
73void ?{}( ofstream & os, const char * name );
74void ^?{}( ofstream & os );
75
76extern ofstream & sout, & stdout, & serr, & stderr;             // aliases
77extern ofstream & exit, & abort;
78
79
80//*********************************** ifstream ***********************************
81
82
83struct ifstream {
84        void * file;
85        bool nlOnOff;
86}; // ifstream
87
88// public
89void nlOn( ifstream & );
90void nlOff( ifstream & );
91bool getANL( ifstream & );
92int fail( ifstream & is );
93int eof( ifstream & is );
94void open( ifstream & is, const char * name, const char * mode );
95void open( ifstream & is, const char * name );
96void close( ifstream & is );
97ifstream & read( ifstream & is, char * data, size_t size );
98ifstream & ungetc( ifstream & is, char c );
99int fmt( ifstream &, const char format[], ... );
100
101void ?{}( ifstream & is );
102void ?{}( ifstream & is, const char * name, const char * mode );
103void ?{}( ifstream & is, const char * name );
104void ^?{}( ifstream & is );
105
106extern ifstream & sin, & stdin;                                                 // aliases
107
108// Local Variables: //
109// mode: c //
110// tab-width: 4 //
111// End: //
Note: See TracBrowser for help on using the repository browser.