summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/format.h
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-29 09:32:40 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-29 09:32:40 +0000
commit32ed1823706542ae3cc6bb8086beca1d81e46caf (patch)
tree4d8ef01bb9d49149d6d82986e66f41a412551f20 /crawl-ref/source/format.h
parent683b4d9a7073c1d5204eadfe7f5959e99b13a24b (diff)
downloadcrawl-ref-32ed1823706542ae3cc6bb8086beca1d81e46caf.tar.gz
crawl-ref-32ed1823706542ae3cc6bb8086beca1d81e46caf.zip
Cleaned up and applied 1895117: formatted_string and tutorial polish.
- formatted_message_history handles linebreaks within color spans properly, and now makes print_formatted_paragraph redundant. (changed tutorial.cc to take advantage of this) - formatted_string handles <color></color> properly (with nesting) instead of reverting to lightgrey. (changed tutorial.cc to take advantage of this, too) - The part of 1895117 that dealt with dec glyphs was already addressed in a previous patch, in a more robust way, so that got cut. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3481 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/format.h')
-rw-r--r--crawl-ref/source/format.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/crawl-ref/source/format.h b/crawl-ref/source/format.h
index cc479fef5c..6979ab3dc0 100644
--- a/crawl-ref/source/format.h
+++ b/crawl-ref/source/format.h
@@ -24,6 +24,7 @@ public:
operator std::string() const;
void display(int start = 0, int end = -1) const;
std::string tostring(int start = 0, int end = -1) const;
+ std::string to_colour_string() const;
void cprintf(const char *s, ...);
void cprintf(const std::string &s);
@@ -46,12 +47,16 @@ public:
public:
static formatted_string parse_string(
const std::string &s,
- bool eol_ends_format = true,
+ bool eot_ends_format = true,
bool (*process_tag)(const std::string &tag) = NULL );
+ static void parse_string_to_multiple(
+ const std::string &s,
+ std::vector<formatted_string> &out);
+
static formatted_string parse_block(
const std::string &s,
- bool eol_ends_format = true,
+ bool eot_ends_format = true,
bool (*process_tag)(const std::string &tag) = NULL );
static int get_colour(const std::string &tag);
@@ -59,6 +64,12 @@ public:
private:
int find_last_colour() const;
+ static void parse_string1(
+ const std::string &s,
+ formatted_string &fs,
+ std::vector<int> &colour_stack,
+ bool (*process_tag)(const std::string &tag));
+
public:
struct fs_op
{