source: libcfa/src/fstream.hfa @ ef346f7c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resnenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since ef346f7c was 9d362a0, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

simplify code

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