preprocessor.hpp

Go to the documentation of this file.
00001 /* $Id: preprocessor.hpp 23842 2008-02-16 08:47:16Z mordante $ */
00002 /*
00003    Copyright (C) 2003 by David White <dave@whitevine.net>
00004    Copyright (C) 2005 - 2008 by Guillaume Melquiond <guillaume.melquiond@gmail.com>
00005    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License version 2
00009    or at your option any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 //! @file serialization/preprocessor.hpp
00017 
00018 #ifndef SERIALIZATION_PREPROCESSOR_HPP_INCLUDED
00019 #define SERIALIZATION_PREPROCESSOR_HPP_INCLUDED
00020 
00021 #include <iosfwd>
00022 #include <map>
00023 #include <string>
00024 #include <vector>
00025 
00026 struct preproc_define
00027 {
00028     preproc_define() : value(""), arguments(), textdomain(""), linenum(0), location("") {}
00029     explicit preproc_define(std::string const &val) : value(val), arguments(), textdomain(""), linenum(0), location("") {}
00030     preproc_define(std::string const &val, std::vector< std::string > const &args,
00031                    std::string const &domain, int line, std::string const &loc)
00032         : value(val), arguments(args), textdomain(domain), linenum(line), location(loc) {}
00033     std::string value;
00034     std::vector< std::string > arguments;
00035     std::string textdomain;
00036     int linenum;
00037     std::string location;
00038     bool operator==(preproc_define const &) const;
00039     bool operator!=(preproc_define const &v) const { return !operator==(v); }
00040 };
00041 
00042 struct preproc_config {
00043     struct error {
00044         error(const std::string& msg) : message(msg) {}
00045         std::string message;
00046     };
00047 };
00048 
00049 typedef std::map< std::string, preproc_define > preproc_map;
00050 
00051 //! Function to use the WML preprocessor on a file, 
00052 //! and returns the resulting preprocessed file data. 
00053 //! defines is a map of symbols defined.
00054 std::istream *preprocess_file(std::string const &fname,
00055                               preproc_map *defines = NULL, std::string *error_log=NULL);
00056 
00057 #endif

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