binary_or_text.cpp File Reference

Read/Write file in binary (compressed) or text-format (uncompressed). More...

#include "global.hpp"
#include "binary_or_text.hpp"
#include "config.hpp"
#include "filesystem.hpp"
#include "serialization/binary_wml.hpp"
#include "serialization/parser.hpp"
#include <sstream>
#include <boost/iostreams/filter/gzip.hpp>

Include dependency graph for binary_or_text.cpp:

Go to the source code of this file.

Functions

bool detect_format_and_read (config &cfg, std::istream &in, std::string *error_log)
 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

Read/Write file in binary (compressed) or text-format (uncompressed).

Definition in file binary_or_text.cpp.


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