/usr/include/jsonrpccpp/client/batchresponse.h is in libjsonrpccpp-dev 0.7.0-1+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 69 70 71 72 | /*************************************************************************
* libjson-rpc-cpp
*************************************************************************
* @file batchresponse.h
* @date 10/9/2014
* @author Peter Spiess-Knafl <peter.knafl@gmail.com>
* @license See attached LICENSE.txt
************************************************************************/
#ifndef JSONRPC_BATCHRESPONSE_H
#define JSONRPC_BATCHRESPONSE_H
#include <map>
#include <jsonrpccpp/common/jsonparser.h>
namespace jsonrpc {
/**
* @brief The BatchResponse class provides a simple interface for handling batch responses.
*/
class BatchResponse
{
public:
BatchResponse();
/**
* @brief addResponse method is used only internally by the framework
* @param id
* @param response
* @param isError
*/
void addResponse(Json::Value& id, Json::Value response, bool isError = false);
/**
* @brief getResult method gets the result for a given request id (returned by BatchCall::addCall.
* You should always invoke getErrorCode() first to check if the result is valid.
* @param id
* @return
*/
Json::Value getResult(Json::Value& id);
Json::Value getResult(int id);
void getResult(Json::Value& id, Json::Value &result);
/**
* @brief getErrorCode method checks if for a given id, an error occurred in the batch request.
* @param id
*/
int getErrorCode(Json::Value& id);
/**
* @brief getErrorMessage method gets the corresponding error message.
* @param id
* @return the error message in case of an error, an empty string if no error was found for the provided id.
*/
std::string getErrorMessage(Json::Value& id);
std::string getErrorMessage(int id);
bool hasErrors();
private:
std::map<Json::Value, Json::Value> responses;
std::vector<Json::Value> errorResponses;
};
} // namespace jsonrpc
#endif // JSONRPC_BATCHRESPONSE_H
|