MassBuilderSaveTool/src/MassManager/MassManager.h

63 lines
2.0 KiB
C++

#pragma once
// MassBuilderSaveTool
// Copyright (C) 2021-2022 Guillaume Jacquemin
//
// 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>
#include <Corrade/Containers/StaticArray.h>
#include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringView.h>
#include "../Mass/Mass.h"
using namespace Corrade;
class MassManager {
public:
MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir);
auto lastError() -> Containers::StringView;
auto hangar(int hangar) -> Mass&;
void refreshHangar(int hangar);
auto importMass(Containers::StringView staged_fn, int hangar) -> bool;
auto exportMass(int hangar) -> bool;
auto moveMass(int source, int destination) -> bool;
auto deleteMass(int hangar) -> bool;
auto stagedMasses() -> std::map<Containers::String, Containers::String> const&;
void refreshStagedMasses();
void refreshStagedMass(Containers::StringView filename);
auto deleteStagedMass(Containers::StringView filename) -> bool;
private:
Containers::StringView _saveDirectory;
Containers::StringView _account;
bool _demo;
Containers::String _lastError;
Containers::StaticArray<32, Mass> _hangars{NoInit};
Containers::StringView _stagingAreaDirectory;
std::map<Containers::String, Containers::String> _stagedMasses;
};