本文整理汇总了C++中PluginResponse::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginResponse::clear方法的具体用法?C++ PluginResponse::clear怎么用?C++ PluginResponse::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginResponse
的用法示例。
在下文中一共展示了PluginResponse::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: call
Status TablePlugin::call(const PluginRequest& request,
PluginResponse& response) {
response.clear();
// TablePlugin API calling requires an action.
if (request.count("action") == 0) {
return Status(1, "Table plugins must include a request action");
}
if (request.at("action") == "generate") {
// "generate" runs the table implementation using a PluginRequest with
// optional serialized QueryContext and returns the QueryData results as
// the PluginRequest data.
QueryContext context;
if (request.count("context") > 0) {
setContextFromRequest(request, context);
}
response = generate(context);
} else if (request.at("action") == "columns") {
// "columns" returns a PluginRequest filled with column information
// such as name and type.
const auto& column_list = columns();
for (const auto& column : column_list) {
response.push_back(
{{"name", column.first}, {"type", columnTypeName(column.second)}});
}
} else if (request.at("action") == "definition") {
response.push_back({{"definition", columnDefinition()}});
} else {
return Status(1, "Unknown table plugin action: " + request.at("action"));
}
return Status(0, "OK");
}