reports.cpp

Go to the documentation of this file.
00001 /* $Id: reports.cpp 24743 2008-03-17 12:28:38Z esr $ */
00002 /*
00003    Copyright (C) 2003 - 2008 by David White <dave@whitevine.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 version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 
00015 #include "global.hpp"
00016 
00017 #include "reports.hpp"
00018 
00019 #include <cassert>
00020 #include <map>
00021 
00022 namespace {
00023     const std::string report_names[] = {
00024         "unit_name", "unit_type",
00025         "unit_race", "unit_level", "unit_side", "unit_amla",
00026         "unit_traits", "unit_status", "unit_alignment", "unit_abilities",
00027         "unit_hp", "unit_xp", "unit_advancement_options", "unit_moves",
00028         "unit_weapons", "unit_image", "unit_profile", "time_of_day",
00029         "turn", "gold", "villages", "num_units", "upkeep", "expenses",
00030         "income", "terrain", "position", "side_playing", "observers",
00031         "report_countdown", "report_clock",
00032         "selected_terrain", "edit_left_button_function"
00033     };
00034 }
00035 
00036 namespace reports {
00037 
00038 const std::string& report_name(TYPE type)
00039 {
00040     assert(sizeof(report_names)/sizeof(*report_names) == NUM_REPORTS);
00041     assert(type < NUM_REPORTS);
00042 
00043     return report_names[type];
00044 }
00045 
00046 void report::add_text(std::stringstream& text, std::stringstream& tooltip) {
00047     add_text(text.str(), tooltip.str());
00048     // Clear the streams
00049     text.str("");
00050     tooltip.str("");
00051 }
00052 
00053 void report::add_text(const std::string& text, const std::string& tooltip) {
00054     this->push_back(element(text,"",tooltip));
00055 }
00056 
00057 void report::add_image(std::stringstream& image, std::stringstream& tooltip) {
00058     add_image(image.str(), tooltip.str());
00059     // Clear the streams
00060     image.str("");
00061     tooltip.str("");
00062 }
00063 
00064 void report::add_image(const std::string& image, const std::string& tooltip) {
00065     this->push_back(element("",image,tooltip));
00066 }
00067 
00068 }

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