-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cc
More file actions
43 lines (39 loc) · 897 Bytes
/
main.cc
File metadata and controls
43 lines (39 loc) · 897 Bytes
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
#include <iostream>
#include <vector>
#include "include/myserver.h"
#include "include/htmlgenerator.h"
#include <string>
using namespace std;
typedef void (*voidf)(string);
//main program
void examplefunction(string s)
{
cout << s << endl;
}
void newForm(string s)
{
htmlgenerator::newForm(s);
}
void addFormToServer(myserver * server)
{
server->addContent(htmlgenerator::getForm());
}
void addFormInput(myserver * server, string s, voidf f)
{
htmlgenerator::addInput(s);
server->mapFunction(s,f);
}
int main()
{
myserver * server=new myserver(8080,4);
newForm("POST");
addFormInput(server,"test",&examplefunction);
addFormInput(server,"test2",&examplefunction);
addFormToServer(server);
newForm("POST");
addFormInput(server,"test3",&examplefunction);
addFormInput(server,"test4",&examplefunction);
addFormToServer(server);
server->runServer();
return 0;
}