Moved C++ tools out
This commit is contained in:
57
archive/dawntools/util/DawnTool.hpp
Normal file
57
archive/dawntools/util/DawnTool.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawnsharedlibs.hpp"
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
namespace Dawn {
|
||||
class DawnTool {
|
||||
protected:
|
||||
std::vector<std::string> args;
|
||||
std::map<std::string, std::string> flags;
|
||||
|
||||
/**
|
||||
* Get the required flags for this tool. These flags will be checked in
|
||||
* the passed args to the CLI.
|
||||
*
|
||||
* @return Array of required flags.
|
||||
*/
|
||||
virtual std::vector<std::string> getRequiredFlags();
|
||||
|
||||
/**
|
||||
* Get the optional flags for this tool. Mapped by key value pair where
|
||||
* the value is some default value you want for your tool.
|
||||
*
|
||||
* @return Array of optional flags.
|
||||
*/
|
||||
virtual std::map<std::string, std::string> getOptionalFlags();
|
||||
|
||||
public:
|
||||
int32_t *test;
|
||||
|
||||
/**
|
||||
* Execute the Dawn Tool from the CLI, functionally identically to main()
|
||||
*
|
||||
* @param argc Count of arguments in the array.
|
||||
* @param argv Array of arguments.
|
||||
* @return int32_t
|
||||
*/
|
||||
int32_t exec(const int32_t argc, const char *argv[]);
|
||||
|
||||
/**
|
||||
* Overridable start method after the tool has been set up.
|
||||
*
|
||||
* @return 0 for success, otherwise for failure.
|
||||
*/
|
||||
virtual int32_t start() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
int main(const int32_t argc, const char *argv[]);
|
Reference in New Issue
Block a user