binary_or_text.hpp File Reference

#include <iosfwd>
#include <string>
#include <boost/iostreams/filtering_stream.hpp>

Include dependency graph for binary_or_text.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  config_writer
 Class for writing a config out to a file in pieces. More...

Functions

bool detect_format_and_read (config &cfg, std::istream &in, std::string *error_log=NULL)
 Reads a file, and detects it is compressed before reading it.
void write_possibly_compressed (std::ostream &out, config &cfg, bool compress)
 Writes a file, compressed or not depending on a flag.


Detailed Description

Definition in file binary_or_text.hpp.


Function Documentation

bool detect_format_and_read ( config cfg,
std::istream &  in,
std::string *  error_log = NULL 
)

Reads a file, and detects it is compressed before reading it.

If it is not a valid file at all, it will throw an error as if it was trying to read it as text WML. Returns true iff the format is compressed.

Definition at line 31 of file binary_or_text.cpp.

References read(), and read_compressed().

Referenced by play_game(), read_save_file(), and save_index().

void write_possibly_compressed ( std::ostream &  out,
config cfg,
bool  compress 
)

Writes a file, compressed or not depending on a flag.

Definition at line 43 of file binary_or_text.cpp.

References write(), and write_compressed().

Referenced by play_game().


Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs