#include <text_file.h>
This class is experimental.
Definition at line 49 of file text_file.h.
Public Member Functions | |
text_out_file (std::ostream *out_file, int width=80, bool bracket_objs=true) | |
Use output stream out_file for text output. | |
text_out_file (std::string file_name, std::ostream *prop=0, bool append=false, int width=80, bool bracket_objs=true) | |
Create an output file with name file_name . | |
virtual int | open (std::ostream *out_file, int width=80, bool bracket_objs=true) |
Desc. | |
virtual int | open (std::string file_name, std::ostream *prop=0, bool append=false, int width=80, bool bracket_objs=true) |
Desc. | |
virtual int | close () |
Desc. | |
virtual int | bool_out (bool dat, std::string name="") |
Output a bool variable. | |
virtual int | char_out (char dat, std::string name="") |
Output a char variable. | |
virtual int | char_out_internal (char dat, std::string name="") |
Output a char variable. | |
virtual int | double_out (double dat, std::string name="") |
Output a double variable. | |
virtual int | float_out (float dat, std::string name="") |
Output a float variable. | |
virtual int | int_out (int dat, std::string name="") |
Output an int variable. | |
virtual int | long_out (unsigned long int dat, std::string name="") |
Output an long variable. | |
virtual int | string_out (std::string dat, std::string name="") |
Output a string. | |
virtual int | word_out (std::string dat, std::string name="") |
Output a word. | |
virtual int | start_object (std::string type, std::string name) |
Start object output. | |
virtual int | end_object () |
End object output. | |
virtual int | end_line () |
End line. | |
virtual int | init_file () |
Output initialization. | |
virtual int | clean_up () |
Desc. | |
int | comment_out (std::string comment) |
Output a comment (only for text files). | |
std::string | reformat_string (std::string in) |
Add brackets and replace carriage returns with spaces. | |
Protected Member Functions | |
virtual int | flush () |
Flush the string buffer if the current string is long enough. | |
bool | is_hc_type (std::string type) |
If true, then type is a "hard-coded" type. | |
Protected Attributes | |
bool | extra_brackets |
Desc. | |
std::stack< bool > | hcs |
A list to indicate if the current object and subobjects are "hard-coded". | |
bool | from_string |
True if the constructor was called with a string, false otherwise. | |
bool | compressed |
True if the file is to be compressed. | |
bool | gzip |
True if the file is to be compressed with gzip. | |
int | file_width |
The width of the file. | |
std::ostream * | outs |
The output stream. | |
std::ostream * | props |
A pointer to an output stream to define output properties. | |
std::ostringstream * | strout |
The temporary buffer as a stringstream. | |
std::string | user_filename |
The user-specified filename. | |
std::string | temp_filename |
The temporary filename used. |
text_out_file | ( | std::ostream * | out_file, | |
int | width = 80 , |
|||
bool | bracket_objs = true | |||
) |
Use output stream out_file
for text output.
This constructor assumes that the I/O properties of out_file
have already been set.
Note that the stream out_file
should not have been opened in binary mode, and errors will likely occur if this is the case.
text_out_file | ( | std::string | file_name, | |
std::ostream * | prop = 0 , |
|||
bool | append = false , |
|||
int | width = 80 , |
|||
bool | bracket_objs = true | |||
) |
Create an output file with name file_name
.
If prop
is not NULL (i.e. nonzero), then the I/O properties (precision, fill, flags, etc) for the newly created file are taken to be the same as prop
.
virtual int end_line | ( | ) | [virtual] |
End line.
This calls flush() in case the current string buffer is larger than the width, and then outputs the remaining characters and creates a new stringstream.
Implements out_file_format.
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page