source: libcfa/src/fstream.hfa @ 50b8885

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

add missing destructor for ofstream nad ifstream

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