diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2012-08-26 22:50:06 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2012-08-26 23:06:30 +0200 |
commit | 770bcbd1844b97b671d0e47ea8313cdf2c74c5ea (patch) | |
tree | e030cf61afce9ca69b74bb38eb73734bf10f633e /crawl-ref/source/format.h | |
parent | a6c16c7f2066c854a01f25e9e6c3d8e44282a638 (diff) | |
download | crawl-ref-770bcbd1844b97b671d0e47ea8313cdf2c74c5ea.tar.gz crawl-ref-770bcbd1844b97b671d0e47ea8313cdf2c74c5ea.zip |
Use std namespace.
I had to rename distance() (in coord.h) to distance2() because it conflicts
with the STL function to compare 2 iterators. Not a bad change given how it
returns the square of the distance anyway.
I also had to rename the message global variable (in message.cc) to buffer.
I tried to fix and improve the coding style has much as I could, but I
probably missed a few given how huge and tedious it is.
I also didn't touch crawl-gdb.py, and the stuff in prebuilt, rltiles/tool
and util/levcomp.*, because I have no clue about those.
Diffstat (limited to 'crawl-ref/source/format.h')
-rw-r--r-- | crawl-ref/source/format.h | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/crawl-ref/source/format.h b/crawl-ref/source/format.h index b33c036020..450660b318 100644 --- a/crawl-ref/source/format.h +++ b/crawl-ref/source/format.h @@ -18,15 +18,15 @@ class formatted_string { public: formatted_string(int init_colour = 0); - explicit formatted_string(const std::string &s, int init_colour = 0); + explicit formatted_string(const string &s, int init_colour = 0); - operator std::string() const; + operator 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; + string tostring(int start = 0, int end = -1) const; + string to_colour_string() const; void cprintf(PRINTF(1, )); - void cprintf(const std::string &s); + void cprintf(const string &s); void add_glyph(glyph g); void textcolor(int color); formatted_string chop(int length) const; @@ -41,7 +41,7 @@ public: void swap(formatted_string& other); int width() const; - std::string html_dump() const; + string html_dump() const; bool operator < (const formatted_string &other) const; const formatted_string &operator += (const formatted_string &other); @@ -49,25 +49,22 @@ public: public: static formatted_string parse_string( - const std::string &s, + const string &s, bool eot_ends_format = true, - bool (*process_tag)(const std::string &tag) = NULL, + bool (*process_tag)(const string &tag) = NULL, int main_colour = LIGHTGREY); - static void parse_string_to_multiple( - const std::string &s, - std::vector<formatted_string> &out); + static void parse_string_to_multiple(const string &s, + vector<formatted_string> &out); - static int get_colour(const std::string &tag); + static int get_colour(const string &tag); 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)); + static void parse_string1(const string &s, formatted_string &fs, + vector<int> &colour_stack, + bool (*process_tag)(const string &tag)); public: struct fs_op @@ -75,14 +72,14 @@ public: fs_op_type type; int x, y; bool relative; - std::string text; + string text; fs_op(int color) : type(FSOP_COLOUR), x(color), y(-1), relative(false), text() { } - fs_op(const std::string &s) + fs_op(const string &s) : type(FSOP_TEXT), x(-1), y(-1), relative(false), text(s) { } @@ -94,13 +91,13 @@ public: void display() const; }; - typedef std::vector<fs_op> oplist; + typedef vector<fs_op> oplist; oplist ops; }; int count_linebreaks(const formatted_string& fs); -int tagged_string_tag_length(const std::string& s); -void display_tagged_block(const std::string& s); +int tagged_string_tag_length(const string& s); +void display_tagged_block(const string& s); #endif |