00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SERIALIZATION_BINARY_OR_TEXT_HPP_INCLUDED
00020 #define SERIALIZATION_BINARY_OR_TEXT_HPP_INCLUDED
00021
00022 #include <iosfwd>
00023 #include <string>
00024
00025 #include <boost/iostreams/filtering_stream.hpp>
00026
00027 class config;
00028
00029
00030
00031
00032
00033 bool detect_format_and_read(config &cfg, std::istream &in, std::string* error_log=NULL);
00034
00035
00036 void write_possibly_compressed(std::ostream &out, config &cfg, bool compress);
00037
00038
00039 class config_writer
00040 {
00041 public:
00042 config_writer(std::ostream &out, bool compress, const std::string &textdomain);
00043
00044 void write(const config &cfg);
00045 void write_child(const std::string &key, const config &cfg);
00046 void write_key_val(const std::string &key, const std::string &value);
00047 void open_child(const std::string &key);
00048 void close_child(const std::string &key);
00049 bool good() const;
00050
00051 private:
00052 boost::iostreams::filtering_stream<boost::iostreams::output> filter_;
00053 std::ostream *out_ptr_;
00054 std::ostream &out_;
00055 bool compress_;
00056 unsigned int level_;
00057 std::string textdomain_;
00058 };
00059
00060 #endif