Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Solutions Sem. 03 / ex4 / File.h
diff options
context:
space:
mode:
Commit59508931bc42064c23d5fbcb062d6f7396a873ab (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-03-30 20:20:32 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-03-30 20:20:32 +0300
Files0f5f5e5f0070632790ecf58df30de705f1c17521 /Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/File.h
uni-projects-59508931bc42064c23d5fbcb062d6f7396a873ab.tar
uni-projects-59508931bc42064c23d5fbcb062d6f7396a873ab.tar.gz
uni-projects-59508931bc42064c23d5fbcb062d6f7396a873ab.zip
Parentef6d8e6de6061015e7dd41e2f74b733515b4a2e2 (diff)
Solved dimitriev hw (sem 3, ex4)
1 files changed, 27 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/File.h27
diff --git a/Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/File.h b/Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/File.h
new file mode 100644
index 0000000..753e734
--- /dev/null
+++ b/Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/File.h
@@ -0,0 +1,27 @@
+#include <iostream>
+#include <fstream>
+#include <cstring>
+#include "Bytex.h"
+
+class File {
+ Bytex* fileBuffer;
+ size_t count;
+ size_t length;
+
+ char* originalFilePath; // There are no actual restrictions on path lengths in Linux
+
+ char bytexToReadableChar(Bytex bytex) const;
+
+ void resizeBuffer();
+
+public:
+ File(const char* filePath);
+ ~File();
+
+ void viewFile() const;
+ void change(int index, Bytex bytex);
+ void add(Bytex bytex);
+ void remove();
+ void save() const;
+ void saveAs(const char* filePath) const;
+};