Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Solutions Sem. 03 / ex4 / HexEditor.h
diff options
context:
space:
mode:
Commita6fb61db10a93801065d34d19fb6d7166511e58d (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-03-31 09:37:42 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-03-31 09:37:42 +0300
Filesec3db1d6147713c184c9ba23fd9dd866c599edcc /Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/HexEditor.h
uni-projects-a6fb61db10a93801065d34d19fb6d7166511e58d.tar
uni-projects-a6fb61db10a93801065d34d19fb6d7166511e58d.tar.gz
uni-projects-a6fb61db10a93801065d34d19fb6d7166511e58d.zip
Parent4a530b9ae9f50ce0e117931933db3a11285f29af (diff)
Made naming and slight formatting adjustments
1 files changed, 29 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/HexEditor.h29
diff --git a/Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/HexEditor.h b/Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/HexEditor.h
new file mode 100644
index 0000000..aa56041
--- /dev/null
+++ b/Year 1/Object-oriented Programming/Solutions Sem. 03/ex4/HexEditor.h
@@ -0,0 +1,29 @@
+#include <iostream>
+#include <fstream>
+#include <cstring>
+#pragma warning(disable:4996)
+
+#include "Bytex.h"
+
+class HexEditor {
+ Bytex* fileBuffer;
+ size_t count;
+ size_t length;
+
+ char* originalFilePath; // There are no actual restrictions on path lengths in Linux
+
+ char bytexToReadableChar(const Bytex& bytex) const;
+ void resizeBuffer();
+
+public:
+ HexEditor(const char* filePath);
+ ~HexEditor();
+
+ void change(size_t index, const Bytex& bytex);
+ void add(const Bytex& bytex);
+ void remove();
+
+ void viewFile() const;
+ void save() const;
+ void saveAs(const char* filePath) const;
+};