location picker works, needs to be tested more tho

This commit is contained in:
Me
2022-08-10 01:59:10 +02:00
parent 1eb989a3fd
commit 8e90221058
8 changed files with 141 additions and 68 deletions

View File

@@ -19,8 +19,8 @@ std::string ConfigParser::_pre_set_val_check(const std::string key, \
// there shouldn't be any tabs, right? not between values...
if (value.find_first_of("\t") != std::string::npos)
{
std::cout << value << "\n";
throw std::invalid_argument("bad config file arguments 3");
// std::cout << value << "\n";
throw std::invalid_argument("why would you put tabs between values");
}
size_t i = value.find_first_of(";");
@@ -33,11 +33,6 @@ std::string ConfigParser::_pre_set_val_check(const std::string key, \
throw std::invalid_argument("bad config file arguments 4");
// we Trim value.
// is this valid?
// would it be better to shove the result directly in tmp_val?
// like call substr in split?
//value = value.substr(0, i - 1);
return (value.substr(0, i));
}
@@ -68,17 +63,10 @@ std::string ConfigParser::_get_rest_of_line(size_t *curr)
if ((start = _content.find_first_not_of(" \t\n", *curr)) == std::string::npos)
throw std::invalid_argument("bad config file arguments");
// std::cout << "start + 4 = " << _content.substr(start, 4) << "\n";
// std::cout << "curr + 4 = " << _content.substr(*curr, 4) << "\n";
if ((*curr = _content.find_first_of("\n", start)) == std::string::npos)
throw std::invalid_argument("bad config file arguments");
std::string values = _content.substr(start, *curr - start);
// std::cout << "rest of Line values: " << values << "\n";
return (values);
}
@@ -90,4 +78,3 @@ void ConfigParser::_print_content() const
std::cout << _content;
}
// I might need to make my own Exceptions to throw...