Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 15 / MyString / MyString.h
diff options
context:
space:
mode:
Commitf1e6772e0b264388cf96500b75c6ae47272f2238 (patch)
Author
 angeld55 <angel_dimitriev@abv.bg>
2022-06-07 21:18:29 +0300
Committer
 angeld55 <angel_dimitriev@abv.bg>
2022-06-07 21:18:29 +0300
Filesba30e9f48d807ad1478ab985bc4e8781f2bf3341 /Sem. 15/MyString/MyString.h
Object-oriented_programming_FMI-f1e6772e0b264388cf96500b75c6ae47272f2238.tar
Object-oriented_programming_FMI-f1e6772e0b264388cf96500b75c6ae47272f2238.tar.gz
Object-oriented_programming_FMI-f1e6772e0b264388cf96500b75c6ae47272f2238.zip
Parent30601882aa51c1c6aa646c3bb6001f2c848adde7 (diff)
sem 15
1 files changed, 48 insertions, 0 deletions
-rw-r--r--Sem. 15/MyString/MyString.h48
diff --git a/Sem. 15/MyString/MyString.h b/Sem. 15/MyString/MyString.h
new file mode 100644
index 0000000..b6d7c13
--- /dev/null
+++ b/Sem. 15/MyString/MyString.h
@@ -0,0 +1,48 @@
+#pragma once
+#include <iostream>
+#include <fstream>
+class MyString
+{
+ char* str;
+ size_t size;
+
+ void copyFrom(const MyString& other);
+ void free();
+
+ void concatFrom(const MyString& other);
+
+public:
+ MyString();
+ MyString(const char*);
+ MyString(size_t n); //convert constructor
+
+ MyString(const MyString&);
+
+ MyString(MyString&&); //move constructor that accepts rvalue;
+
+ MyString& operator=(const MyString& other);
+ MyString& operator=(MyString&& other); //move op= that accepts rvalue;
+
+ const char& operator[](size_t index) const;
+ char& operator[](size_t index);
+
+ ~MyString();
+
+ size_t getSize() const;
+
+ 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 subString(size_t start, size_t end) const;
+
+};
+
+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);