diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-19 15:56:25 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-19 15:56:25 +0200 |
commit | 8e07c1db6ba4bedd0f8fe537a6fb0ca80e5d25f4 (patch) | |
tree | 08df626a28c290f5cde43424dd62dd43fc441a35 /src/user/lib/fwik/include/String.h | |
parent | 0d2f7645c3fb45d83497faf2a4b6fff8c3f175d1 (diff) | |
download | TCE-8e07c1db6ba4bedd0f8fe537a6fb0ca80e5d25f4.tar.gz TCE-8e07c1db6ba4bedd0f8fe537a6fb0ca80e5d25f4.zip |
Better sprintf, vsprintf, String::sprintf, etc.
Diffstat (limited to 'src/user/lib/fwik/include/String.h')
-rw-r--r-- | src/user/lib/fwik/include/String.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/user/lib/fwik/include/String.h b/src/user/lib/fwik/include/String.h index 672220d..59fa0b6 100644 --- a/src/user/lib/fwik/include/String.h +++ b/src/user/lib/fwik/include/String.h @@ -11,30 +11,32 @@ class String { public: String(); String(const String& other); - String(char* ptr); - String(char* ptr, int len); + String(const char* ptr); + String(const char* ptr, int len); String(char c, int count); ~String(); void operator=(const String &string); - void operator=(char* ptr); + void operator=(const char* ptr); - char* c_str(); + const char* c_str() const; - bool operator==(const String& other); - bool operator==(char* other); - bool operator<(const String& other); + bool operator==(const String& other) const; + bool operator==(const char* other) const; + bool operator<(const String& other) const; char &operator[](int pos); + char operator[](int pos) const; - int size() { return len; } - operator bool() { return len != 0; } - String substr(int start, int count); + int size() const { return len; } + operator bool() const { return len != 0; } + String substr(int start, int count) const; - String operator+(const String& other); + String operator+(const String& other) const; void operator+=(const String& other); void operator+=(char c); static String dec(int i); static String hex(uint32_t v); + static String sprintf(const char* format, ...); }; #endif |