mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Add a ListPage module.
This commit is contained in:
parent
7e24a87c57
commit
374fb21257
12
modules/list_page/SCsub
Normal file
12
modules/list_page/SCsub
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env_mod")
|
||||
Import("env")
|
||||
|
||||
env_mod.core_sources = []
|
||||
|
||||
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
|
||||
|
||||
# Build it all as a library
|
||||
lib = env_mod.add_library("list_page", env_mod.core_sources)
|
||||
env.Prepend(LIBS=[lib])
|
27
modules/list_page/detect.py
Normal file
27
modules/list_page/detect.py
Normal file
@ -0,0 +1,27 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
|
||||
|
||||
def is_active():
|
||||
return True
|
||||
|
||||
|
||||
def get_name():
|
||||
return "list_page"
|
||||
|
||||
|
||||
def can_build():
|
||||
return True
|
||||
|
||||
|
||||
def get_opts():
|
||||
return []
|
||||
|
||||
def get_flags():
|
||||
|
||||
return []
|
||||
|
||||
|
||||
def configure(env):
|
||||
pass
|
29
modules/list_page/list_page.cpp
Normal file
29
modules/list_page/list_page.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "list_page.h"
|
||||
|
||||
#include "core/query_builder.h"
|
||||
#include "core/table_builder.h"
|
||||
#include "core/query_result.h"
|
||||
|
||||
void ListPage::index(Request *request) {
|
||||
std::string r = "";
|
||||
|
||||
for (uint32_t i = 0; i < messages.size(); ++i) {
|
||||
r += "<p>" + messages[i] + "</p><br>";
|
||||
}
|
||||
|
||||
r += "";
|
||||
|
||||
request->body += r;
|
||||
|
||||
request->compile_and_send_body();
|
||||
}
|
||||
|
||||
ListPage::ListPage() :
|
||||
Object() {
|
||||
|
||||
messages.push_back("T message 1");
|
||||
messages.push_back("T message 2");
|
||||
}
|
||||
|
||||
ListPage::~ListPage() {
|
||||
}
|
24
modules/list_page/list_page.h
Normal file
24
modules/list_page/list_page.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef LIST_PAGE_H
|
||||
#define LIST_PAGE_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "core/object.h"
|
||||
|
||||
#include "core/request.h"
|
||||
|
||||
|
||||
class ListPage : public Object {
|
||||
RCPP_OBJECT(ListPage, Object);
|
||||
|
||||
public:
|
||||
void index(Request *request);
|
||||
|
||||
ListPage();
|
||||
~ListPage();
|
||||
|
||||
std::vector<std::string> messages;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user