Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SERIALIZATION_PREPROCESSOR_HPP_INCLUDED
00020 #define SERIALIZATION_PREPROCESSOR_HPP_INCLUDED
00021
00022 #include <iosfwd>
00023 #include <map>
00024 #include <vector>
00025
00026 #include "game_errors.hpp"
00027
00028 class config_writer;
00029 class config;
00030
00031 struct preproc_define;
00032 typedef std::map< std::string, preproc_define > preproc_map;
00033
00034 struct preproc_define
00035 {
00036 preproc_define() : value(), arguments(), textdomain(), linenum(0), location() {}
00037 explicit preproc_define(std::string const &val) : value(val), arguments(), textdomain(), linenum(0), location() {}
00038 preproc_define(std::string const &val, std::vector< std::string > const &args,
00039 std::string const &domain, int line, std::string const &loc)
00040 : value(val), arguments(args), textdomain(domain), linenum(line), location(loc) {}
00041 std::string value;
00042 std::vector< std::string > arguments;
00043 std::string textdomain;
00044 int linenum;
00045 std::string location;
00046 void write(config_writer&, const std::string&) const;
00047 void write_argument(config_writer&, const std::string&) const;
00048 void read(const config&);
00049 void read_argument(const config &);
00050 static preproc_map::value_type read_pair(const config &);
00051 bool operator==(preproc_define const &) const;
00052 bool operator<(preproc_define const &) const;
00053 bool operator!=(preproc_define const &v) const { return !operator==(v); }
00054 };
00055
00056 std::ostream& operator<<(std::ostream& stream, const preproc_define& def);
00057
00058 struct preproc_config {
00059 struct error : public game::error {
00060 error(const std::string& message) : game::error(message) {}
00061 };
00062 };
00063
00064 std::string lineno_string(const std::string &lineno);
00065
00066 std::ostream& operator<<(std::ostream& stream, const preproc_map::value_type& def);
00067
00068
00069
00070
00071
00072
00073
00074
00075 std::istream *preprocess_file(std::string const &fname, preproc_map *defines = NULL);
00076
00077 void preprocess_resource(const std::string& res_name, preproc_map *defines_map,
00078 bool write_cfg=false, bool write_plain_cfg=false, std::string target_directory="");
00079
00080 #endif