Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 10 / Examples / MyString / MyString.h
diff options
context:
space:
mode:
Commit47ae9ddb0c11b09bd28e199de1b3ea0dd53a0644 (patch)
Author
 angeld55 <angel_dimitriev@abv.bg>
2022-05-03 19:53:06 +0300
Committer
 angeld55 <angel_dimitriev@abv.bg>
2022-05-03 19:53:06 +0300
Filesb980b0c65372391c6fda065b56f7a0ddb79fb30d /Sem. 10/Examples/MyString/MyString.h
Object-oriented_programming_FMI-47ae9ddb0c11b09bd28e199de1b3ea0dd53a0644.tar
Object-oriented_programming_FMI-47ae9ddb0c11b09bd28e199de1b3ea0dd53a0644.tar.gz
Object-oriented_programming_FMI-47ae9ddb0c11b09bd28e199de1b3ea0dd53a0644.zip
Parenta29fb60870cc65fba5bbb6cbeec86fe9415afc4d (diff)
changed folders
1 files changed, 41 insertions, 0 deletions
-rw-r--r--Sem. 10/Examples/MyString/MyString.h41
diff --git a/Sem. 10/Examples/MyString/MyString.h b/Sem. 10/Examples/MyString/MyString.h
new file mode 100644
index 0000000..334e863
--- /dev/null
+++ b/Sem. 10/Examples/MyString/MyString.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <fstream>
+class MyString
+{
+ char* str;
+ size_t size;
+
+ void copyFrom(const MyString& other);
+ void free();
+
+public:
+ MyString();
+ MyString(const char*);
+
+ MyString(const MyString&);
+
+ MyString(MyString&&); //move constructor that accepts rvalue;
+
+ MyString& operator=(const MyString& other);
+ MyString& operator=(MyString&& other); //move op= that accepts rvalue;
+
+ ~MyString();
+
+ size_t getSize() const;
+ void concat(const MyString& other);
+
+ const char* c_str() const;
+
+ MyString& operator+=(const MyString& other);
+
+ friend std::ostream& operator<<(std::ostream& stream, const MyString& str);
+ friend std::istream& operator>>(std::istream& stream, MyString& str);
+
+};
+
+MyString operator+(const MyString& lhs, const MyString& rhs);
+
+bool operator==(const MyString& lhs, const MyString& rhs);
+bool operator<=(const MyString& lhs, const MyString& rhs);
+bool operator<(const MyString& lhs, const MyString& rhs);