-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirective.hpp
57 lines (43 loc) · 1.77 KB
/
Directive.hpp
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
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <algorithm>
#include <iterator>
#include <string>
class Logger;
class Directive {
public:
Directive(std::vector<std::string>::iterator &iterator,
std::vector<std::string> &lines,
const Logger& logger);
~Directive();
const std::string& getKey( void ) const;
int getLine( void ) const;
const std::vector<std::string>& getArguments( void ) const;
const std::vector<Directive>& getSubdirectives( void ) const;
std::vector<std::string>::const_iterator getArgumentsIterator( void ) const;
std::vector<std::string>::const_iterator getArgumentsEnd( void ) const;
std::vector<Directive>::const_iterator getSubdirectivesIterator( void ) const;
std::vector<Directive>::const_iterator getSubdirectivesEnd( void ) const;
std::vector<Directive>::iterator getSubdirectivesMutableIterator( void );
std::vector<Directive>::iterator getSubdirectivesMutableEnd( void );
const std::string& getPrimaryServerName( void ) const;
bool operator==(const std::string& str) const;
void setParents(Directive* parent);
void validate(const Logger& l,
const std::vector<Directive>::const_iterator& context_start,
const std::vector<Directive>::const_iterator& context_current) const;
// Argument validators for specific directives
void client_max_body_size_validator(const Logger& l) const;
void error_page_validator(const Logger& l) const;
void return_validator(const Logger& l) const;
private:
std::string key;
int line;
std::vector<std::string> arguments;
std::vector<Directive> subdirectives;
Directive* parent;
};