Initial test bootstrap.
This commit is contained in:
parent
6c618749f1
commit
4b308f6c32
94 changed files with 2543 additions and 681 deletions
|
@ -1,57 +1,53 @@
|
|||
#pragma once
|
||||
|
||||
#include "FileFormats.h"
|
||||
#include "FileSystemPath.h"
|
||||
#include "Optional.h"
|
||||
#include "String.h"
|
||||
#include "ByteTypes.h"
|
||||
#include "Pointer.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
using Path = std::filesystem::path;
|
||||
class FileImpl;
|
||||
|
||||
class File
|
||||
{
|
||||
public:
|
||||
enum class AccessMode{
|
||||
Read,
|
||||
Write
|
||||
Write,
|
||||
ReadWrite
|
||||
};
|
||||
|
||||
public:
|
||||
File(std::filesystem::path fullPath);
|
||||
File(const FileSystemPath& path);
|
||||
|
||||
~File();
|
||||
|
||||
void close();
|
||||
|
||||
std::string dumpBinary();
|
||||
String dumpBinary();
|
||||
|
||||
std::string getExtension() const;
|
||||
|
||||
std::ifstream* getInHandle() const;
|
||||
|
||||
std::ofstream* getOutHandle() const;
|
||||
String getExtension() const;
|
||||
|
||||
FileFormat::Format inferFormat() const;
|
||||
|
||||
std::string readText();
|
||||
String readText();
|
||||
|
||||
std::vector<std::string> readLines();
|
||||
Vector<String> readLines();
|
||||
|
||||
std::string read();
|
||||
String read();
|
||||
|
||||
bool pathExists() const;
|
||||
|
||||
bool open(AccessMode mode);
|
||||
bool open(AccessMode mode, bool binary = false);
|
||||
|
||||
std::optional<unsigned char> readNextByte();
|
||||
bool readBinary(VecBytes& bytes);
|
||||
|
||||
void writeText(const std::string& text);
|
||||
Optional<Byte> readNextByte();
|
||||
|
||||
void writeText(const String& text);
|
||||
|
||||
private:
|
||||
std::filesystem::path mFullPath;
|
||||
std::unique_ptr<std::ifstream> mInHandle;
|
||||
std::unique_ptr<std::ofstream> mOutHandle;
|
||||
Ptr<FileImpl> m_impl;
|
||||
FileSystemPath m_path;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue