20 #ifndef GAME_EVENTS_WMI_CONTAINER_HPP_INCLUDED
21 #define GAME_EVENTS_WMI_CONTAINER_HPP_INCLUDED
25 #include <boost/shared_ptr.hpp>
48 typedef std::map<std::string, item_ptr>
map_t;
52 static const item_ptr &
eval(
const map_t::const_iterator & iter)
53 {
return iter->second; }
114 #endif // GAME_EVENTS_WMI_CONTAINER_HPP_INCLUDED
std::vector< std::pair< boost::shared_ptr< const wml_menu_item >, std::string > > get_items(const map_location &hex, game_data &gamedata, filter_context &fc, unit_map &units) const
Range over all items by default.
const_iterator begin() const
util::const_iterator_extend< value_type, map_t, key, key > const_iterator
std::map< std::string, item_ptr > map_t
The underlying storage type.
bool empty() const
Returns true if *this contains no data.
bool fire_item(const std::string &id, const map_location &hex, game_data &gamedata, filter_context &fc, unit_map &units) const
Fires the menu item with the given id.
iterator find(const std::string &id)
Returns an iterator to a menu item with the given id, if one exists.
const_iterator find(const std::string &id) const
Returns an iterator to a menu item with the given id, if one exists.
const value_type & const_reference
map_t::size_type size_type
void to_config(config &cfg) const
boost::shared_ptr< wml_menu_item > item_ptr
Pointers to our elements.
void set_menu_items(const config &cfg)
Sets the current menu items to the "menu_item" children of cfg.
~wmi_container()
Destructor.
Encapsulates the map of the game.
A container of wml_menu_item.
std::vector< std::pair< boost::shared_ptr< const wml_menu_item >, std::string > > get_items(const map_location &hex, game_data &gamedata, filter_context &fc, unit_map &units, const_iterator start, const_iterator finish) const
Returns the menu items that can be shown for the given location.
util::iterator_extend< value_type, map_t, key, key > iterator
static const item_ptr & eval(const map_t::const_iterator &iter)
Instructions for converting a map_t iterator to an item_ptr.
void init_handlers() const
Initializes the implicit event handlers for inlined [command]s.
A variable-expanding proxy for the config class.
Container associating units to locations.
void set_item(const std::string &id, const vconfig &menu_item)
Updates or creates (as appropriate) the menu item with the given id.
This is a const_iterator class that extends an existing const_iterator by overriding dereference...
const_iterator end() const
A config object defines a single node in a WML file, with access to child nodes.
The key for interaction with our iterators.
GLsizei const GLcharARB ** string
size_type erase(const std::string &id)
Erases the item with the provided id.
map_t::difference_type difference_type
This is an iterator class that extends an existing iterator by overriding dereference.