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
|
---|
12 | // Last Modified On : Sat Apr 24 11:17:33 2021
|
---|
13 | // Update Count : 37
|
---|
14 | //
|
---|
15 |
|
---|
16 | #pragma once
|
---|
17 |
|
---|
18 | #include "iostream.hfa"
|
---|
19 | #include <stdio.h>
|
---|
20 |
|
---|
21 |
|
---|
22 | // *********************************** strstream ***********************************
|
---|
23 |
|
---|
24 |
|
---|
25 | enum { strstream_sepSize = 16 };
|
---|
26 | struct strstream { // satisfied basic_ostream
|
---|
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$;
|
---|
36 | char separator$[strstream_sepSize];
|
---|
37 | char tupleSeparator$[strstream_sepSize];
|
---|
38 | }; // strstream
|
---|
39 |
|
---|
40 | // Satisfies basic_ostream
|
---|
41 |
|
---|
42 | // private
|
---|
43 | bool sepPrt$( strstream & );
|
---|
44 | void sepReset$( strstream & );
|
---|
45 | void sepReset$( strstream &, bool );
|
---|
46 | const char * sepGetCur$( strstream & );
|
---|
47 | void sepSetCur$( strstream &, const char [] );
|
---|
48 | bool getNL$( strstream & );
|
---|
49 | void setNL$( strstream &, bool );
|
---|
50 | bool getANL$( strstream & );
|
---|
51 | bool getPrt$( strstream & );
|
---|
52 | void setPrt$( strstream &, bool );
|
---|
53 |
|
---|
54 | // public
|
---|
55 | void sepOn( strstream & );
|
---|
56 | void sepOff( strstream & );
|
---|
57 | bool sepDisable( strstream & );
|
---|
58 | bool sepEnable( strstream & );
|
---|
59 | void nlOn( strstream & );
|
---|
60 | void nlOff( strstream & );
|
---|
61 |
|
---|
62 | const char * sepGet( strstream & );
|
---|
63 | void sepSet( strstream &, const char [] );
|
---|
64 | const char * sepGetTuple( strstream & );
|
---|
65 | void sepSetTuple( strstream &, const char [] );
|
---|
66 |
|
---|
67 | void ends( strstream & );
|
---|
68 | int fmt( strstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
|
---|
69 | int flush( strstream & );
|
---|
70 |
|
---|
71 | strstream & write( strstream & os ); // use stdout, default value not working
|
---|
72 | strstream & write( strstream & os, FILE * stream = stdout );
|
---|
73 |
|
---|
74 | void ?{}( strstream &, char buf[], size_t size );
|
---|
75 |
|
---|
76 | extern strstream & sstr;
|
---|
77 |
|
---|
78 | // Local Variables: //
|
---|
79 | // mode: c //
|
---|
80 | // tab-width: 4 //
|
---|
81 | // End: //
|
---|