Skip to content

Commit 75d20c4

Browse files
authored
Merge pull request #3 from wsjcpp/version-0.0.3
Version 0.0.3
2 parents 91631a7 + 52df854 commit 75d20c4

29 files changed

+1883
-372
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# wsjcpp-jsonrpc20
22

3-
[![Build Status](https://api.travis-ci.com/wsjcpp/wsjcpp-jsonrpc20.svg?branch=master)](https://travis-ci.com/wsjcpp/wsjcpp-jsonrpc20)
3+
[![Build Status](https://api.travis-ci.com/wsjcpp/wsjcpp-jsonrpc20.svg?branch=master)](https://travis-ci.com/wsjcpp/wsjcpp-jsonrpc20) [![Total alerts](https://img.shields.io/lgtm/alerts/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/context:cpp) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/wsjcpp/wsjcpp-jsonrpc20.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-jsonrpc20/context:python)
44

55
C++ Implementation for JsonRPC 2.0 (oriented on websockets)
66

example-of-exported/py3/API.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SomeClient Python Library
22

33
Automatically generated by wsjcpp-jsonrpc20.
4-
* Version: v0.0.2
5-
* Date: Sun, 13 Sep 2020 19:26:47 GMT
4+
* Version: v0.0.3
5+
* Date: Fri, 18 Sep 2020 03:27:31 GMT
66

77
Example connect/disconnect:
88
```

example-of-exported/py3/libwsjcppjson20client/SomeClient.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
### This file was automatically generated by wsjcpp-jsonrpc20
4-
### Version: v0.0.2
5-
### Date: Sun, 13 Sep 2020 19:26:47 GMT
4+
### Version: v0.0.3
5+
### Date: Fri, 18 Sep 2020 03:27:31 GMT
66

77
import asyncio
88
import websocket
@@ -13,7 +13,7 @@
1313
class SomeClient:
1414
__ws = None
1515
__url = None
16-
__cli_version = 'v0.0.2'
16+
__cli_version = 'v0.0.3'
1717
__loop = None
1818
__token = None
1919
__connecting = False
@@ -45,7 +45,7 @@ def hasConnection(self):
4545
def getToken(self):
4646
return self.__token
4747
def setToken(self, token):
48-
if self.__token == None:
48+
if self.__token is None:
4949
self.__token = token
5050
else:
5151
print('ERROR: Token can be set only once')
@@ -56,10 +56,10 @@ def close(self):
5656
self.__ws = None
5757

5858
def receiveIncomingMesssages(self):
59-
if self.__ws == None:
59+
if self.__ws is None:
6060
return None # TODO has not connection
6161
while True:
62-
if self.__ws == None:
62+
if self.__ws is None:
6363
return None # TODO has not connection
6464
ready = select.select([self.__ws], [], [], 1)
6565
if ready[0]:
@@ -83,7 +83,7 @@ async def __looper(self, messageId):
8383
max_time = 5*10 # 5 seconds
8484
counter_time = 0
8585
while True:
86-
if self.__ws == None:
86+
if self.__ws is None:
8787
return None # TODO has not connection
8888
for inmsg in self.__incomingMesssages:
8989
if inmsg['id'] == messageId:
@@ -130,7 +130,7 @@ def __sendCommand(self, req):
130130
return result
131131

132132
def preprocessIncomeJson(self, jsonIn):
133-
if jsonIn == None:
133+
if jsonIn is None:
134134
return jsonIn
135135
if jsonIn['method'] == 'auth_logoff' and 'result' in jsonIn:
136136
self.__token = None
@@ -157,12 +157,12 @@ def auth_login(self, login, password, client_app_name = None, client_app_version
157157
"""
158158
if not self.hasConnection(): return None
159159
reqJson = self.generateBaseCommand('auth_login')
160-
if login == None:
160+
if login is None:
161161
raise Exception('Parameter "login" expected (lib: SomeClient.auth_login)')
162162
if not isinstance(login, str):
163163
raise Exception('Parameter "login" expected datatype "str" (lib: SomeClient.auth_login )')
164164
reqJson['params']['login'] = login
165-
if password == None:
165+
if password is None:
166166
raise Exception('Parameter "password" expected (lib: SomeClient.auth_login)')
167167
if not isinstance(password, str):
168168
raise Exception('Parameter "password" expected datatype "str" (lib: SomeClient.auth_login )')
@@ -207,7 +207,7 @@ def auth_token(self, token, client_app_name = None, client_app_version = None):
207207
"""
208208
if not self.hasConnection(): return None
209209
reqJson = self.generateBaseCommand('auth_token')
210-
if token == None:
210+
if token is None:
211211
raise Exception('Parameter "token" expected (lib: SomeClient.auth_token)')
212212
if not isinstance(token, str):
213213
raise Exception('Parameter "token" expected datatype "str" (lib: SomeClient.auth_token )')
@@ -242,7 +242,7 @@ def game_create(self, uuid, cost, public, name = None, age = None, activated = N
242242
"""
243243
if not self.hasConnection(): return None
244244
reqJson = self.generateBaseCommand('game_create')
245-
if uuid == None:
245+
if uuid is None:
246246
raise Exception('Parameter "uuid" expected (lib: SomeClient.game_create)')
247247
if not isinstance(uuid, str):
248248
raise Exception('Parameter "uuid" expected datatype "str" (lib: SomeClient.game_create )')
@@ -251,7 +251,7 @@ def game_create(self, uuid, cost, public, name = None, age = None, activated = N
251251
if not isinstance(name, str):
252252
raise Exception('Parameter "name" expected datatype "str" (lib: SomeClient.game_create )')
253253
reqJson['params']['name'] = name
254-
if cost == None:
254+
if cost is None:
255255
raise Exception('Parameter "cost" expected (lib: SomeClient.game_create)')
256256
if not isinstance(cost, int):
257257
raise Exception('Parameter "cost" expected datatype "int" (lib: SomeClient.game_create )')
@@ -260,7 +260,7 @@ def game_create(self, uuid, cost, public, name = None, age = None, activated = N
260260
if not isinstance(age, int):
261261
raise Exception('Parameter "age" expected datatype "int" (lib: SomeClient.game_create )')
262262
reqJson['params']['age'] = age
263-
if public == None:
263+
if public is None:
264264
raise Exception('Parameter "public" expected (lib: SomeClient.game_create)')
265265
if not isinstance(public, bool):
266266
raise Exception('Parameter "public" expected datatype "bool" (lib: SomeClient.game_create )')
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .SomeClient import *
1+
from .SomeClient import SomeClient

example-of-exported/py3/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name='libwsjcppjson20client',
8-
version='v0.0.2',
8+
version='v0.0.3',
99
packages=['libwsjcppjson20client'],
1010
install_requires=['websocket-client>=0.56.0', 'requests>=2.21.0'],
1111
keywords=['wsjcpp-jsonrpc20', 'wsjcpp', 'wsjcpp-jsonrpc20', 'example-python-client'],

src.wsjcpp/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Automaticly generated by [email protected]
22
cmake_minimum_required(VERSION 3.0)
33

4-
add_definitions(-DWSJCPP_APP_VERSION="v0.0.2")
4+
add_definitions(-DWSJCPP_APP_VERSION="v0.0.3")
55
add_definitions(-DWSJCPP_APP_NAME="wsjcpp-jsonrpc20")
66

77
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -17,7 +17,7 @@ set (WSJCPP_SOURCES "")
1717
find_package(Threads REQUIRED)
1818
list (APPEND WSJCPP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
1919

20-
# wsjcpp-core:v0.1.7
20+
# wsjcpp-core:v0.2.0
2121
list (APPEND WSJCPP_INCLUDE_DIRS "./src.wsjcpp/wsjcpp_core/")
2222
list (APPEND WSJCPP_SOURCES "./src.wsjcpp/wsjcpp_core/wsjcpp_core.cpp")
2323
list (APPEND WSJCPP_SOURCES "./src.wsjcpp/wsjcpp_core/wsjcpp_core.h")
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/wsjcpp-safe-scripting
2+
3+
# log_info rootdir
4+
# log_info script_filename
5+
6+
make_dir "./unit-tests.wsjcpp"
7+
make_dir "./unit-tests.wsjcpp/src"
8+
9+
var user_class_name
10+
set_value user_class_name arg1
11+
normalize_class_name user_class_name
12+
var class_name
13+
set_value class_name "UnitTest"
14+
concat class_name user_class_name
15+
16+
var base_filename
17+
convert_CamelCase_to_snake_case class_name base_filename
18+
# log_info base_filename
19+
20+
var filename_cpp
21+
concat filename_cpp "./unit-tests.wsjcpp/src/" base_filename ".cpp"
22+
23+
var filename_h
24+
concat filename_h "./unit-tests.wsjcpp/src/" base_filename ".h"
25+
26+
var ifndef_header
27+
set_value ifndef_header base_filename
28+
concat ifndef_header "_H"
29+
30+
to_upper_case ifndef_header
31+
32+
var content_header
33+
concat content_header "#ifndef " ifndef_header "
34+
#define " ifndef_header "
35+
36+
#include <wsjcpp_unit_tests.h>
37+
38+
class " class_name " : public WsjcppUnitTestBase {
39+
public:
40+
" class_name "();
41+
virtual bool doBeforeTest() override;
42+
virtual void executeTest() override;
43+
virtual bool doAfterTest() override;
44+
};
45+
46+
#endif // " ifndef_header
47+
48+
49+
var content_source
50+
concat content_source "
51+
#include \"" base_filename ".h\"
52+
#include <wsjcpp_core.h>
53+
54+
// ---------------------------------------------------------------------
55+
// " class_name "
56+
57+
REGISTRY_WSJCPP_UNIT_TEST(" class_name ")
58+
59+
" class_name "::" class_name "()
60+
: WsjcppUnitTestBase(\"" class_name "\") {
61+
}
62+
63+
// ---------------------------------------------------------------------
64+
65+
bool " class_name "::doBeforeTest() {
66+
// nothing
67+
return true;
68+
}
69+
70+
// ---------------------------------------------------------------------
71+
72+
void " class_name "::executeTest() {
73+
compare(\"Not implemented\", true, false);
74+
// TODO unit test source code here
75+
}
76+
77+
// ---------------------------------------------------------------------
78+
79+
bool " class_name "::doAfterTest() {
80+
// nothing
81+
return true;
82+
}
83+
84+
"
85+
86+
var file_source
87+
concat file_source "src/" filename_cpp
88+
89+
write_file filename_h content_header
90+
write_file filename_cpp content_source
91+
92+
log_info "
93+
======
94+
Generated class:
95+
- " class_name "
96+
Generated files:
97+
- " filename_h "
98+
- " filename_cpp "
99+
======
100+
"
101+
102+
wsjcpp_yml_unit_test_add user_class_name filename_h
103+
wsjcpp_yml_unit_test_add user_class_name filename_cpp

src.wsjcpp/wsjcpp_core/wsjcpp.hold.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_cxx_standard: 11
33
cmake_minimum_required: 3.0
44

55
name: wsjcpp-core
6-
version: v0.1.7
6+
version: v0.2.0
77
description: Basic Utils for wsjcpp
88
issues: https://github.com/wsjcpp/wsjcpp-core/issues
99
repositories:
@@ -33,6 +33,9 @@ distribution:
3333
- source-file: "src/wsjcpp_unit_tests_main.cpp"
3434
target-file: "wsjcpp_unit_tests_main.cpp"
3535
type: "unit-tests"
36+
- source-file: "scripts.wsjcpp/generate.WsjcppUnitTest"
37+
target-file: "generate.WsjcppUnitTest"
38+
type: "safe-scripting-generate"
3639
- source-file: "scripts.wsjcpp/generate.Class"
3740
target-file: "generate.Class"
3841
type: "safe-scripting-generate"
@@ -79,3 +82,9 @@ unit-tests:
7982
description: "Test basic resources"
8083
- name: "ListOfDirs"
8184
description: "Check list of directories"
85+
- name: "FilePermissions"
86+
description: ""
87+
- name: "StringPadding"
88+
description: ""
89+
- name: "DateTimeFormat"
90+
description: ""

0 commit comments

Comments
 (0)