#include "global.hpp"
#include "config.hpp"
#include "loadscreen.hpp"
#include "log.hpp"
#include "serialization/binary_wml.hpp"
#include <algorithm>
#include <iostream>
#include <sstream>
Go to the source code of this file.
Defines | |
#define | ERR_CF LOG_STREAM(err, config) |
Functions | |
static void | compress_output_literal_word (std::ostream &out, std::string const &word) |
static compression_schema::word_char_map::const_iterator | add_word_to_schema (std::string const &word, compression_schema &schema) |
static compression_schema::word_char_map::const_iterator | get_word_in_schema (std::string const &word, compression_schema &schema, std::ostream &out) |
static void | compress_emit_word (std::ostream &out, std::string const &word, compression_schema &schema) |
static std::string | compress_read_literal_word (std::istream &in) |
static void | write_compressed_internal (std::ostream &out, config const &cfg, compression_schema &schema, int level) |
void | write_compressed (std::ostream &out, config const &cfg, compression_schema &schema) |
Write compressed data. | |
static void | read_compressed_internal (config &cfg, std::istream &in, compression_schema &schema, int level) |
void | read_compressed (config &cfg, std::istream &in, compression_schema &schema) |
Read compressed data. | |
void | write_compressed (std::ostream &out, config const &cfg) |
void | read_compressed (config &cfg, std::istream &in) |
Variables | |
static const unsigned int | compress_open_element = 0 |
static const unsigned int | compress_close_element = 1 |
static const unsigned int | compress_schema_item = 2 |
static const unsigned int | compress_literal_word = 3 |
static const unsigned int | compress_first_word = 4 |
static const unsigned int | compress_end_words = 256 |
static const size_t | compress_max_words = compress_end_words - compress_first_word |
static const size_t | max_schema_item_length = 20 |
static const int | max_recursion_levels = 1000 |
Definition in file binary_wml.cpp.
#define ERR_CF LOG_STREAM(err, config) |
Definition at line 30 of file binary_wml.cpp.
static compression_schema::word_char_map::const_iterator add_word_to_schema | ( | std::string const & | word, | |
compression_schema & | schema | |||
) | [static] |
Definition at line 70 of file binary_wml.cpp.
References compression_schema::char_to_word, compress_first_word, max_schema_item_length, and compression_schema::word_to_char.
Referenced by get_word_in_schema(), and read_compressed_internal().
static void compress_emit_word | ( | std::ostream & | out, | |
std::string const & | word, | |||
compression_schema & | schema | |||
) | [static] |
Definition at line 106 of file binary_wml.cpp.
References compress_literal_word, compress_output_literal_word(), get_word_in_schema(), and compression_schema::word_to_char.
Referenced by write_compressed_internal().
static void compress_output_literal_word | ( | std::ostream & | out, | |
std::string const & | word | |||
) | [static] |
Definition at line 64 of file binary_wml.cpp.
Referenced by compress_emit_word(), get_word_in_schema(), and write_compressed_internal().
static std::string compress_read_literal_word | ( | std::istream & | in | ) | [static] |
static compression_schema::word_char_map::const_iterator get_word_in_schema | ( | std::string const & | word, | |
compression_schema & | schema, | |||
std::ostream & | out | |||
) | [static] |
Definition at line 82 of file binary_wml.cpp.
References add_word_to_schema(), compress_max_words, compress_output_literal_word(), compress_schema_item, max_schema_item_length, and compression_schema::word_to_char.
Referenced by compress_emit_word().
void read_compressed | ( | config & | cfg, | |
std::istream & | in | |||
) |
void read_compressed | ( | config & | cfg, | |
std::istream & | in, | |||
compression_schema & | schema | |||
) |
Read compressed data.
Definition at line 215 of file binary_wml.cpp.
References config::clear(), and read_compressed_internal().
Referenced by check_python_scripts(), detect_format_and_read(), process_queue(), and read_compressed().
static void read_compressed_internal | ( | config & | cfg, | |
std::istream & | in, | |||
compression_schema & | schema, | |||
int | level | |||
) | [static] |
Definition at line 161 of file binary_wml.cpp.
References config::add_child(), add_word_to_schema(), compression_schema::char_to_word, compress_close_element, compress_literal_word, compress_open_element, compress_read_literal_word(), compress_schema_item, ERR_CF, t_string::from_serialized(), increment_binary_wml_progress(), max_recursion_levels, value, and config::values.
Referenced by read_compressed().
void write_compressed | ( | std::ostream & | out, | |
config const & | cfg | |||
) |
void write_compressed | ( | std::ostream & | out, | |
config const & | cfg, | |||
compression_schema & | schema | |||
) |
Write compressed data.
The schema will be created and written with the data. However if you are making successive writes (e.g. a network connection), you can re-use the same schema on the sending end, and the receiver can store the schema, meaning that the entire schema won't have to be transmitted each time.
Definition at line 156 of file binary_wml.cpp.
References write_compressed_internal().
Referenced by output_to_buffer(), write_compressed(), write_possibly_compressed(), and write_save_index().
static void write_compressed_internal | ( | std::ostream & | out, | |
config const & | cfg, | |||
compression_schema & | schema, | |||
int | level | |||
) | [static] |
Definition at line 129 of file binary_wml.cpp.
References compress_close_element, compress_emit_word(), compress_open_element, compress_output_literal_word(), max_recursion_levels, name, config::ordered_begin(), config::ordered_end(), and config::values.
Referenced by write_compressed().
const unsigned int compress_close_element = 1 [static] |
Definition at line 57 of file binary_wml.cpp.
Referenced by read_compressed_internal(), and write_compressed_internal().
const unsigned int compress_end_words = 256 [static] |
Definition at line 59 of file binary_wml.cpp.
const unsigned int compress_first_word = 4 [static] |
const unsigned int compress_literal_word = 3 [static] |
Definition at line 58 of file binary_wml.cpp.
Referenced by compress_emit_word(), and read_compressed_internal().
const size_t compress_max_words = compress_end_words - compress_first_word [static] |
const unsigned int compress_open_element = 0 [static] |
Definition at line 57 of file binary_wml.cpp.
Referenced by read_compressed_internal(), and write_compressed_internal().
const unsigned int compress_schema_item = 2 [static] |
Definition at line 58 of file binary_wml.cpp.
Referenced by get_word_in_schema(), and read_compressed_internal().
const int max_recursion_levels = 1000 [static] |
Definition at line 62 of file binary_wml.cpp.
Referenced by read_compressed_internal(), write_compressed_internal(), and write_internal().
const size_t max_schema_item_length = 20 [static] |
Definition at line 61 of file binary_wml.cpp.
Referenced by add_word_to_schema(), and get_word_in_schema().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |