Lolly 1.4.28
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
std_ostream_rep Class Reference
Inheritance diagram for std_ostream_rep:
Inheritance graph
[legend]
Collaboration diagram for std_ostream_rep:
Collaboration graph
[legend]

Public Member Functions

 std_ostream_rep ()
 
 std_ostream_rep (char *)
 
 std_ostream_rep (FILE *)
 
 ~std_ostream_rep ()
 
bool is_writable () const
 
void write (const char *)
 
void flush ()
 
- Public Member Functions inherited from tm_ostream_rep
 tm_ostream_rep ()
 
virtual ~tm_ostream_rep ()
 
virtual void clear ()
 

Private Attributes

FILEfile
 
bool is_w
 
bool is_mine
 

Additional Inherited Members

- Public Attributes inherited from tm_ostream_rep
int ref_count
 

Detailed Description

Definition at line 41 of file tm_ostream.cpp.

Constructor & Destructor Documentation

◆ std_ostream_rep() [1/3]

std_ostream_rep::std_ostream_rep ( )

Definition at line 57 of file tm_ostream.cpp.

57 : file (0), is_w (false), is_mine (false) {
58 is_w = true;
59 is_mine= true;
60}

◆ std_ostream_rep() [2/3]

std_ostream_rep::std_ostream_rep ( char * fn)

Definition at line 62 of file tm_ostream.cpp.

63 : file (0), is_w (false), is_mine (false) {
64 file= fopen (fn, "w");
65 if (file) {
66 is_w = true;
67 is_mine= true;
68 }
69 else {
70 is_w = false;
71 is_mine= false;
72 }
73}
The list class represents a linked list.
Definition list.hpp:48

◆ std_ostream_rep() [3/3]

std_ostream_rep::std_ostream_rep ( FILE * f)

Definition at line 75 of file tm_ostream.cpp.

76 : file (0), is_w (false), is_mine (false) {
77#if defined(OS_WIN) || defined(OS_MINGW)
78 SetConsoleOutputCP (65001);
79#endif
80 file= f;
81 if (file) is_w= true;
82 else is_w= false;
83 is_mine= false;
84}

◆ ~std_ostream_rep()

std_ostream_rep::~std_ostream_rep ( )

Definition at line 86 of file tm_ostream.cpp.

86 {
87 if (file && is_mine) fclose (file);
88}

Member Function Documentation

◆ is_writable()

bool std_ostream_rep::is_writable ( ) const
virtual

Reimplemented from tm_ostream_rep.

Definition at line 91 of file tm_ostream.cpp.

91 {
92 return is_w;
93}

◆ write()

void std_ostream_rep::write ( const char * s)
virtual

Reimplemented from tm_ostream_rep.

Definition at line 96 of file tm_ostream.cpp.

96 {
97 if (file && is_w) {
98 if (0 <= fprintf (file, "%s", s)) {
99 const char* c= s;
100 while (*c != 0 && *c != '\n')
101 ++c;
102 if (*c == '\n') flush ();
103 }
104 else is_w= false;
105 }
106}

◆ flush()

void std_ostream_rep::flush ( )
virtual

Reimplemented from tm_ostream_rep.

Definition at line 109 of file tm_ostream.cpp.

109 {
110 if (file && is_w) fflush (file);
111}

Member Data Documentation

◆ file

FILE* std_ostream_rep::file
private

Definition at line 42 of file tm_ostream.cpp.

◆ is_w

bool std_ostream_rep::is_w
private

Definition at line 43 of file tm_ostream.cpp.

◆ is_mine

bool std_ostream_rep::is_mine
private

Definition at line 44 of file tm_ostream.cpp.


The documentation for this class was generated from the following file: