mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 13:27:59 +03:00
changes...
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#ifndef TOKENIZER_HPP
|
||||
#define TOKENIZER_HPP
|
||||
|
||||
#include "webserv.hpp"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -6,7 +9,6 @@
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
|
||||
namespace config
|
||||
{
|
||||
enum e_token
|
||||
@@ -29,7 +31,7 @@ namespace config
|
||||
{
|
||||
std::string value;
|
||||
e_token type;
|
||||
std::string to_string(void);
|
||||
/* std::string to_string(void); */
|
||||
};
|
||||
|
||||
class Tokenizer
|
||||
@@ -38,10 +40,17 @@ namespace config
|
||||
std::fstream file;
|
||||
size_t prev_pos;
|
||||
public:
|
||||
Tokenizer(std::string filename);
|
||||
Tokenizer(std::string filename)
|
||||
{
|
||||
file.open(filename.c_str(), std::ios::in);
|
||||
if (!file.good())
|
||||
{
|
||||
std::cerr << "file didn't open" << std::endl;
|
||||
}
|
||||
}
|
||||
char getWithoutWhiteSpace();
|
||||
struct s_token getToken();
|
||||
void *hasMoreTokens();
|
||||
bool hasMoreTokens();
|
||||
void rollBackToken();
|
||||
};
|
||||
|
||||
@@ -61,6 +70,11 @@ namespace config
|
||||
return (c);
|
||||
}
|
||||
|
||||
bool Tokenizer::hasMoreTokens(void)
|
||||
{
|
||||
return (!file.eof());
|
||||
}
|
||||
|
||||
void Tokenizer::rollBackToken(void)
|
||||
{
|
||||
if (file.eof())
|
||||
@@ -143,3 +157,5 @@ namespace config
|
||||
return (token);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user