summaryrefslogtreecommitdiffstats
path: root/src/String.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/String.h')
-rw-r--r--src/String.h53
1 files changed, 35 insertions, 18 deletions
diff --git a/src/String.h b/src/String.h
index e5739bb..743e367 100644
--- a/src/String.h
+++ b/src/String.h
@@ -29,10 +29,12 @@ namespace PY {
class String : public std::string {
public:
- String () : std::string () {}
- String (const gchar *str) : std::string (str) {}
+ String () : std::string () { }
+ String (const gchar *str) : std::string (str) { }
String (gint len) : std::string () { reserve (len); }
- String & printf (const gchar *fmt, ...) {
+
+ String & printf (const gchar *fmt, ...)
+ {
gchar *str;
va_list args;
@@ -45,7 +47,8 @@ public:
return *this;
}
- String & appendPrintf (const gchar *fmt, ...) {
+ String & appendPrintf (const gchar *fmt, ...)
+ {
gchar *str;
va_list args;
@@ -59,7 +62,8 @@ public:
return *this;
}
- String & appendUnichar (gunichar ch) {
+ String & appendUnichar (gunichar ch)
+ {
gchar str[12];
gint len;
len = g_unichar_to_utf8 (ch, str);
@@ -68,39 +72,47 @@ public:
return *this;
}
- String & insert (gint i, gchar ch) {
+ String & insert (gint i, gchar ch)
+ {
std::string::insert (i, 1, ch);
return *this;
}
- String & truncate (guint len) {
+ String & truncate (guint len)
+ {
erase(len);
return *this;
}
- gsize utf8Length (void) const {
+ gsize utf8Length (void) const
+ {
return g_utf8_strlen (c_str(), -1);
}
- String & operator<< (gint i) {
+ String & operator<< (gint i)
+ {
return appendPrintf ("%d", i);
}
- String & operator<< (guint i) {
+ String & operator<< (guint i)
+ {
return appendPrintf ("%u", i);
}
- String & operator<< (const gchar ch) {
+ String & operator<< (const gchar ch)
+ {
append (1, ch);
return *this;
}
- String & operator<< (const gchar *str) {
+ String & operator<< (const gchar *str)
+ {
append (str);
return *this;
}
- String & operator<< (const gunichar *wstr) {
+ String & operator<< (const gunichar *wstr)
+ {
gchar *str;
GError *error;
str = g_ucs4_to_utf8 (wstr, -1, NULL, NULL, &error);
@@ -115,24 +127,29 @@ public:
return *this;
}
- String & operator<< (const std::string &str) {
+ String & operator<< (const std::string &str)
+ {
return operator<< (str.c_str ());
}
- String & operator<< (const String &str) {
+ String & operator<< (const String &str)
+ {
return operator<< ((const gchar *)str);
}
- String & operator= (const gchar * str) {
+ String & operator= (const gchar * str)
+ {
assign (str);
return *this;
}
- operator const gchar *(void) const {
+ operator const gchar *(void) const
+ {
return this->c_str ();
}
- operator gboolean (void) const {
+ operator gboolean (void) const
+ {
return ! empty ();
}
};