Author: alink
Date: Sun Jun 29 23:01:54 2008
New Revision: 27598
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27598&view=rev
Log:
Continue to generalize the use string_bool():
use it to replace the get_bool() of help.cpp
Modified:
trunk/src/help.cpp
Modified: trunk/src/help.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/help.cpp?rev=27598&r1=27597&r2=27598&view=diff
==============================================================================
--- trunk/src/help.cpp (original)
+++ trunk/src/help.cpp Sun Jun 29 23:01:54 2008
@@ -530,10 +530,6 @@
/// Convert the contents to wml attributes, surrounded within
/// [element_name]...[/element_name]. Return the resulting WML.
static std::string convert_to_wml(const std::string &element_name, const
std::string &contents);
-
-/// Return true if s is a representation of a truth value
-/// (yes/true/...), otherwise false.
-static bool get_bool(const std::string &s);
/// Return the color the string represents. Return font::NORMAL_COLOUR if
/// the string is empty or can't be matched against any other color.
@@ -2080,7 +2076,7 @@
{
const std::string dst = cfg["dst"];
const std::string text = cfg["text"];
- const bool force = get_bool(cfg["force"]);
+ const bool force = utils::string_bool(cfg["force"], false);
bool show_ref = true;
if (find_topic(toplevel_, dst) == NULL && !force) {
show_ref = false;
@@ -2125,9 +2121,9 @@
{
const std::string src = cfg["src"];
const std::string align = cfg["align"];
- const bool floating = get_bool(cfg["float"]);
+ const bool floating = utils::string_bool(cfg["float"], false);
bool box = true;
- if (cfg["box"] != "" && !get_bool(cfg["box"])) {
+ if (cfg["box"] != "" && !utils::string_bool(cfg["box"], false)) {
box = false;
}
if (src == "") {
@@ -2207,8 +2203,8 @@
if (text == "") {
throw parse_error("Format markup must have text attribute.");
}
- const bool bold = get_bool(cfg["bold"]);
- const bool italic = get_bool(cfg["italic"]);
+ const bool bold = utils::string_bool(cfg["bold"], false);
+ const bool italic = utils::string_bool(cfg["italic"], false);
int font_size = normal_font_size;
if (cfg["font_size"] != "") {
try {
@@ -2843,15 +2839,6 @@
return ss.str();
}
-bool get_bool(const std::string &s)
-{
- const std::string cmp_str = to_lower(s);
- if (cmp_str == "yes" || cmp_str == "true" || cmp_str == "1" || cmp_str
== "on") {
- return true;
- }
- return false;
-}
-
SDL_Color string_to_color(const std::string &s)
{
const std::string cmp_str = to_lower(s);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits