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