matc: minor cleanup
This commit is contained in:
committed by
Mathias Agopian
parent
4dc03318e8
commit
9c4783142e
@@ -14,29 +14,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include "matc/Compiler.h"
|
||||
#include "matc/CommandlineConfig.h"
|
||||
#include "matc/MaterialCompiler.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace matc;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
CommandlineConfig parameters(argc, argv);
|
||||
if (!parameters.isValid()) {
|
||||
CommandlineConfig config(argc, argv);
|
||||
if (!config.isValid()) {
|
||||
std::cerr << "Invalid parameters." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
const std::unique_ptr<Compiler> compiler = std::make_unique<MaterialCompiler>();
|
||||
|
||||
if (!compiler->start(parameters)) {
|
||||
MaterialCompiler compiler;
|
||||
if (!compiler.compile(config)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
explicit FilesystemOutput(const char* path) : mPath(path) {
|
||||
}
|
||||
|
||||
virtual ~FilesystemOutput() {}
|
||||
~FilesystemOutput() override = default;
|
||||
|
||||
bool open() noexcept override {
|
||||
mFile.open(mPath.c_str(), std::ofstream::out | std::ofstream::binary);
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
explicit FilesystemInput(const char* path) : mPath(path) {
|
||||
}
|
||||
|
||||
virtual ~FilesystemInput() {}
|
||||
~FilesystemInput() override = default;
|
||||
|
||||
ssize_t open() noexcept override {
|
||||
mFile.open(mPath.c_str(), std::ifstream::binary | std::ios::ate);
|
||||
@@ -101,7 +101,7 @@ class CommandlineConfig : public Config {
|
||||
public:
|
||||
|
||||
CommandlineConfig(int argc, char** argv);
|
||||
virtual ~CommandlineConfig() {
|
||||
~CommandlineConfig() override {
|
||||
delete mInput;
|
||||
delete mOutput;
|
||||
};
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace matc {
|
||||
|
||||
class Compiler {
|
||||
public:
|
||||
virtual ~Compiler() {}
|
||||
virtual ~Compiler() = default;
|
||||
|
||||
bool start(const Config& config) {
|
||||
bool compile(const Config& config) {
|
||||
if (!checkParameters(config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user