summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/unicode.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2012-08-26 22:50:06 +0200
committerRaphael Langella <raphael.langella@gmail.com>2012-08-26 23:06:30 +0200
commit770bcbd1844b97b671d0e47ea8313cdf2c74c5ea (patch)
treee030cf61afce9ca69b74bb38eb73734bf10f633e /crawl-ref/source/unicode.cc
parenta6c16c7f2066c854a01f25e9e6c3d8e44282a638 (diff)
downloadcrawl-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/unicode.cc')
-rw-r--r--crawl-ref/source/unicode.cc40
1 files changed, 20 insertions, 20 deletions
diff --git a/crawl-ref/source/unicode.cc b/crawl-ref/source/unicode.cc
index 30c27f3091..386f17062a 100644
--- a/crawl-ref/source/unicode.cc
+++ b/crawl-ref/source/unicode.cc
@@ -115,9 +115,9 @@ int utf8towc(ucs_t *d, const char *s)
#ifdef TARGET_OS_WINDOWS
// don't pull in wstring templates on other systems
-std::wstring utf8_to_16(const char *s)
+wstring utf8_to_16(const char *s)
{
- std::wstring d;
+ wstring d;
ucs_t c;
while (int l = utf8towc(&c, s))
@@ -136,9 +136,9 @@ std::wstring utf8_to_16(const char *s)
}
#endif
-std::string utf16_to_8(const utf16_t *s)
+string utf16_to_8(const utf16_t *s)
{
- std::string d;
+ string d;
ucs_t c;
while (*s)
@@ -166,9 +166,9 @@ std::string utf16_to_8(const utf16_t *s)
return d;
}
-std::string utf8_to_mb(const char *s)
+string utf8_to_mb(const char *s)
{
- std::string d;
+ string d;
ucs_t c;
int l;
mbstate_t ps;
@@ -191,9 +191,9 @@ std::string utf8_to_mb(const char *s)
return d;
}
-std::string mb_to_utf8(const char *s)
+string mb_to_utf8(const char *s)
{
- std::string d;
+ string d;
wchar_t c;
int l;
mbstate_t ps;
@@ -218,9 +218,9 @@ std::string mb_to_utf8(const char *s)
return d;
}
-static std::string utf8_validate(const char *s)
+static string utf8_validate(const char *s)
{
- std::string d;
+ string d;
ucs_t c;
int l;
@@ -292,11 +292,11 @@ FileLineInput::~FileLineInput()
fclose(f);
}
-std::string FileLineInput::get_line()
+string FileLineInput::get_line()
{
ASSERT(f);
- std::vector<utf16_t> win;
- std::string out;
+ vector<utf16_t> win;
+ string out;
char buf[512];
ucs_t c;
int len;
@@ -436,10 +436,10 @@ UTF8FileLineInput::~UTF8FileLineInput()
fclose(f);
}
-std::string UTF8FileLineInput::get_line()
+string UTF8FileLineInput::get_line()
{
ASSERT(f);
- std::string out;
+ string out;
char buf[512];
do
@@ -475,7 +475,7 @@ int strwidth(const char *s)
return w;
}
-int strwidth(const std::string &s)
+int strwidth(const string &s)
{
return strwidth(s.c_str());
}
@@ -517,7 +517,7 @@ char *next_glyph(char *s)
return s_cur;
}
-std::string chop_string(const char *s, int width, bool spaces)
+string chop_string(const char *s, int width, bool spaces)
{
const char *s0 = s;
ucs_t c;
@@ -535,11 +535,11 @@ std::string chop_string(const char *s, int width, bool spaces)
}
if (spaces && width)
- return std::string(s0, s - s0) + std::string(width, ' ');
- return std::string(s0, s - s0);;
+ return string(s0, s - s0) + string(width, ' ');
+ return string(s0, s - s0);;
}
-std::string chop_string(const std::string &s, int width, bool spaces)
+string chop_string(const string &s, int width, bool spaces)
{
return chop_string(s.c_str(), width, spaces);
}