-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdefaultcontroller.cpp
More file actions
55 lines (41 loc) · 1.18 KB
/
Copy pathdefaultcontroller.cpp
File metadata and controls
55 lines (41 loc) · 1.18 KB
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
#include "defaultcontroller.h"
using namespace std;
namespace openrc {
CONTROLLER_REGISTERIMPL(DefaultController)
bool DefaultController::Construct()
{
return true;
}
bool DefaultController::Validate(SessionWeak session, const ControllerArguments& arguments)
{
UNUSED(session)
UNUSED(arguments)
return true;
}
CONTROLLER_ACTIONVALIDATEIMPL(DefaultController, Test, "Test", "Action from test.")
bool DefaultController::TestValidate(SessionWeak session, const ControllerArguments& arguments)
{
UNUSED(session)
UNUSED(arguments)
return true;
}
void DefaultController::Test(SessionWeak sessionWeak, const ControllerArguments& arguments, ControllerOutput& content)
{
auto session = sessionWeak.lock();
content.append("Default Controller: Hello. I am work.\n");
content.append("User: " + std::to_string(session->Id.Id) + ".\n");
for(auto& pair : arguments)
{
content.append(pair.first + " = " + pair.second + "\n");
}
content.append("\n");
auto it = arguments.find("text");
if(it != arguments.end())
{
if( it->second == "Hello" )
{
content.append("Hello User.\n");
}
}
}
} // End http.