blob: 59fa0b6a54ac352f337917311d4556b2008c05cc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef DEF_FWIK_STRING_H
#define DEF_FWIK_STRING_H
#include <cpp.h>
class String {
private:
char *ptr; // zero-terminated for internal purposes.
int len;
public:
String();
String(const String& other);
String(const char* ptr);
String(const char* ptr, int len);
String(char c, int count);
~String();
void operator=(const String &string);
void operator=(const char* ptr);
const char* c_str() const;
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() const { return len; }
operator bool() const { return len != 0; }
String substr(int start, int count) const;
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
|