-
Notifications
You must be signed in to change notification settings - Fork 0
/
string.h
41 lines (32 loc) · 825 Bytes
/
string.h
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
/*
* string.h
* Untitled
*
* Created by Ellie on 5/09/10.
* Copyright 2010 Ellie. All rights reserved.
*
*/
#ifndef STRING_H
#define STRING_H
class String {
public:
String(const char *);
String(const String &);
String();
~String();
const char *c_str() const { return m_cstring; }
size_t length(void) const { return m_length; }
operator const char*() const { return m_cstring; }
operator bool() const { return m_length > 0; }
bool operator==(const String &) const;
bool operator<(const String &) const;
bool operator>(const String &) const;
String &operator=(const String &);
String &operator+=(const String &);
private:
size_t m_size;
size_t m_length;
char *m_cstring;
};
String operator+(const String &, const String &);
#endif