allow the output stream to be specified when debugging config objects
This commit is contained in:
parent
fc740cdf2d
commit
a2c4ca0197
2 changed files with 11 additions and 12 deletions
|
@ -21,9 +21,6 @@
|
|||
#include "log.hpp"
|
||||
#include "util.hpp"
|
||||
#include "wassert.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define ERR_CF LOG_STREAM(err, config)
|
||||
|
||||
|
@ -629,22 +626,22 @@ void config::reset_translation() const
|
|||
}
|
||||
}
|
||||
|
||||
void config::debug() const{
|
||||
void config::debug(std::ostream& outstream) const{
|
||||
static int i = 0;
|
||||
i++;
|
||||
for(string_map::const_iterator val = values.begin(); val != values.end(); ++val) {
|
||||
for (int j = 0; j < i; j++){ std::cerr << char(9); }
|
||||
std::cerr << val->first << ", " << val->second << "\n";
|
||||
for (int j = 0; j < i; j++){ outstream << char(9); }
|
||||
outstream << val->first << ", " << val->second << "\n";
|
||||
}
|
||||
|
||||
for(child_map::const_iterator list = children.begin(); list != children.end(); ++list) {
|
||||
{ for (int j = 0; j < i-1; j++){ std::cerr << char(9); } }
|
||||
std::cerr << "[" << list->first << "]\n";
|
||||
{ for (int j = 0; j < i-1; j++){ outstream << char(9); } }
|
||||
outstream << "[" << list->first << "]\n";
|
||||
for(child_list::const_iterator child = list->second.begin(); child != list->second.end(); ++child) {
|
||||
(*child)->debug();
|
||||
(*child)->debug(outstream);
|
||||
}
|
||||
{ for (int j = 0; j < i-1; j++){ std::cerr << char(9); } }
|
||||
std::cerr << "[/" << list->first << "]\n";
|
||||
{ for (int j = 0; j < i-1; j++){ outstream << char(9); } }
|
||||
outstream << "[/" << list->first << "]\n";
|
||||
}
|
||||
i--;
|
||||
}
|
||||
|
|
|
@ -15,12 +15,14 @@
|
|||
|
||||
#include "global.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "tstring.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
||||
|
||||
//This module defines the interface to Wesnoth Markup Language (WML).
|
||||
//WML is a simple hierarchical text-based file format. The format
|
||||
//is defined in Wiki, under BuildingScenariosWML
|
||||
|
@ -80,7 +82,7 @@ public:
|
|||
void clear();
|
||||
bool empty() const;
|
||||
|
||||
void debug() const;
|
||||
void debug(std::ostream& outstream=std::cerr) const;
|
||||
std::string hash() const;
|
||||
|
||||
struct error {
|
||||
|
|
Loading…
Add table
Reference in a new issue