2018-01-20 03:34:48 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2014-12-17 05:38:14 +00:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-06-27 20:18:56 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-09-11 22:42:59 +00:00
|
|
|
#include <memory>
|
2015-05-06 05:15:46 +00:00
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
#include "common/bit_field.h"
|
2014-06-27 20:18:56 +00:00
|
|
|
#include "common/common_types.h"
|
2016-03-03 18:05:50 +00:00
|
|
|
#include "common/swap.h"
|
2015-05-06 05:15:46 +00:00
|
|
|
#include "core/hle/result.h"
|
2014-06-27 20:18:56 +00:00
|
|
|
|
|
|
|
namespace FileSys {
|
|
|
|
|
2018-01-20 03:34:48 +00:00
|
|
|
class StorageBackend;
|
2015-05-06 05:15:46 +00:00
|
|
|
class DirectoryBackend;
|
|
|
|
|
2014-11-10 22:36:32 +00:00
|
|
|
// Path string type
|
2016-09-19 01:01:46 +00:00
|
|
|
enum LowPathType : u32 {
|
|
|
|
Invalid = 0,
|
|
|
|
Empty = 1,
|
|
|
|
Binary = 2,
|
|
|
|
Char = 3,
|
|
|
|
Wchar = 4,
|
|
|
|
};
|
2014-11-10 22:36:32 +00:00
|
|
|
|
2018-03-20 03:58:55 +00:00
|
|
|
enum EntryType : u8 {
|
2018-02-19 05:32:00 +00:00
|
|
|
Directory = 0,
|
|
|
|
File = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class Mode : u32 {
|
|
|
|
Read = 1,
|
|
|
|
Write = 2,
|
2018-03-20 03:57:34 +00:00
|
|
|
Append = 4,
|
2014-09-11 22:42:59 +00:00
|
|
|
};
|
|
|
|
|
2014-11-10 22:36:32 +00:00
|
|
|
class Path {
|
|
|
|
public:
|
2016-09-19 01:01:46 +00:00
|
|
|
Path() : type(Invalid) {}
|
|
|
|
Path(const char* path) : type(Char), string(path) {}
|
|
|
|
Path(std::vector<u8> binary_data) : type(Binary), binary(std::move(binary_data)) {}
|
2015-05-06 05:29:11 +00:00
|
|
|
Path(LowPathType type, u32 size, u32 pointer);
|
2014-11-10 22:36:32 +00:00
|
|
|
|
2016-09-18 00:38:01 +00:00
|
|
|
LowPathType GetType() const {
|
|
|
|
return type;
|
|
|
|
}
|
2014-11-10 22:36:32 +00:00
|
|
|
|
2014-11-14 00:26:33 +00:00
|
|
|
/**
|
|
|
|
* Gets the string representation of the path for debugging
|
|
|
|
* @return String representation of the path for debugging
|
|
|
|
*/
|
2016-01-25 05:10:05 +00:00
|
|
|
std::string DebugStr() const;
|
2014-11-10 22:36:32 +00:00
|
|
|
|
2016-01-25 05:10:05 +00:00
|
|
|
std::string AsString() const;
|
|
|
|
std::u16string AsU16Str() const;
|
|
|
|
std::vector<u8> AsBinary() const;
|
2014-11-10 22:36:32 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
LowPathType type;
|
|
|
|
std::vector<u8> binary;
|
|
|
|
std::string string;
|
|
|
|
std::u16string u16str;
|
|
|
|
};
|
|
|
|
|
2014-06-27 20:18:56 +00:00
|
|
|
} // namespace FileSys
|