2021-06-11 19:24:52 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// MassBuilderSaveTool
|
2022-01-30 11:36:56 +01:00
|
|
|
// Copyright (C) 2021-2022 Guillaume Jacquemin
|
2021-06-11 19:24:52 +02:00
|
|
|
//
|
|
|
|
// 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 <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2022-03-30 20:34:37 +02:00
|
|
|
#include <Corrade/Containers/StaticArray.h>
|
2022-03-04 21:18:55 +01:00
|
|
|
#include <Corrade/Containers/String.h>
|
|
|
|
#include <Corrade/Containers/StringView.h>
|
2021-06-11 19:24:52 +02:00
|
|
|
|
|
|
|
#include "../Mass/Mass.h"
|
|
|
|
|
|
|
|
using namespace Corrade;
|
|
|
|
|
|
|
|
class MassManager {
|
|
|
|
public:
|
2022-03-04 21:18:55 +01:00
|
|
|
MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2022-03-04 21:18:55 +01:00
|
|
|
auto lastError() -> Containers::StringView;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2021-08-19 20:33:59 +02:00
|
|
|
auto hangar(int hangar) -> Mass&;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
|
|
|
void refreshHangar(int hangar);
|
|
|
|
|
2022-03-04 21:18:55 +01:00
|
|
|
auto importMass(Containers::StringView staged_fn, int hangar) -> bool;
|
2021-06-11 19:24:52 +02:00
|
|
|
auto exportMass(int hangar) -> bool;
|
|
|
|
|
|
|
|
auto moveMass(int source, int destination) -> bool;
|
|
|
|
auto deleteMass(int hangar) -> bool;
|
|
|
|
|
2022-03-04 21:18:55 +01:00
|
|
|
auto stagedMasses() -> std::map<Containers::String, Containers::String> const&;
|
2021-06-11 19:24:52 +02:00
|
|
|
void refreshStagedMasses();
|
2022-04-04 10:37:09 +02:00
|
|
|
void refreshStagedMass(Containers::StringView filename);
|
2022-03-04 21:18:55 +01:00
|
|
|
auto deleteStagedMass(Containers::StringView filename) -> bool;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
|
|
|
private:
|
2022-03-04 21:18:55 +01:00
|
|
|
Containers::StringView _saveDirectory;
|
|
|
|
Containers::StringView _account;
|
2021-06-11 19:24:52 +02:00
|
|
|
bool _demo;
|
|
|
|
|
2022-03-04 21:18:55 +01:00
|
|
|
Containers::String _lastError;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2022-03-30 20:34:37 +02:00
|
|
|
Containers::StaticArray<32, Mass> _hangars{NoInit};
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2022-03-04 21:18:55 +01:00
|
|
|
Containers::StringView _stagingAreaDirectory;
|
2021-06-11 19:24:52 +02:00
|
|
|
|
2022-03-04 21:18:55 +01:00
|
|
|
std::map<Containers::String, Containers::String> _stagedMasses;
|
2021-06-11 19:24:52 +02:00
|
|
|
};
|