Files
FEX-Emu--FEX/Source/Common/ArgumentLoader.h
T
Ryan Houdek a5d3692b53 ArgumentLoader: Removes static fextl::vector usage
Removes a global initializer and atexit registration

Ownership of this data has always been the frontend and the config
system, we just used these static vectors as a side-channel.
2024-07-12 04:48:22 -07:00

47 lines
991 B
C++

// SPDX-License-Identifier: MIT
#pragma once
#include <FEXCore/Config/Config.h>
#include <FEXCore/fextl/string.h>
#include <FEXCore/fextl/vector.h>
namespace FEX::ArgLoader {
class ArgLoader final : public FEXCore::Config::Layer {
public:
enum class LoadType {
WITH_FEXLOADER_PARSER,
WITHOUT_FEXLOADER_PARSER,
};
explicit ArgLoader(LoadType Type, int argc, char** argv)
: FEXCore::Config::Layer(FEXCore::Config::LayerType::LAYER_ARGUMENTS)
, Type {Type}
, argc {argc}
, argv {argv} {
Load();
}
void Load() override;
void LoadWithoutArguments();
fextl::vector<fextl::string> Get() {
return RemainingArgs;
}
fextl::vector<fextl::string> GetParsedArgs() {
return ProgramArguments;
}
LoadType GetLoadType() const {
return Type;
}
private:
LoadType Type;
int argc {};
char** argv {};
fextl::vector<fextl::string> RemainingArgs {};
fextl::vector<fextl::string> ProgramArguments {};
};
} // namespace FEX::ArgLoader