EnvironmentLoader/source/module/ImportRPLInformation.h
2023-06-16 17:27:39 +02:00

54 lines
1.6 KiB
C++

/****************************************************************************
* Copyright (C) 2018 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#pragma once
#include "utils/logger.h"
#include <coreinit/debug.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
class ImportRPLInformation {
public:
explicit ImportRPLInformation(std::string rawSectionName) {
this->name = std::move(rawSectionName);
}
~ImportRPLInformation() = default;
[[nodiscard]] const std::string &getName() const {
return name;
}
[[nodiscard]] const char *getRPLName() const {
if (name.max_size() < strlen("._import_") + 1) {
OSFatal("EnvironmentLoader: Invalid RPLName, is too short to be valid");
}
return name.c_str() + strlen("._import_");
}
[[nodiscard]] bool isData() const {
return name.starts_with(".dimport_");
}
private:
std::string name;
};