side_filter.hpp

Go to the documentation of this file.
00001 /* $Id: side_filter.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2010 - 2012 by Yurii Chernyi <terraninfo@terraninfo.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (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 #ifndef SIDE_FILTER_H_INCLUDED
00017 #define SIDE_FILTER_H_INCLUDED
00018 
00019 #include "variable.hpp"
00020 
00021 class config;
00022 class unit;
00023 class unit_map;
00024 class team;
00025 
00026 #include <set>
00027 
00028 //side_filter: a class that implements the Standard Side Filter
00029 class side_filter {
00030 public:
00031 
00032 #ifdef _MSC_VER
00033     // This constructor is required for MSVC 9 SP1 due to a bug there
00034     // see http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/34473b8c-0184-4750-a290-08558e4eda4e
00035     // other compilers don't need it.
00036     side_filter();
00037 #endif
00038 
00039     side_filter(const std::string &side_string, bool flat_tod = false);
00040     side_filter(const vconfig &cfg, bool flat_tod = false);
00041 
00042     //match: returns true if and only if the given team matches this filter
00043     bool match(const team& t) const;
00044     bool match(const int side) const;
00045     std::vector<int> get_teams() const;
00046 
00047 private:
00048     side_filter(const side_filter &other);
00049     side_filter& operator=(const side_filter &other);
00050 
00051     bool match_internal(const team& t) const;
00052 
00053     const vconfig cfg_; //config contains WML for a Standard Side Filter
00054 
00055     bool flat_;
00056     std::string side_string_;
00057 
00058 };
00059 
00060 #endif
00061 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:10 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs