Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Solutions Sem. 03 / ex4 / HexEditor.h
blob: aa560410ed00709bd153b990dbbf6106c75c740d (plain) (blame)
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
#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;
};