Moved C++ tools out

This commit is contained in:
2023-10-31 21:15:03 -05:00
parent f8a715ec78
commit 343f75433e
98 changed files with 5 additions and 16 deletions

View File

@ -0,0 +1,60 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "util/File.hpp"
#include <filesystem>
namespace Dawn {
enum DirectoryChildType {
DIRECTORY_CHILD_TYPE_FILE,
DIRECTORY_CHILD_TYPE_DIRECTORY
};
class Directory {
public:
std::string filename;
std::filesystem::directory_iterator handle;
Directory(std::string dir);
/**
* Opens a connection to the directory.
* @return True if success, otherwise for failure.
*/
bool_t open();
/**
* Returns if the directory is open.
* @return True if open, otherwise false.
*/
bool_t isOpen();
/**
* Closes the directory.
*/
void close();
/**
* Returns if the directory exists.
* @return True if exists, otherwise false.
*/
bool_t exists();
/**
* Creates the directory and all parent directories.
*/
void mkdirp();
/**
* Reads the directory and returns a list of files.
*
* @return List of filenames/directories within this directory.
*/
std::map<std::string, enum DirectoryChildType> readDirectory();
~Directory();
};
}