-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyString.h
More file actions
69 lines (52 loc) · 1.75 KB
/
Copy pathMyString.h
File metadata and controls
69 lines (52 loc) · 1.75 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#pragma warning(disable:4996)
#include <iostream>
using namespace std;
class MyString
{
char* str{nullptr};
size_t cap{0};
public:
MyString();
MyString(const char* s);
MyString(size_t s);
explicit MyString(const MyString& obj);
MyString(MyString&& obj)noexcept;
~MyString();
size_t capacity()const;
size_t size()const;
char& operator[](size_t index);
char operator[](size_t index)const;
void input();
void print()const;
operator const char* ()const;
MyString& operator=(const MyString& obj);
MyString& operator=(MyString&& obj)noexcept;
MyString& operator+=(const MyString& obj);
MyString& operator+=(const char* s);
MyString& operator+=(char x);
MyString& operator+=(const string& s);
MyString operator+(const MyString& obj)const;
MyString operator+(const char* s)const;
MyString operator+(char x)const;
MyString operator+(const string& s)const;
bool operator==(const MyString& obj)const;
bool operator==(const char* s)const;
bool operator!=(const MyString& obj)const;
bool operator!=(const char* s)const;
bool operator>=(const MyString& obj)const;
bool operator>=(const char* s)const;
bool operator>=(const string& s)const;
bool operator<=(const MyString& obj)const;
bool operator<=(const char* s)const;
bool operator<=(const string& s)const;
bool operator>(const MyString& obj)const;
bool operator>(const char* s)const;
bool operator>(const string& s)const;
bool operator<(const MyString& obj)const;
bool operator<(const char* s)const;
bool operator<(const string& s)const;
friend ostream& operator<<(ostream& dest, const MyString& source);
friend istream& operator>>( istream& source, MyString& dest);
const char* reverse()const;
};