mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
Merge branch 'roman' of github.com:3lswear/webserv into roman
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
name = "jopa"
|
||||
port = 6969
|
||||
ip = "127.0.0.1"
|
||||
methods = ["GET", "POST", 1, "piska", false, false]
|
||||
|
||||
@@ -104,6 +104,15 @@ class toml_node
|
||||
*result += " ]";
|
||||
return (result);
|
||||
}
|
||||
case BOOL:
|
||||
{
|
||||
std::string *result;
|
||||
if (value.boolean)
|
||||
result = new std::string("true");
|
||||
else
|
||||
result = new std::string("false");
|
||||
return (result);
|
||||
}
|
||||
default:
|
||||
return ( new std::string("Not implemented :)"));
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace config
|
||||
}
|
||||
case BOOL:
|
||||
{
|
||||
tokenizer.rollBackToken();
|
||||
(*mapObject)[key] = parseBool();
|
||||
break;
|
||||
}
|
||||
@@ -197,8 +198,10 @@ namespace config
|
||||
s_token token = tokenizer.getToken();
|
||||
if (token.value == "true")
|
||||
value = true;
|
||||
else
|
||||
else if (token.value == "false")
|
||||
value = false;
|
||||
else
|
||||
throw std::invalid_argument("Unexpected bool value");
|
||||
node->setBool(value);
|
||||
|
||||
return (node);
|
||||
|
||||
@@ -209,12 +209,25 @@ namespace config
|
||||
token.type = BOOL;
|
||||
token.value = "false";
|
||||
file.seekg(4, std::ios_base::cur);
|
||||
|
||||
/* token.value = ""; */
|
||||
/* while (std::isalpha(c)) */
|
||||
/* { */
|
||||
/* token.value += c; */
|
||||
/* file.get(c); */
|
||||
/* } */
|
||||
std::cerr << "value is: " << token.value << std::endl;
|
||||
std::cerr << "c is: " << c << std::endl;
|
||||
}
|
||||
else if (c == 't')
|
||||
{
|
||||
token.type = BOOL;
|
||||
token.value = "true";
|
||||
file.seekg(3, std::ios_base::cur);
|
||||
while (std::isalpha(c))
|
||||
{
|
||||
token.value += c;
|
||||
file.get(c);
|
||||
}
|
||||
/* file.seekg(3, std::ios_base::cur); */
|
||||
}
|
||||
else if (c == 'n')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user