source: libcfa/src/fstream.hfa @ 712348a

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

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

  • Property mode set to 100644
File size: 2.5 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
[0efb269]12// Last Modified On : Sat Apr 20 12:03:58 2019
13// Update Count     : 151
[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;
[0efb269]75        bool nlOnOff;
[53ba273]76}; // ifstream
[6ba0659]77
[09687aa]78// public
[0efb269]79void nlOn( ifstream & );
80void nlOff( ifstream & );
81bool getANL( ifstream & );
[09687aa]82int fail( ifstream & is );
83int eof( ifstream & is );
[8da74119]84void open( ifstream & is, const char * name, const char * mode );
[09687aa]85void open( ifstream & is, const char * name );
86void close( ifstream & is );
[91d766d]87ifstream & read( ifstream & is, char * data, size_t size );
[09687aa]88ifstream & ungetc( ifstream & is, char c );
[9d362a0]89int fmt( ifstream &, const char format[], ... );
[09687aa]90
91void ?{}( ifstream & is );
[8da74119]92void ?{}( ifstream & is, const char * name, const char * mode );
[09687aa]93void ?{}( ifstream & is, const char * name );
[51b7345]94
[09687aa]95extern ifstream & sin;
[51b7345]96
[86bd7c1f]97// Local Variables: //
[d3b7937]98// mode: c //
[86bd7c1f]99// tab-width: 4 //
100// End: //
Note: See TracBrowser for help on using the repository browser.