summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-19 23:49:49 -0800
committerPixel <pixel@nobis-crew.org>2011-11-19 23:49:49 -0800
commitb9e2cb295e8f53f0311d8e3b5b0edf69bb76ea78 (patch)
tree4d79470cc12b14a84395df68829385ed464d8e9c
parent32bb7218cec6d6176ba1a026fdb7cde9e6e1df2e (diff)
Having String.set returning this.
-rw-r--r--includes/BString.h6
-rw-r--r--src/BString.cc4
2 files changed, 6 insertions, 4 deletions
diff --git a/includes/BString.h b/includes/BString.h
index 8242af8..b5527d7 100644
--- a/includes/BString.h
+++ b/includes/BString.h
@@ -26,9 +26,9 @@ class String : private std::string {
String(const String & s) : std::string(s) { }
String(const std::string & s) : std::string(s) { }
- void set(const char * fmt, va_list);
- void set(const char * fmt, ...) { va_list ap; va_start(ap, fmt); set(fmt, ap); va_end(ap); }
- void set(const String & fmt, ...) { va_list ap; va_start(ap, fmt); set(fmt.to_charp(), ap); va_end(ap); }
+ String & set(const char * fmt, va_list);
+ String & set(const char * fmt, ...) { va_list ap; va_start(ap, fmt); set(fmt, ap); va_end(ap); return *this; }
+ String & set(const String & fmt, ...) { va_list ap; va_start(ap, fmt); set(fmt.to_charp(), ap); va_end(ap); return *this; }
int scanf(const char * fmt, va_list ap) const { return ::vsscanf(c_str(), fmt, ap); }
int scanf(const char * fmt, ...) const { va_list ap; va_start(ap, fmt); int r = scanf(fmt, ap); va_end(ap); return r; }
diff --git a/src/BString.cc b/src/BString.cc
index 74156bf..74bc7d9 100644
--- a/src/BString.cc
+++ b/src/BString.cc
@@ -4,7 +4,7 @@
#include "Printer.h"
#include "BString.h"
-void Balau::String::set(const char * fmt, va_list ap) {
+Balau::String & Balau::String::set(const char * fmt, va_list ap) {
unsigned int l;
#ifdef _WIN32
// Microsoft is stupid.
@@ -18,6 +18,8 @@ void Balau::String::set(const char * fmt, va_list ap) {
assign(t, l);
free(t);
#endif
+
+ return *this;
}
int Balau::String::strchrcnt(char c) const {