1/*************************************************************************
2 * libjson-rpc-cpp
3 *************************************************************************
4 * @file specificationparser.h
5 * @date 12.03.2013
6 * @author Peter Spiess-Knafl <dev@spiessknafl.at>
7 * @license See attached LICENSE.txt
8 ************************************************************************/
9
10#ifndef JSONRPC_CPP_SPECIFICATIONPARSER_H
11#define JSONRPC_CPP_SPECIFICATIONPARSER_H
12
13#include "exception.h"
14#include "procedure.h"
15
16namespace jsonrpc {
17
18 class SpecificationParser {
19 public:
20 static std::vector<Procedure> GetProceduresFromFile(const std::string &filename);
21 static std::vector<Procedure> GetProceduresFromString(const std::string &spec);
22
23 static void GetFileContent(const std::string &filename, std::string &target);
24
25 private:
26 static void GetProcedure(Json::Value &val, Procedure &target);
27 static void GetMethod(Json::Value &val, Procedure &target);
28 static void GetNotification(Json::Value &val, Procedure &target);
29 static jsontype_t toJsonType(Json::Value &val);
30
31 static void GetPositionalParameters(Json::Value &val, Procedure &target);
32 static void GetNamedParameters(Json::Value &val, Procedure &target);
33 static std::string GetProcedureName(Json::Value &signature);
34 };
35} // namespace jsonrpc
36#endif // JSONRPC_CPP_SPECIFICATIONPARSER_H
37