|
1 | 1 | .\" Manpage for jsonrpcstub. |
2 | | -.\" Contact [email protected] to correct errors or typos. |
3 | | -.TH man 1 "06 May 2010" "0.4" "jsonrpcstub man page" |
| 2 | +.\" Contact [email protected] to correct errors or typos. |
| 3 | +.TH man 1 "22 November 2014" "0.4" "jsonrpcstub man page" |
4 | 4 | .SH NAME |
5 | 5 | jsonrpcstub \- genearate stubs for the libjson\-rpc\-cpp framework. |
6 | 6 | .SH SYNOPSIS |
7 | 7 | .B |
8 | | -jsonrpcstub specfile.json [\-\-cpp\-server=namespace::ClassName] |
9 | | -[\-\-cpp\-server\-file=classname.h] [\-\-cpp\-client=namespace::ClassName] |
10 | | -[\-\-cpp\-client-file=classname.h] [\-\-js\-client=ClassName] |
11 | | -[\-\-js-client-file=classname.js] [\-h] [\-v] |
| 8 | +jsonrpcstub specfile.json [\-\-cpp\-server=namespace::ClassName] |
| 9 | + [\-\-cpp\-server\-file=classqname.h] [\-\-cpp\-client=namespace::ClassName] |
| 10 | +[\-\-cpp\-client-file=classname.h] [\-\-js\-client=ClassName] |
| 11 | +[\-\-js-client-file=classname.js] [\-h] [\-v] |
12 | 12 | .PP |
13 | 13 |
|
14 | 14 | .SH DESCRIPTION |
15 | 15 | .PP |
16 | 16 | jsonrpcstub is a tool to generate C++ and JavaScript classes from a procedure specification file. |
| 17 | +.SS SPECIFICATION SYNTAX |
| 18 | +.PP |
| 19 | +The specifictaion file is a JSON file containing all available JSON-RPC methods and notifications |
| 20 | +with their corresponding parameters and return values contained in a top-level JSON array. |
| 21 | +.PP |
| 22 | +.nf |
| 23 | +[ |
| 24 | + { |
| 25 | + "name": "method_with_positional_params", |
| 26 | + "params": [3,4], |
| 27 | + "returns": 7 |
| 28 | + }, |
| 29 | + { |
| 30 | + "name": "methid_with_named_params", |
| 31 | + "params": {"param1": 3, "param2": 4}, |
| 32 | + "returns": 7 |
| 33 | + }, |
| 34 | + { |
| 35 | + "name": "notification_without_parmas" |
| 36 | + } |
| 37 | +] |
| 38 | +.fi |
17 | 39 |
|
| 40 | +.PP |
| 41 | +The literal in each \fB"params"\fP and \fB"returns"\fP section defines the corresponding type. |
| 42 | +If the \fb"params"\fP contains an array, the parameters are accepted by position, |
| 43 | +if it contains an object, they are accepted by name. |
| 44 | +.SH OPTIONS |
| 45 | +.IP -h |
| 46 | +Print usage information. |
| 47 | +.IP -v |
| 48 | +Print verbose information during generation. |
| 49 | +.IP --cpp-server=ClassName |
| 50 | +Creates a Abstract Server class. Namespaces can be provided using the :: notation |
| 51 | +(e.g. ns1::ns2::Classname). |
| 52 | +.IP --cpp-server-file=filename.h |
| 53 | +Defines the filename to use when generating the C++ Abstract Server class. |
| 54 | +If this is not provided, the lowercase classname is used. |
| 55 | +.IP --cpp-client=ClassName |
| 56 | +Creates a C++ client class. Namespaces can be provided using the :: notation |
| 57 | +(e.g. ns1::ns2::Classname). |
| 58 | +.IP --cpp-client-file=filename.h |
| 59 | +Defines the filename to use when generating the C++ client class. |
| 60 | +If this is not provided, the lowercase classname is used. |
| 61 | +.IP --js-client=ClassName |
| 62 | +Creates a JavaScript client class. No namespaces are supported in this option. |
| 63 | +.IP --js-client-file=filename.js |
| 64 | +Defines the filename to use when generating the JavaScrip client class. |
18 | 65 | .SH EXAMPLES |
19 | 66 | .PP |
20 | 67 | Generate C++ Stubs for Server and Client, the classes will be named AbstractStubServer and StubClient: |
| 68 | +.P P |
| 69 | +.B |
| 70 | +\& jsonrpcstub spec.json --cpp--server=AbstractStubServer --cpp-client=StubClient |
| 71 | +.B |
| 72 | +.PP |
| 73 | +Generate JavaScript Client class MyRpcClient into file someclient.js: |
21 | 74 | .PP |
22 | 75 | .B |
23 | | -\& jsonrpcstub <spec.json> --cpp--server=AbstractStubServer<abstractserverstub.h> --cpp-client=StubClient |
| 76 | +\& jsonrpcstub spec.json --js--client=MyRpcClient --js-client-file=someclient.js |
24 | 77 | .B |
25 | 78 | .SH SEE ALSO |
26 | 79 | https://github.com/cinemast/libjson\-rpc\-cpp |
@@ -49,4 +102,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH |
49 | 102 | OR OTHER DEALINGS IN THE SOFTWARE. |
50 | 103 |
|
51 | 104 | .SH AUTHOR |
52 | | -Peter Spiess-Knafl ( [email protected]) |
| 105 | +Peter Spiess-Knafl ( [email protected]) |
0 commit comments