Files

58 lines
1.3 KiB
C
Raw Permalink Normal View History

2026-03-01 12:16:08 +08:00
#pragma once
2026-03-02 14:51:05 +07:00
#include <cstdint>
#include <vector>
#include <string>
2026-03-01 12:16:08 +08:00
// 4J Stu - Represents java standard library class
class FileFilter;
class File
{
public:
//The system-dependent path-separator character
static const wchar_t pathSeparator;
// 4J Jev, the start of the file root
static const wstring pathRoot;
File() { m_abstractPathName = L""; }
File( const File &parent, const wstring& child );
File( const wstring& pathname );
File( const wstring& parent, const wstring& child );
bool _delete();
bool mkdir() const;
bool mkdirs() const;
bool exists() const;
bool isFile() const;
bool renameTo(File dest);
2026-03-02 14:51:05 +07:00
std::vector<File *> *listFiles() const; // Array
std::vector<File *> *listFiles(FileFilter *filter) const;
2026-03-01 12:16:08 +08:00
bool isDirectory() const;
2026-03-02 14:51:05 +07:00
int64_t length();
int64_t lastModified();
2026-03-01 12:16:08 +08:00
const wstring getPath() const; // 4J Jev: TODO
wstring getName() const;
static int hash_fnct(const File &k);
static bool eq_test(const File &x, const File &y);
private:
void _init();
wstring m_abstractPathName;
// 4J Jev, just helper functions, change between paths and vector<string>
//File(vector<wstring> *path);
};
2026-03-02 14:51:05 +07:00
struct FileKeyHash
2026-03-01 12:16:08 +08:00
{
2026-03-02 14:51:05 +07:00
int operator() (const File &k) const;
};
2026-03-01 12:16:08 +08:00
2026-03-02 14:51:05 +07:00
struct FileKeyEq
2026-03-01 12:16:08 +08:00
{
2026-03-02 14:51:05 +07:00
bool operator() (const File &x, const File &y) const;
};