mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@5213 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9d402a9424
commit
aca50d2d87
1 changed files with 12 additions and 0 deletions
|
|
@ -17,6 +17,15 @@ RPC_METHOD(Multiply2)
|
|||
rpc = m * n;
|
||||
}
|
||||
|
||||
RPC_METHOD(Divide)
|
||||
{
|
||||
int m = rpc++;
|
||||
int n = rpc++;
|
||||
if(n == 0)
|
||||
ThrowRpcError("divide by zero");
|
||||
rpc = m / n;
|
||||
}
|
||||
|
||||
RPC_METHOD(MultiplyNamed)
|
||||
{
|
||||
int n = rpc["first"];
|
||||
|
|
@ -26,6 +35,7 @@ RPC_METHOD(MultiplyNamed)
|
|||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
// LogXmlRpcRequests();
|
||||
// SetXmlRpcServerTrace(UppLog());
|
||||
// Working in "shortened" mode - without URL specified, RpcRequests are performed by methods in
|
||||
|
|
@ -35,4 +45,6 @@ CONSOLE_APP_MAIN
|
|||
DUMP(JsonRpcRequest()("Multiply2", 4, 5).Execute());
|
||||
DUMP(XmlRpcRequest()("Multiply2", 6, 7).Execute());
|
||||
DUMP(JsonRpcRequestNamed()("MultiplyNamed")("first", 8)("second", 9).Execute());
|
||||
DUMP(JsonRpcRequest()("Divide", 2, 0).Execute());
|
||||
DUMP(JsonRpcRequest()("Divide", 20, 4).Execute());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue