-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawer.cpp
47 lines (36 loc) · 839 Bytes
/
Drawer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <vector>
#include <iostream>
#include "Drawer.hh"
Drawer::Drawer(){}
Drawer::~Drawer(){}
std::string
Drawer::draw(std::vector<std::string> paramList){
if(paramList.size()<=3){
while(paramList.size()<3){
paramList.push_back("0");
}
#ifdef DEBUG
std::cout<<"=====DEBUG INFO====="<< std::endl;
for (auto it = paramList.begin(); it!= paramList.end(); it++){
std::cout<<"param:"<<*it<<std::endl;
}
std::cout<<"==END OF DEBUG INFO==\n"<<std::endl;
#endif
std::string result = "";
for (auto it = paramList.begin(); it!= paramList.end(); it++){
try{
std::stod(*it);
}
catch(...)
{
std::cout <<"WARNING: illegal parameter has been replace with 0"<< std::endl;
*it = "0";
}
result += *it + " ";
}
return result;
}
else{
return "too many parameters";
}
}