-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecutor.h
More file actions
24 lines (23 loc) · 824 Bytes
/
Copy pathexecutor.h
File metadata and controls
24 lines (23 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include "filters.h"
#include <vector>
#include <string>
#include <map>
void Executor(Image& image, std::map<std::string, std::vector<std::string>>& args) {
for (const auto& filter : args) {
if (filter.first == "-neg") {
Negative neg(image);
} else if (filter.first == "-gs") {
Grayscale gs(image);
} else if (filter.first == "-crop") {
if (filter.second.size() < 2) {
throw std::runtime_error("not enough arguments or incorrect input for -crop");
}
int width = std::stoi(filter.second[0]);
int height = std::stoi(filter.second[1]);
Crop crop(image, width, height);
} else {
throw std::runtime_error("not enough arguments or incorrect input");
}
}
}