3 * Created by: haranp on Sat Feb 17 13:35:54 2007 UTC
14 // Definitions for formatted_string
22 class formatted_string
25 formatted_string(int init_colour
= 0);
26 explicit formatted_string(const std::string
&s
, int init_colour
= 0);
28 operator std::string() const;
29 void display(int start
= 0, int end
= -1) const;
30 std::string
tostring(int start
= 0, int end
= -1) const;
31 std::string
to_colour_string() const;
33 void cprintf(const char *s
, ...);
34 void cprintf(const std::string
&s
);
35 void add_glyph(glyph g
);
36 void textcolor(int color
);
37 formatted_string
substr(size_t index
, size_t length
=std::string::npos
) const;
43 void swap(formatted_string
& other
);
45 std::string::size_type
length() const;
46 std::string
html_dump() const;
48 bool operator < (const formatted_string
&other
) const;
49 const formatted_string
&operator += (const formatted_string
&other
);
50 char &operator [] (size_t idx
);
53 static formatted_string
parse_string(
55 bool eot_ends_format
= true,
56 bool (*process_tag
)(const std::string
&tag
) = NULL
,
57 int main_colour
= LIGHTGREY
);
59 static void parse_string_to_multiple(
61 std::vector
<formatted_string
> &out
);
63 static int get_colour(const std::string
&tag
);
66 int find_last_colour() const;
68 static void parse_string1(
71 std::vector
<int> &colour_stack
,
72 bool (*process_tag
)(const std::string
&tag
));
83 : type(FSOP_COLOUR
), x(color
), y(-1), relative(false), text()
87 fs_op(const std::string
&s
)
88 : type(FSOP_TEXT
), x(-1), y(-1), relative(false), text(s
)
92 operator fs_op_type () const
99 typedef std::vector
<fs_op
> oplist
;
103 int count_linebreaks(const formatted_string
& fs
);
105 int tagged_string_tag_length(const std::string
& s
);
106 int tagged_string_printable_length(const std::string
& s
);
107 std::string
tagged_string_substr(const std::string
& s
, int start
, int end
);
108 void display_tagged_block(const std::string
& s
);