-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonutil.h
46 lines (36 loc) · 1.15 KB
/
jsonutil.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
//
// Created by liyang77 on 2019/12/20.
//
#ifndef ESEARCH_ALL_JSONUTIL_H
#define ESEARCH_ALL_JSONUTIL_H
#include "reader.h"
#include "writer.h"
#include "value.h"
#include "json.h"
//#include "json_value.cpp"
//#include "json_writer.cpp"
//#include "json_reader.cpp"
#include <sharelib/dll/properties.h>
#include <indexlib/common.h>
#include <indexlib/util/log.h>
using namespace sharelib;
using namespace std;
INDEXLIB_BEGIN_NS(index);
class JsonUtil {
public:
JsonUtil();
~JsonUtil() {}
public:
bool Init();
static size_t GetFieldCnt(char *src, std::map<std::string, std::string> &values, std::string id1, std::string id2);
static size_t GetFullBuildFieldCnt(char *src, int fieldCnt,std::map<std::string, std::string> &values, std::string id1, std::string id2);
static std::string GetDocId(const char *src);
static uint64_t GetDocTime(const char *src);
static int GetScore(const char *src);
static void WriteJson(std::string &result, int code, std::string msg);
private:
LOG_DECLARE();
};
TYPEDEF_SHARED_PTR(JsonUtil);
INDEXLIB_END_NS(index);
#endif //ESEARCH_ALL_JSONUTIL_H