move save and load buffer to file in to buffer class

This commit is contained in:
Nikola Petrov
2023-08-27 22:13:11 +02:00
parent 058e24d436
commit b59c4d1d26
6 changed files with 64 additions and 45 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <string>
class Buffer
{
@@ -7,6 +8,7 @@ public:
uint8_t* buffer = nullptr;
size_t taken = 0;
size_t size = 0;
std::string file_path;
Buffer(size_t size);
Buffer();
@@ -26,4 +28,10 @@ public:
void clear() { taken = 0; }
bool save_to_file();
bool save_to_file(std::string file_path);
bool load_from_file();
bool load_from_file(std::string file_path);
};

View File

@@ -1,5 +1,5 @@
#pragma once
#include <fstream>
#include <string>
class Buffer;
@@ -31,7 +31,3 @@ LoginInfoPointer get_logininfo_pointer_from_buffer(Buffer& buffer, int index_of_
void generate_password(std::string& password, int len);
bool save_buffer_to_file(Buffer& buffer);
bool load_buffer_from_file(Buffer& buffer);