/****************************************************************************
* Copyright (C) 2016-2021 Maschell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
****************************************************************************/
#pragma once
#include
#include
#include
#include
#include
#include
#include "NodeEntryParam.h"
#define ENTRY_TYPE_File 0
#define ENTRY_TYPE_Directory 1
#define ENTRY_TYPE_Link 0x80
class DirectoryEntry;
class NodeEntry {
public:
uint16_t permission{};
std::shared_ptr nameString;
std::shared_ptr sectionEntry;
std::optional> parent;
uint8_t entryType{};
uint32_t entryNumber{};
static std::optional>
AutoDeserialize(const std::vector &data,
uint32_t offset,
const std::optional> &pParent,
uint32_t eEntryNumber,
const std::shared_ptr §ionEntries,
const std::shared_ptr &stringTable, const SectionBlockSize &blockSize);
virtual ~NodeEntry() = default;
virtual void printPathRecursive();
[[nodiscard]] std::string getFullPath();
[[nodiscard]] std::string getPath();
[[nodiscard]] std::string getName();
[[nodiscard]] bool isDirectory() const;
[[nodiscard]] bool isFile() const;
static constexpr uint32_t LENGTH = 16;
[[nodiscard]] std::string getFullPathInternal();
protected:
NodeEntry(uint16_t pPermission,
std::shared_ptr pNameString,
std::shared_ptr pSectionEntry,
std::optional> pParent,
uint8_t pType,
uint32_t pEntryNumber);
};