@digitalshieldfe/react-native-backup-card-sdk 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +33 -49
- package/android/libs/backupcardsdk.aar +0 -0
- package/android/src/main/AndroidManifest.xml +1 -4
- package/android/src/main/java/com/ziancube/reactnativebackupcardsdk/BackupCardSdkModule.kt +244 -74
- package/android/src/main/java/com/ziancube/reactnativebackupcardsdk/BackupCardSdkPackage.kt +1 -1
- package/android/src/main/java/com/ziancube/reactnativebackupcardsdk/nfc/NfcExceptions.kt +11 -0
- package/android/src/main/java/com/ziancube/reactnativebackupcardsdk/nfc/NfcUtils.kt +30 -0
- package/android/src/main/java/com/ziancube/reactnativebackupcardsdk/utils/MiUtil.kt +74 -0
- package/android/src/main/java/com/ziancube/reactnativebackupcardsdk/utils/NfcPermissionUtils.kt +23 -0
- package/lib/module/NativeBackupCardSdk.js +3 -0
- package/lib/module/NativeBackupCardSdk.js.map +1 -1
- package/lib/module/cardOperations.js +27 -0
- package/lib/module/cardOperations.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nfc.js +75 -0
- package/lib/module/nfc.js.map +1 -0
- package/lib/typescript/src/NativeBackupCardSdk.d.ts +50 -4
- package/lib/typescript/src/NativeBackupCardSdk.d.ts.map +1 -1
- package/lib/typescript/src/cardOperations.d.ts +7 -0
- package/lib/typescript/src/cardOperations.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nfc.d.ts +28 -0
- package/lib/typescript/src/nfc.d.ts.map +1 -0
- package/package.json +7 -5
- package/src/NativeBackupCardSdk.ts +62 -4
- package/src/cardOperations.ts +61 -0
- package/src/index.tsx +22 -2
- package/src/nfc.ts +74 -0
- package/android/consumer-rules.pro +0 -0
- package/android/proguard-rules.pro +0 -21
- package/android/src/main/java/com/ziancube/backupcardsdk/BackupCardSdk.kt +0 -478
- package/android/src/main/java/com/ziancube/backupcardsdk/GPChannelNatives.java +0 -41
- package/android/src/main/java/com/ziancube/backupcardsdk/listener/ApiAsyncListener.java +0 -13
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/ApiNfc.java +0 -173
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/ImplNfc.java +0 -39
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/NfcComm.java +0 -115
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/ApduParam.java +0 -67
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/CommList.java +0 -41
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/Utils.java +0 -109
- package/android/src/main/jni/CMakeLists.txt +0 -60
- package/android/src/main/jni/GPChannel/include/GPChannelSDK.h +0 -306
- package/android/src/main/jni/GPChannel/include/context/BaseContext.h +0 -56
- package/android/src/main/jni/GPChannel/include/device/ApduBuilder.hpp +0 -72
- package/android/src/main/jni/GPChannel/include/utility/Apdu.hpp +0 -166
- package/android/src/main/jni/GPChannel/include/utility/Debug.hpp +0 -59
- package/android/src/main/jni/GPChannel/include/utility/Singleton.h +0 -34
- package/android/src/main/jni/GPChannel/include/utility/mutex.h +0 -24
- package/android/src/main/jni/GPChannel/include/utility/trim.hpp +0 -155
- package/android/src/main/jni/GPChannel/include/utility/util.h +0 -104
- package/android/src/main/jni/GPChannel/include/utility/xFactory.hpp +0 -26
- package/android/src/main/jni/GPChannel/include/utility/xManager.hpp +0 -84
- package/android/src/main/jni/GPChannel/src/arm64-v8a/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/arm64-v8a/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/GPChannel/src/armeabi-v7a/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/armeabi-v7a/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/GPChannel/src/x86/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/x86/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/src/implJni.cpp +0 -313
- package/android/src/main/jni/src/implJni.h +0 -9
- package/android/src/main/jni/utils/jsoncpp/AUTHORS +0 -111
- package/android/src/main/jni/utils/jsoncpp/CMakeLists.txt +0 -159
- package/android/src/main/jni/utils/jsoncpp/LICENSE +0 -55
- package/android/src/main/jni/utils/jsoncpp/README.md +0 -135
- package/android/src/main/jni/utils/jsoncpp/amalgamate.py +0 -155
- package/android/src/main/jni/utils/jsoncpp/appveyor.yml +0 -22
- package/android/src/main/jni/utils/jsoncpp/dev.makefile +0 -35
- package/android/src/main/jni/utils/jsoncpp/devtools/__init__.py +0 -6
- package/android/src/main/jni/utils/jsoncpp/devtools/agent_vmw7.json +0 -33
- package/android/src/main/jni/utils/jsoncpp/devtools/agent_vmxp.json +0 -26
- package/android/src/main/jni/utils/jsoncpp/devtools/antglob.py +0 -205
- package/android/src/main/jni/utils/jsoncpp/devtools/batchbuild.py +0 -278
- package/android/src/main/jni/utils/jsoncpp/devtools/fixeol.py +0 -70
- package/android/src/main/jni/utils/jsoncpp/devtools/licenseupdater.py +0 -94
- package/android/src/main/jni/utils/jsoncpp/devtools/tarball.py +0 -52
- package/android/src/main/jni/utils/jsoncpp/doxybuild.py +0 -189
- package/android/src/main/jni/utils/jsoncpp/include/CMakeLists.txt +0 -2
- package/android/src/main/jni/utils/jsoncpp/include/json/allocator.h +0 -98
- package/android/src/main/jni/utils/jsoncpp/include/json/assertions.h +0 -54
- package/android/src/main/jni/utils/jsoncpp/include/json/autolink.h +0 -25
- package/android/src/main/jni/utils/jsoncpp/include/json/config.h +0 -187
- package/android/src/main/jni/utils/jsoncpp/include/json/features.h +0 -61
- package/android/src/main/jni/utils/jsoncpp/include/json/forwards.h +0 -37
- package/android/src/main/jni/utils/jsoncpp/include/json/json.h +0 -15
- package/android/src/main/jni/utils/jsoncpp/include/json/reader.h +0 -411
- package/android/src/main/jni/utils/jsoncpp/include/json/value.h +0 -888
- package/android/src/main/jni/utils/jsoncpp/include/json/version.h +0 -20
- package/android/src/main/jni/utils/jsoncpp/include/json/writer.h +0 -357
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/jsontest.vcproj +0 -119
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/lib_json.vcproj +0 -205
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/test_lib_json.vcproj +0 -130
- package/android/src/main/jni/utils/jsoncpp/makerelease.py +0 -390
- package/android/src/main/jni/utils/jsoncpp/meson.build +0 -103
- package/android/src/main/jni/utils/jsoncpp/pkg-config/jsoncpp.pc.in +0 -9
- package/android/src/main/jni/utils/jsoncpp/src/CMakeLists.txt +0 -5
- package/android/src/main/jni/utils/jsoncpp/src/jsontestrunner/CMakeLists.txt +0 -25
- package/android/src/main/jni/utils/jsoncpp/src/jsontestrunner/main.cpp +0 -333
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/CMakeLists.txt +0 -117
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_reader.cpp +0 -2060
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_tool.h +0 -114
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_value.cpp +0 -1661
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_valueiterator.inl +0 -167
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_writer.cpp +0 -1233
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/version.h.in +0 -20
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/CMakeLists.txt +0 -38
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/jsontest.cpp +0 -457
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/jsontest.h +0 -286
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/main.cpp +0 -2606
- package/android/src/main/jni/utils/jsoncpp/travis.sh +0 -23
- package/android/src/main/jni/utils/jsoncpp/version +0 -1
- package/android/src/main/jni/utils/jsoncpp/version.in +0 -1
- package/android/src/main/jni/utils/logUtils.cpp +0 -108
- package/android/src/main/jni/utils/logUtils.h +0 -87
- package/android/src/main/jni/utils/mSIGNA/stdutils/uchar_vector.h +0 -614
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# JsonCpp
|
|
2
|
-
|
|
3
|
-
[](http://www.conan.io/source/jsoncpp/1.8.0/theirix/ci)
|
|
4
|
-
|
|
5
|
-
[JSON][json-org] is a lightweight data-interchange format. It can represent
|
|
6
|
-
numbers, strings, ordered sequences of values, and collections of name/value
|
|
7
|
-
pairs.
|
|
8
|
-
|
|
9
|
-
[json-org]: http://json.org/
|
|
10
|
-
|
|
11
|
-
JsonCpp is a C++ library that allows manipulating JSON values, including
|
|
12
|
-
serialization and deserialization to and from strings. It can also preserve
|
|
13
|
-
existing comment in unserialization/serialization steps, making it a convenient
|
|
14
|
-
format to store user input files.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Documentation
|
|
18
|
-
|
|
19
|
-
[JsonCpp documentation][JsonCpp-documentation] is generated using [Doxygen][].
|
|
20
|
-
|
|
21
|
-
[JsonCpp-documentation]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
|
|
22
|
-
[Doxygen]: http://www.doxygen.org
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## A note on backward-compatibility
|
|
26
|
-
|
|
27
|
-
* `1.y.z` is built with C++11.
|
|
28
|
-
* `0.y.z` can be used with older compilers.
|
|
29
|
-
* Major versions maintain binary-compatibility.
|
|
30
|
-
|
|
31
|
-
## Contributing to JsonCpp
|
|
32
|
-
|
|
33
|
-
### Building and testing with Meson/Ninja
|
|
34
|
-
Thanks to David Seifert (@SoapGentoo), we (the maintainers) now use [meson](http://mesonbuild.com/) and [ninja](https://ninja-build.org/) to build for debugging, as well as for continuous integration (see [`travis.sh`](travis.sh) ). Other systems may work, but minor things like version strings might break.
|
|
35
|
-
|
|
36
|
-
First, install both meson (which requires Python3) and ninja.
|
|
37
|
-
If you wish to install to a directory other than /usr/local, set an environment variable called DESTDIR with the desired path:
|
|
38
|
-
DESTDIR=/path/to/install/dir
|
|
39
|
-
|
|
40
|
-
Then,
|
|
41
|
-
|
|
42
|
-
cd jsoncpp/
|
|
43
|
-
BUILD_TYPE=debug
|
|
44
|
-
#BUILD_TYPE=release
|
|
45
|
-
LIB_TYPE=shared
|
|
46
|
-
#LIB_TYPE=static
|
|
47
|
-
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE}
|
|
48
|
-
ninja -v -C build-${LIB_TYPE} test
|
|
49
|
-
cd build-${LIB_TYPE}
|
|
50
|
-
sudo ninja install
|
|
51
|
-
|
|
52
|
-
### Building and testing with other build systems
|
|
53
|
-
See https://github.com/open-source-parsers/jsoncpp/wiki/Building
|
|
54
|
-
|
|
55
|
-
### Running the tests manually
|
|
56
|
-
|
|
57
|
-
You need to run tests manually only if you are troubleshooting an issue.
|
|
58
|
-
|
|
59
|
-
In the instructions below, replace `path/to/jsontest` with the path of the
|
|
60
|
-
`jsontest` executable that was compiled on your platform.
|
|
61
|
-
|
|
62
|
-
cd test
|
|
63
|
-
# This will run the Reader/Writer tests
|
|
64
|
-
python runjsontests.py path/to/jsontest
|
|
65
|
-
|
|
66
|
-
# This will run the Reader/Writer tests, using JSONChecker test suite
|
|
67
|
-
# (http://www.json.org/JSON_checker/).
|
|
68
|
-
# Notes: not all tests pass: JsonCpp is too lenient (for example,
|
|
69
|
-
# it allows an integer to start with '0'). The goal is to improve
|
|
70
|
-
# strict mode parsing to get all tests to pass.
|
|
71
|
-
python runjsontests.py --with-json-checker path/to/jsontest
|
|
72
|
-
|
|
73
|
-
# This will run the unit tests (mostly Value)
|
|
74
|
-
python rununittests.py path/to/test_lib_json
|
|
75
|
-
|
|
76
|
-
# You can run the tests using valgrind:
|
|
77
|
-
python rununittests.py --valgrind path/to/test_lib_json
|
|
78
|
-
|
|
79
|
-
### Building the documentation
|
|
80
|
-
|
|
81
|
-
Run the Python script `doxybuild.py` from the top directory:
|
|
82
|
-
|
|
83
|
-
python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
|
|
84
|
-
|
|
85
|
-
See `doxybuild.py --help` for options.
|
|
86
|
-
|
|
87
|
-
### Adding a reader/writer test
|
|
88
|
-
|
|
89
|
-
To add a test, you need to create two files in test/data:
|
|
90
|
-
|
|
91
|
-
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
|
92
|
-
* a `TESTNAME.expected` file, that contains a flatened representation of the
|
|
93
|
-
input document.
|
|
94
|
-
|
|
95
|
-
The `TESTNAME.expected` file format is as follows:
|
|
96
|
-
|
|
97
|
-
* Each line represents a JSON element of the element tree represented by the
|
|
98
|
-
input document.
|
|
99
|
-
* Each line has two parts: the path to access the element separated from the
|
|
100
|
-
element value by `=`. Array and object values are always empty (i.e.
|
|
101
|
-
represented by either `[]` or `{}`).
|
|
102
|
-
* Element path `.` represents the root element, and is used to separate object
|
|
103
|
-
members. `[N]` is used to specify the value of an array element at index `N`.
|
|
104
|
-
|
|
105
|
-
See the examples `test_complex_01.json` and `test_complex_01.expected` to better understand element paths.
|
|
106
|
-
|
|
107
|
-
### Understanding reader/writer test output
|
|
108
|
-
|
|
109
|
-
When a test is run, output files are generated beside the input test files. Below is a short description of the content of each file:
|
|
110
|
-
|
|
111
|
-
* `test_complex_01.json`: input JSON document.
|
|
112
|
-
* `test_complex_01.expected`: flattened JSON element tree used to check if
|
|
113
|
-
parsing was corrected.
|
|
114
|
-
* `test_complex_01.actual`: flattened JSON element tree produced by `jsontest`
|
|
115
|
-
from reading `test_complex_01.json`.
|
|
116
|
-
* `test_complex_01.rewrite`: JSON document written by `jsontest` using the
|
|
117
|
-
`Json::Value` parsed from `test_complex_01.json` and serialized using
|
|
118
|
-
`Json::StyledWritter`.
|
|
119
|
-
* `test_complex_01.actual-rewrite`: flattened JSON element tree produced by
|
|
120
|
-
`jsontest` from reading `test_complex_01.rewrite`.
|
|
121
|
-
* `test_complex_01.process-output`: `jsontest` output, typically useful for
|
|
122
|
-
understanding parsing errors.
|
|
123
|
-
|
|
124
|
-
## Using JsonCpp in your project
|
|
125
|
-
|
|
126
|
-
### Amalgamated source
|
|
127
|
-
https://github.com/open-source-parsers/jsoncpp/wiki/Amalgamated
|
|
128
|
-
|
|
129
|
-
### Other ways
|
|
130
|
-
If you have trouble, see the Wiki, or post a question as an Issue.
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
|
|
134
|
-
See the `LICENSE` file for details. In summary, JsonCpp is licensed under the
|
|
135
|
-
MIT license, or public domain if desired and recognized in your jurisdiction.
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"""Amalgamate json-cpp library sources into a single source and header file.
|
|
2
|
-
|
|
3
|
-
Works with python2.6+ and python3.4+.
|
|
4
|
-
|
|
5
|
-
Example of invocation (must be invoked from json-cpp top directory):
|
|
6
|
-
python amalgamate.py
|
|
7
|
-
"""
|
|
8
|
-
import os
|
|
9
|
-
import os.path
|
|
10
|
-
import sys
|
|
11
|
-
|
|
12
|
-
class AmalgamationFile:
|
|
13
|
-
def __init__(self, top_dir):
|
|
14
|
-
self.top_dir = top_dir
|
|
15
|
-
self.blocks = []
|
|
16
|
-
|
|
17
|
-
def add_text(self, text):
|
|
18
|
-
if not text.endswith("\n"):
|
|
19
|
-
text += "\n"
|
|
20
|
-
self.blocks.append(text)
|
|
21
|
-
|
|
22
|
-
def add_file(self, relative_input_path, wrap_in_comment=False):
|
|
23
|
-
def add_marker(prefix):
|
|
24
|
-
self.add_text("")
|
|
25
|
-
self.add_text("// " + "/"*70)
|
|
26
|
-
self.add_text("// %s of content of file: %s" % (prefix, relative_input_path.replace("\\","/")))
|
|
27
|
-
self.add_text("// " + "/"*70)
|
|
28
|
-
self.add_text("")
|
|
29
|
-
add_marker("Beginning")
|
|
30
|
-
f = open(os.path.join(self.top_dir, relative_input_path), "rt")
|
|
31
|
-
content = f.read()
|
|
32
|
-
if wrap_in_comment:
|
|
33
|
-
content = "/*\n" + content + "\n*/"
|
|
34
|
-
self.add_text(content)
|
|
35
|
-
f.close()
|
|
36
|
-
add_marker("End")
|
|
37
|
-
self.add_text("\n\n\n\n")
|
|
38
|
-
|
|
39
|
-
def get_value(self):
|
|
40
|
-
return "".join(self.blocks).replace("\r\n","\n")
|
|
41
|
-
|
|
42
|
-
def write_to(self, output_path):
|
|
43
|
-
output_dir = os.path.dirname(output_path)
|
|
44
|
-
if output_dir and not os.path.isdir(output_dir):
|
|
45
|
-
os.makedirs(output_dir)
|
|
46
|
-
f = open(output_path, "wb")
|
|
47
|
-
f.write(str.encode(self.get_value(), 'UTF-8'))
|
|
48
|
-
f.close()
|
|
49
|
-
|
|
50
|
-
def amalgamate_source(source_top_dir=None,
|
|
51
|
-
target_source_path=None,
|
|
52
|
-
header_include_path=None):
|
|
53
|
-
"""Produces amalgamated source.
|
|
54
|
-
Parameters:
|
|
55
|
-
source_top_dir: top-directory
|
|
56
|
-
target_source_path: output .cpp path
|
|
57
|
-
header_include_path: generated header path relative to target_source_path.
|
|
58
|
-
"""
|
|
59
|
-
print("Amalgamating header...")
|
|
60
|
-
header = AmalgamationFile(source_top_dir)
|
|
61
|
-
header.add_text("/// Json-cpp amalgamated header (http://jsoncpp.sourceforge.net/).")
|
|
62
|
-
header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
|
|
63
|
-
header.add_file("LICENSE", wrap_in_comment=True)
|
|
64
|
-
header.add_text("#ifndef JSON_AMALGAMATED_H_INCLUDED")
|
|
65
|
-
header.add_text("# define JSON_AMALGAMATED_H_INCLUDED")
|
|
66
|
-
header.add_text("/// If defined, indicates that the source file is amalgamated")
|
|
67
|
-
header.add_text("/// to prevent private header inclusion.")
|
|
68
|
-
header.add_text("#define JSON_IS_AMALGAMATION")
|
|
69
|
-
header.add_file("include/json/version.h")
|
|
70
|
-
#header.add_file("include/json/allocator.h") # Not available here.
|
|
71
|
-
header.add_file("include/json/config.h")
|
|
72
|
-
header.add_file("include/json/forwards.h")
|
|
73
|
-
header.add_file("include/json/features.h")
|
|
74
|
-
header.add_file("include/json/value.h")
|
|
75
|
-
header.add_file("include/json/reader.h")
|
|
76
|
-
header.add_file("include/json/writer.h")
|
|
77
|
-
header.add_file("include/json/assertions.h")
|
|
78
|
-
header.add_text("#endif //ifndef JSON_AMALGAMATED_H_INCLUDED")
|
|
79
|
-
|
|
80
|
-
target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
|
|
81
|
-
print("Writing amalgamated header to %r" % target_header_path)
|
|
82
|
-
header.write_to(target_header_path)
|
|
83
|
-
|
|
84
|
-
base, ext = os.path.splitext(header_include_path)
|
|
85
|
-
forward_header_include_path = base + "-forwards" + ext
|
|
86
|
-
print("Amalgamating forward header...")
|
|
87
|
-
header = AmalgamationFile(source_top_dir)
|
|
88
|
-
header.add_text("/// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/).")
|
|
89
|
-
header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
|
|
90
|
-
header.add_text("/// This header provides forward declaration for all JsonCpp types.")
|
|
91
|
-
header.add_file("LICENSE", wrap_in_comment=True)
|
|
92
|
-
header.add_text("#ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
|
|
93
|
-
header.add_text("# define JSON_FORWARD_AMALGAMATED_H_INCLUDED")
|
|
94
|
-
header.add_text("/// If defined, indicates that the source file is amalgamated")
|
|
95
|
-
header.add_text("/// to prevent private header inclusion.")
|
|
96
|
-
header.add_text("#define JSON_IS_AMALGAMATION")
|
|
97
|
-
header.add_file("include/json/config.h")
|
|
98
|
-
header.add_file("include/json/forwards.h")
|
|
99
|
-
header.add_text("#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
|
|
100
|
-
|
|
101
|
-
target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
|
|
102
|
-
forward_header_include_path)
|
|
103
|
-
print("Writing amalgamated forward header to %r" % target_forward_header_path)
|
|
104
|
-
header.write_to(target_forward_header_path)
|
|
105
|
-
|
|
106
|
-
print("Amalgamating source...")
|
|
107
|
-
source = AmalgamationFile(source_top_dir)
|
|
108
|
-
source.add_text("/// Json-cpp amalgamated source (http://jsoncpp.sourceforge.net/).")
|
|
109
|
-
source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
|
|
110
|
-
source.add_file("LICENSE", wrap_in_comment=True)
|
|
111
|
-
source.add_text("")
|
|
112
|
-
source.add_text('#include "%s"' % header_include_path)
|
|
113
|
-
source.add_text("""
|
|
114
|
-
#ifndef JSON_IS_AMALGAMATION
|
|
115
|
-
#error "Compile with -I PATH_TO_JSON_DIRECTORY"
|
|
116
|
-
#endif
|
|
117
|
-
""")
|
|
118
|
-
source.add_text("")
|
|
119
|
-
lib_json = "src/lib_json"
|
|
120
|
-
source.add_file(os.path.join(lib_json, "json_tool.h"))
|
|
121
|
-
source.add_file(os.path.join(lib_json, "json_reader.cpp"))
|
|
122
|
-
source.add_file(os.path.join(lib_json, "json_valueiterator.inl"))
|
|
123
|
-
source.add_file(os.path.join(lib_json, "json_value.cpp"))
|
|
124
|
-
source.add_file(os.path.join(lib_json, "json_writer.cpp"))
|
|
125
|
-
|
|
126
|
-
print("Writing amalgamated source to %r" % target_source_path)
|
|
127
|
-
source.write_to(target_source_path)
|
|
128
|
-
|
|
129
|
-
def main():
|
|
130
|
-
usage = """%prog [options]
|
|
131
|
-
Generate a single amalgamated source and header file from the sources.
|
|
132
|
-
"""
|
|
133
|
-
from optparse import OptionParser
|
|
134
|
-
parser = OptionParser(usage=usage)
|
|
135
|
-
parser.allow_interspersed_args = False
|
|
136
|
-
parser.add_option("-s", "--source", dest="target_source_path", action="store", default="dist/jsoncpp.cpp",
|
|
137
|
-
help="""Output .cpp source path. [Default: %default]""")
|
|
138
|
-
parser.add_option("-i", "--include", dest="header_include_path", action="store", default="json/json.h",
|
|
139
|
-
help="""Header include path. Used to include the header from the amalgamated source file. [Default: %default]""")
|
|
140
|
-
parser.add_option("-t", "--top-dir", dest="top_dir", action="store", default=os.getcwd(),
|
|
141
|
-
help="""Source top-directory. [Default: %default]""")
|
|
142
|
-
parser.enable_interspersed_args()
|
|
143
|
-
options, args = parser.parse_args()
|
|
144
|
-
|
|
145
|
-
msg = amalgamate_source(source_top_dir=options.top_dir,
|
|
146
|
-
target_source_path=options.target_source_path,
|
|
147
|
-
header_include_path=options.header_include_path)
|
|
148
|
-
if msg:
|
|
149
|
-
sys.stderr.write(msg + "\n")
|
|
150
|
-
sys.exit(1)
|
|
151
|
-
else:
|
|
152
|
-
print("Source successfully amalgamated")
|
|
153
|
-
|
|
154
|
-
if __name__ == "__main__":
|
|
155
|
-
main()
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
clone_folder: c:\projects\jsoncpp
|
|
2
|
-
|
|
3
|
-
environment:
|
|
4
|
-
matrix:
|
|
5
|
-
- CMAKE_GENERATOR: Visual Studio 12 2013
|
|
6
|
-
- CMAKE_GENERATOR: Visual Studio 12 2013 Win64
|
|
7
|
-
- CMAKE_GENERATOR: Visual Studio 14 2015
|
|
8
|
-
- CMAKE_GENERATOR: Visual Studio 14 2015 Win64
|
|
9
|
-
|
|
10
|
-
build_script:
|
|
11
|
-
- cmake --version
|
|
12
|
-
- cd c:\projects\jsoncpp
|
|
13
|
-
- cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=%CD:\=/%/install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .
|
|
14
|
-
- cmake --build . --config Release --target install
|
|
15
|
-
|
|
16
|
-
deploy:
|
|
17
|
-
provider: GitHub
|
|
18
|
-
auth_token:
|
|
19
|
-
secure: K2Tp1q8pIZ7rs0Ot24ZMWuwr12Ev6Tc6QkhMjGQxoQG3ng1pXtgPasiJ45IDXGdg
|
|
20
|
-
on:
|
|
21
|
-
branch: master
|
|
22
|
-
appveyor_repo_tag: true
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# This is only for jsoncpp developers/contributors.
|
|
2
|
-
# We use this to sign releases, generate documentation, etc.
|
|
3
|
-
VER?=$(shell cat version)
|
|
4
|
-
|
|
5
|
-
default:
|
|
6
|
-
@echo "VER=${VER}"
|
|
7
|
-
sign: jsoncpp-${VER}.tar.gz
|
|
8
|
-
gpg --armor --detach-sign $<
|
|
9
|
-
gpg --verify $<.asc
|
|
10
|
-
# Then upload .asc to the release.
|
|
11
|
-
jsoncpp-%.tar.gz:
|
|
12
|
-
curl https://github.com/open-source-parsers/jsoncpp/archive/$*.tar.gz -o $@
|
|
13
|
-
dox:
|
|
14
|
-
python doxybuild.py --doxygen=$$(which doxygen) --in doc/web_doxyfile.in
|
|
15
|
-
rsync -va -c --delete dist/doxygen/jsoncpp-api-html-${VER}/ ../jsoncpp-docs/doxygen/
|
|
16
|
-
# Then 'git add -A' and 'git push' in jsoncpp-docs.
|
|
17
|
-
build:
|
|
18
|
-
mkdir -p build/debug
|
|
19
|
-
cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_SHARED_LIBS=ON -G "Unix Makefiles" ../..
|
|
20
|
-
make -C build/debug
|
|
21
|
-
|
|
22
|
-
# Currently, this depends on include/json/version.h generated
|
|
23
|
-
# by cmake.
|
|
24
|
-
test-amalgamate:
|
|
25
|
-
python2.7 amalgamate.py
|
|
26
|
-
python3.4 amalgamate.py
|
|
27
|
-
cd dist; gcc -I. -c jsoncpp.cpp
|
|
28
|
-
|
|
29
|
-
valgrind:
|
|
30
|
-
valgrind --error-exitcode=42 --leak-check=full ./build/debug/src/test_lib_json/jsoncpp_test
|
|
31
|
-
|
|
32
|
-
clean:
|
|
33
|
-
\rm -rf *.gz *.asc dist/
|
|
34
|
-
|
|
35
|
-
.PHONY: build
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cmake_variants" : [
|
|
3
|
-
{"name": "generator",
|
|
4
|
-
"generators": [
|
|
5
|
-
{"generator": [
|
|
6
|
-
"Visual Studio 7 .NET 2003",
|
|
7
|
-
"Visual Studio 9 2008",
|
|
8
|
-
"Visual Studio 9 2008 Win64",
|
|
9
|
-
"Visual Studio 10",
|
|
10
|
-
"Visual Studio 10 Win64",
|
|
11
|
-
"Visual Studio 11",
|
|
12
|
-
"Visual Studio 11 Win64"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
{"generator": ["MinGW Makefiles"],
|
|
16
|
-
"env_prepend": [{"path": "c:/wut/prg/MinGW/bin"}]
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
{"name": "shared_dll",
|
|
21
|
-
"variables": [
|
|
22
|
-
["BUILD_SHARED_LIBS=true"],
|
|
23
|
-
["BUILD_SHARED_LIBS=false"]
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
{"name": "build_type",
|
|
27
|
-
"build_types": [
|
|
28
|
-
"debug",
|
|
29
|
-
"release"
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cmake_variants" : [
|
|
3
|
-
{"name": "generator",
|
|
4
|
-
"generators": [
|
|
5
|
-
{"generator": [
|
|
6
|
-
"Visual Studio 6",
|
|
7
|
-
"Visual Studio 7",
|
|
8
|
-
"Visual Studio 8 2005"
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
{"name": "shared_dll",
|
|
14
|
-
"variables": [
|
|
15
|
-
["BUILD_SHARED_LIBS=true"],
|
|
16
|
-
["BUILD_SHARED_LIBS=false"]
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
{"name": "build_type",
|
|
20
|
-
"build_types": [
|
|
21
|
-
"debug",
|
|
22
|
-
"release"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# encoding: utf-8
|
|
3
|
-
# Copyright 2009 Baptiste Lepilleur and The JsonCpp Authors
|
|
4
|
-
# Distributed under MIT license, or public domain if desired and
|
|
5
|
-
# recognized in your jurisdiction.
|
|
6
|
-
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
7
|
-
|
|
8
|
-
from __future__ import print_function
|
|
9
|
-
from dircache import listdir
|
|
10
|
-
import re
|
|
11
|
-
import fnmatch
|
|
12
|
-
import os.path
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# These fnmatch expressions are used by default to prune the directory tree
|
|
16
|
-
# while doing the recursive traversal in the glob_impl method of glob function.
|
|
17
|
-
prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '
|
|
18
|
-
|
|
19
|
-
# These fnmatch expressions are used by default to exclude files and dirs
|
|
20
|
-
# while doing the recursive traversal in the glob_impl method of glob function.
|
|
21
|
-
##exclude_pats = prune_pats + '*~ #*# .#* %*% ._* .gitignore .cvsignore vssver.scc .DS_Store'.split()
|
|
22
|
-
|
|
23
|
-
# These ant_glob expressions are used by default to exclude files and dirs and also prune the directory tree
|
|
24
|
-
# while doing the recursive traversal in the glob_impl method of glob function.
|
|
25
|
-
default_excludes = '''
|
|
26
|
-
**/*~
|
|
27
|
-
**/#*#
|
|
28
|
-
**/.#*
|
|
29
|
-
**/%*%
|
|
30
|
-
**/._*
|
|
31
|
-
**/CVS
|
|
32
|
-
**/CVS/**
|
|
33
|
-
**/.cvsignore
|
|
34
|
-
**/SCCS
|
|
35
|
-
**/SCCS/**
|
|
36
|
-
**/vssver.scc
|
|
37
|
-
**/.svn
|
|
38
|
-
**/.svn/**
|
|
39
|
-
**/.git
|
|
40
|
-
**/.git/**
|
|
41
|
-
**/.gitignore
|
|
42
|
-
**/.bzr
|
|
43
|
-
**/.bzr/**
|
|
44
|
-
**/.hg
|
|
45
|
-
**/.hg/**
|
|
46
|
-
**/_MTN
|
|
47
|
-
**/_MTN/**
|
|
48
|
-
**/_darcs
|
|
49
|
-
**/_darcs/**
|
|
50
|
-
**/.DS_Store '''
|
|
51
|
-
|
|
52
|
-
DIR = 1
|
|
53
|
-
FILE = 2
|
|
54
|
-
DIR_LINK = 4
|
|
55
|
-
FILE_LINK = 8
|
|
56
|
-
LINKS = DIR_LINK | FILE_LINK
|
|
57
|
-
ALL_NO_LINK = DIR | FILE
|
|
58
|
-
ALL = DIR | FILE | LINKS
|
|
59
|
-
|
|
60
|
-
_ANT_RE = re.compile(r'(/\*\*/)|(\*\*/)|(/\*\*)|(\*)|(/)|([^\*/]*)')
|
|
61
|
-
|
|
62
|
-
def ant_pattern_to_re(ant_pattern):
|
|
63
|
-
"""Generates a regular expression from the ant pattern.
|
|
64
|
-
Matching convention:
|
|
65
|
-
**/a: match 'a', 'dir/a', 'dir1/dir2/a'
|
|
66
|
-
a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
|
|
67
|
-
*.py: match 'script.py' but not 'a/script.py'
|
|
68
|
-
"""
|
|
69
|
-
rex = ['^']
|
|
70
|
-
next_pos = 0
|
|
71
|
-
sep_rex = r'(?:/|%s)' % re.escape(os.path.sep)
|
|
72
|
-
## print 'Converting', ant_pattern
|
|
73
|
-
for match in _ANT_RE.finditer(ant_pattern):
|
|
74
|
-
## print 'Matched', match.group()
|
|
75
|
-
## print match.start(0), next_pos
|
|
76
|
-
if match.start(0) != next_pos:
|
|
77
|
-
raise ValueError("Invalid ant pattern")
|
|
78
|
-
if match.group(1): # /**/
|
|
79
|
-
rex.append(sep_rex + '(?:.*%s)?' % sep_rex)
|
|
80
|
-
elif match.group(2): # **/
|
|
81
|
-
rex.append('(?:.*%s)?' % sep_rex)
|
|
82
|
-
elif match.group(3): # /**
|
|
83
|
-
rex.append(sep_rex + '.*')
|
|
84
|
-
elif match.group(4): # *
|
|
85
|
-
rex.append('[^/%s]*' % re.escape(os.path.sep))
|
|
86
|
-
elif match.group(5): # /
|
|
87
|
-
rex.append(sep_rex)
|
|
88
|
-
else: # somepath
|
|
89
|
-
rex.append(re.escape(match.group(6)))
|
|
90
|
-
next_pos = match.end()
|
|
91
|
-
rex.append('$')
|
|
92
|
-
return re.compile(''.join(rex))
|
|
93
|
-
|
|
94
|
-
def _as_list(l):
|
|
95
|
-
if isinstance(l, basestring):
|
|
96
|
-
return l.split()
|
|
97
|
-
return l
|
|
98
|
-
|
|
99
|
-
def glob(dir_path,
|
|
100
|
-
includes = '**/*',
|
|
101
|
-
excludes = default_excludes,
|
|
102
|
-
entry_type = FILE,
|
|
103
|
-
prune_dirs = prune_dirs,
|
|
104
|
-
max_depth = 25):
|
|
105
|
-
include_filter = [ant_pattern_to_re(p) for p in _as_list(includes)]
|
|
106
|
-
exclude_filter = [ant_pattern_to_re(p) for p in _as_list(excludes)]
|
|
107
|
-
prune_dirs = [p.replace('/',os.path.sep) for p in _as_list(prune_dirs)]
|
|
108
|
-
dir_path = dir_path.replace('/',os.path.sep)
|
|
109
|
-
entry_type_filter = entry_type
|
|
110
|
-
|
|
111
|
-
def is_pruned_dir(dir_name):
|
|
112
|
-
for pattern in prune_dirs:
|
|
113
|
-
if fnmatch.fnmatch(dir_name, pattern):
|
|
114
|
-
return True
|
|
115
|
-
return False
|
|
116
|
-
|
|
117
|
-
def apply_filter(full_path, filter_rexs):
|
|
118
|
-
"""Return True if at least one of the filter regular expression match full_path."""
|
|
119
|
-
for rex in filter_rexs:
|
|
120
|
-
if rex.match(full_path):
|
|
121
|
-
return True
|
|
122
|
-
return False
|
|
123
|
-
|
|
124
|
-
def glob_impl(root_dir_path):
|
|
125
|
-
child_dirs = [root_dir_path]
|
|
126
|
-
while child_dirs:
|
|
127
|
-
dir_path = child_dirs.pop()
|
|
128
|
-
for entry in listdir(dir_path):
|
|
129
|
-
full_path = os.path.join(dir_path, entry)
|
|
130
|
-
## print 'Testing:', full_path,
|
|
131
|
-
is_dir = os.path.isdir(full_path)
|
|
132
|
-
if is_dir and not is_pruned_dir(entry): # explore child directory ?
|
|
133
|
-
## print '===> marked for recursion',
|
|
134
|
-
child_dirs.append(full_path)
|
|
135
|
-
included = apply_filter(full_path, include_filter)
|
|
136
|
-
rejected = apply_filter(full_path, exclude_filter)
|
|
137
|
-
if not included or rejected: # do not include entry ?
|
|
138
|
-
## print '=> not included or rejected'
|
|
139
|
-
continue
|
|
140
|
-
link = os.path.islink(full_path)
|
|
141
|
-
is_file = os.path.isfile(full_path)
|
|
142
|
-
if not is_file and not is_dir:
|
|
143
|
-
## print '=> unknown entry type'
|
|
144
|
-
continue
|
|
145
|
-
if link:
|
|
146
|
-
entry_type = is_file and FILE_LINK or DIR_LINK
|
|
147
|
-
else:
|
|
148
|
-
entry_type = is_file and FILE or DIR
|
|
149
|
-
## print '=> type: %d' % entry_type,
|
|
150
|
-
if (entry_type & entry_type_filter) != 0:
|
|
151
|
-
## print ' => KEEP'
|
|
152
|
-
yield os.path.join(dir_path, entry)
|
|
153
|
-
## else:
|
|
154
|
-
## print ' => TYPE REJECTED'
|
|
155
|
-
return list(glob_impl(dir_path))
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if __name__ == "__main__":
|
|
159
|
-
import unittest
|
|
160
|
-
|
|
161
|
-
class AntPatternToRETest(unittest.TestCase):
|
|
162
|
-
## def test_conversion(self):
|
|
163
|
-
## self.assertEqual('^somepath$', ant_pattern_to_re('somepath').pattern)
|
|
164
|
-
|
|
165
|
-
def test_matching(self):
|
|
166
|
-
test_cases = [ ('path',
|
|
167
|
-
['path'],
|
|
168
|
-
['somepath', 'pathsuffix', '/path', '/path']),
|
|
169
|
-
('*.py',
|
|
170
|
-
['source.py', 'source.ext.py', '.py'],
|
|
171
|
-
['path/source.py', '/.py', 'dir.py/z', 'z.pyc', 'z.c']),
|
|
172
|
-
('**/path',
|
|
173
|
-
['path', '/path', '/a/path', 'c:/a/path', '/a/b/path', '//a/path', '/a/path/b/path'],
|
|
174
|
-
['path/', 'a/path/b', 'dir.py/z', 'somepath', 'pathsuffix', 'a/somepath']),
|
|
175
|
-
('path/**',
|
|
176
|
-
['path/a', 'path/path/a', 'path//'],
|
|
177
|
-
['path', 'somepath/a', 'a/path', 'a/path/a', 'pathsuffix/a']),
|
|
178
|
-
('/**/path',
|
|
179
|
-
['/path', '/a/path', '/a/b/path/path', '/path/path'],
|
|
180
|
-
['path', 'path/', 'a/path', '/pathsuffix', '/somepath']),
|
|
181
|
-
('a/b',
|
|
182
|
-
['a/b'],
|
|
183
|
-
['somea/b', 'a/bsuffix', 'a/b/c']),
|
|
184
|
-
('**/*.py',
|
|
185
|
-
['script.py', 'src/script.py', 'a/b/script.py', '/a/b/script.py'],
|
|
186
|
-
['script.pyc', 'script.pyo', 'a.py/b']),
|
|
187
|
-
('src/**/*.py',
|
|
188
|
-
['src/a.py', 'src/dir/a.py'],
|
|
189
|
-
['a/src/a.py', '/src/a.py']),
|
|
190
|
-
]
|
|
191
|
-
for ant_pattern, accepted_matches, rejected_matches in list(test_cases):
|
|
192
|
-
def local_path(paths):
|
|
193
|
-
return [ p.replace('/',os.path.sep) for p in paths ]
|
|
194
|
-
test_cases.append((ant_pattern, local_path(accepted_matches), local_path(rejected_matches)))
|
|
195
|
-
for ant_pattern, accepted_matches, rejected_matches in test_cases:
|
|
196
|
-
rex = ant_pattern_to_re(ant_pattern)
|
|
197
|
-
print('ant_pattern:', ant_pattern, ' => ', rex.pattern)
|
|
198
|
-
for accepted_match in accepted_matches:
|
|
199
|
-
print('Accepted?:', accepted_match)
|
|
200
|
-
self.assertTrue(rex.match(accepted_match) is not None)
|
|
201
|
-
for rejected_match in rejected_matches:
|
|
202
|
-
print('Rejected?:', rejected_match)
|
|
203
|
-
self.assertTrue(rex.match(rejected_match) is None)
|
|
204
|
-
|
|
205
|
-
unittest.main()
|