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