source: libcfa/src/strstream.hfa@ f5856ecd

Last change on this file since f5856ecd was 1034059, checked in by Peter A. Buhr <pabuhr@…>, 3 weeks ago

add "clear" function to strstring

  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[fec63b2]1//
2// Cforall Version 1.0.0 Copyright (C) 2021 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// strstream.hfa --
8//
9// Author : Peter A. Buhr
10// Created On : Thu Apr 22 22:20:59 2021
11// Last Modified By : Peter A. Buhr
[1034059]12// Last Modified On : Sat Oct 11 15:11:06 2025
13// Update Count : 62
[fec63b2]14//
15
16#pragma once
17
18#include "iostream.hfa"
19#include <stdio.h>
20
21
[666483d]22// *********************************** ostrstream ***********************************
[fec63b2]23
24
[666483d]25enum { ostrstream_sepSize = 16 };
26struct ostrstream { // satisfied basic_ostream
[fec63b2]27 char * buf$;
28 size_t size$;
29 size_t cursor$;
30 bool sepDefault$;
31 bool sepOnOff$;
32 bool nlOnOff$;
33 bool prt$; // print text
34 bool sawNL$;
35 const char * sepCur$;
[666483d]36 char separator$[ostrstream_sepSize];
37 char tupleSeparator$[ostrstream_sepSize];
38}; // ostrstream
[fec63b2]39
40// Satisfies basic_ostream
[ae0c1c3]41extern basic_ostream_data(ostrstream) const & basic_ostream_table;
[fec63b2]42
43// private
[666483d]44bool sepPrt$( ostrstream & );
45void sepReset$( ostrstream & );
46void sepReset$( ostrstream &, bool );
47const char * sepGetCur$( ostrstream & );
48void sepSetCur$( ostrstream &, const char [] );
49bool getNL$( ostrstream & );
[d0cfcbe1]50bool setNL$( ostrstream &, bool );
[666483d]51bool getANL$( ostrstream & );
[d0cfcbe1]52bool setANL$( ostrstream &, bool );
[666483d]53bool getPrt$( ostrstream & );
[d0cfcbe1]54bool setPrt$( ostrstream &, bool );
[fec63b2]55
56// public
[666483d]57void nlOn( ostrstream & );
58void nlOff( ostrstream & );
[fec63b2]59
[f5d9c37]60void sep( ostrstream & );
61void nosep( ostrstream & );
62bool sepOn( ostrstream & );
63bool sepOff( ostrstream & );
[666483d]64const char * sepGet( ostrstream & );
65void sepSet( ostrstream &, const char [] );
66const char * sepGetTuple( ostrstream & );
67void sepSetTuple( ostrstream &, const char [] );
[fec63b2]68
[666483d]69void ends( ostrstream & );
70int fmt( ostrstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
[fec63b2]71
[666483d]72ostrstream & write( ostrstream & os, FILE * stream ); // FIX ME: use default = stdout
73ostrstream & write( ostrstream & os );
[fec63b2]74
[666483d]75void ?{}( ostrstream &, char buf[], size_t size );
[fec63b2]76
[1034059]77void clear( ostrstream & os );
78
[666483d]79
80// *********************************** istrstream ***********************************
81
82
[768d091]83// Currently, this is a placeholder because vsscanf returns number of values read versus buffer position scanned.
84// This issue makes it impossible to know where in the buffer the last read stopped.
85
[666483d]86struct istrstream {
87 char * buf$;
88 size_t cursor$;
89 bool nlOnOff$;
90}; // istrstream
91
[768d091]92void ?{}( istrstream &, char buf[] );
93
[666483d]94// Satisfies basic_istream
[ae0c1c3]95extern basic_istream_data(istrstream) const & basic_istream_table;
[666483d]96
[321a1b15]97// private
98bool getANL$( istrstream & );
[d0cfcbe1]99bool setANL$( istrstream &, bool );
[321a1b15]100
[666483d]101// public
102void nlOn( istrstream & );
103void nlOff( istrstream & );
104int fmt( istrstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
[a1a1f37d]105istrstream & ungetc( char, istrstream & );
[321a1b15]106bool eof( istrstream & );
[768d091]107void clearerr( istrstream & );
108void ends( istrstream & );
[fec63b2]109
110// Local Variables: //
111// mode: c //
112// tab-width: 4 //
113// End: //
Note: See TracBrowser for help on using the repository browser.