MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
静态 Public 成员函数 | 所有成员列表
oceanbase::JsonConverter类 参考

A utility class to convert between JSON and user-defined types. 更多...

#include <ob_manifest.h>

静态 Public 成员函数

template<typename T >
static Json::Value to_json (const T &t)
 Converts an object of type T to a JSON value. 更多...
 
template<typename T >
static RC from_json (const Json::Value &v, T &t)
 Converts a JSON value to an object of type T. 更多...
 
template<>
Json::Value to_json (const CompactionType &type)
 Specialization of to_json() for CompactionType. 更多...
 
template<>
RC from_json (const Json::Value &v, CompactionType &type)
 Specialization of from_json() for CompactionType. 更多...
 

详细描述

A utility class to convert between JSON and user-defined types.

Provides template methods for converting an object to JSON and vice versa. Specialized template functions exist for specific types like CompactionType.

成员函数说明

◆ from_json() [1/2]

template<>
RC oceanbase::JsonConverter::from_json ( const Json::Value &  v,
CompactionType &  type 
)
inlinestatic

Specialization of from_json() for CompactionType.

Converts a JSON value representing an integer into a CompactionType.

参数
vThe JSON value to convert.
typeThe CompactionType value that will be populated from the JSON value.
返回
An RC indicating the result of the operation.

◆ from_json() [2/2]

template<typename T >
static RC oceanbase::JsonConverter::from_json ( const Json::Value &  v,
T &  t 
)
inlinestatic

Converts a JSON value to an object of type T.

This function uses the from_json() method of the type T to convert the JSON value.

模板参数
TThe type of the object.
参数
vThe JSON value to be converted.
tThe object that will be populated from the JSON value.
返回
An RC indicating the result of the operation.

◆ to_json() [1/2]

template<>
Json::Value oceanbase::JsonConverter::to_json ( const CompactionType &  type)
inlinestatic

Specialization of to_json() for CompactionType.

Converts a CompactionType value to its integer representation in JSON format.

参数
typeThe CompactionType value to convert.
返回
A JSON value representing the integer value of CompactionType.

◆ to_json() [2/2]

template<typename T >
static Json::Value oceanbase::JsonConverter::to_json ( const T &  t)
inlinestatic

Converts an object of type T to a JSON value.

This function uses the to_json() method of the type T to convert it to JSON.

模板参数
TThe type of the object.
参数
tThe object to be converted.
返回
The JSON value representing the object.

该类的文档由以下文件生成: