EnvironmentLoader/source/module/ImportRPLInformation.h

54 lines
1.6 KiB
C
Raw Normal View History

2021-12-25 20:14:56 +01:00
/****************************************************************************
2022-05-13 17:01:19 +02:00
* 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/>.
****************************************************************************/
2021-12-25 20:14:56 +01:00
#pragma once
#include "utils/logger.h"
2022-05-13 17:01:19 +02:00
#include <coreinit/debug.h>
#include <memory>
2021-12-25 20:14:56 +01:00
#include <optional>
#include <string>
2021-12-25 20:14:56 +01:00
#include <utility>
class ImportRPLInformation {
public:
2022-05-13 17:01:19 +02:00
explicit ImportRPLInformation(std::string rawSectionName) {
this->name = std::move(rawSectionName);
2021-12-25 20:14:56 +01:00
}
~ImportRPLInformation() = default;
2022-05-13 17:01:19 +02:00
[[nodiscard]] const std::string &getName() const {
return name;
2021-12-25 20:14:56 +01:00
}
2022-05-13 17:01:19 +02:00
[[nodiscard]] const char *getRPLName() const {
if (name.max_size() < strlen("._import_") + 1) {
2023-06-16 17:17:33 +02:00
OSFatal("EnvironmentLoader: Invalid RPLName, is too short to be valid");
2022-05-13 17:01:19 +02:00
}
return name.c_str() + strlen("._import_");
2021-12-25 20:14:56 +01:00
}
[[nodiscard]] bool isData() const {
2022-05-13 17:01:19 +02:00
return name.starts_with(".dimport_");
2021-12-25 20:14:56 +01:00
}
private:
std::string name;
};