-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponse.h
68 lines (59 loc) · 1.71 KB
/
response.h
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
58
59
60
61
62
63
64
65
66
67
68
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <set>
typedef vector<class Context *> ContextList;
struct ResponseContext {
ContextList contexts;
int32_t total;
};
struct CreateInfo {
int32_t structure_id;
int32_t row_id;
};
typedef struct ResponseContext ResponseContext;
typedef vector<ResponseContext> ResponseContextList;
typedef struct CreateInfo CreateInfo;
typedef vector<CreateInfo> CreateInfoList;
class Response {
enum SortType {None, Reverse, Shuffle, Specific};
enum SortOrder {Asc, Desc};
struct SortField {
string field;
bool count;
SortOrder direction;
};
ResponseContextList contexts;
CreateInfoList createInfos;
vector<string> data;
bool filter;
vector<char *> filterTerms;
vector<char *> filterRemainingTerms;
int groups;
int page;
int paginate;
boost::shared_ptr<Site> site;
vector<SortField> sortFields;
SortType sortType;
int skip;
bool unique;
vector<string> uniqueFields;
set<string> uniqueFound;
public:
Response(boost::shared_ptr<Site> s, boost::shared_ptr<Response> parent, const string &q, const map<string, string> &options);
Response(boost::shared_ptr<Site> s, boost::shared_ptr<Response> parent, const string &query);
~Response();
bool containsContexts();
bool sortCallback(Context *lhs, Context *rhs);
json getCreateInfo();
json getData();
json getJson();
json getStructure();
private:
void createInfo(Context *context, const string &query);
bool filterMatch(xmlNode *node);
void filterMatchRecursive(xmlNode *node, int reentry);
void query(Context *context, const string &q, const map<string, string> &options);
bool uniqueMatch(xmlNode *node);
};