@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,333 +0,0 @@
|
|
|
1
|
-
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
2
|
-
// Distributed under MIT license, or public domain if desired and
|
|
3
|
-
// recognized in your jurisdiction.
|
|
4
|
-
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
5
|
-
|
|
6
|
-
#if defined(__GNUC__)
|
|
7
|
-
#pragma GCC diagnostic push
|
|
8
|
-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
9
|
-
#elif defined(_MSC_VER)
|
|
10
|
-
#pragma warning(disable : 4996)
|
|
11
|
-
#endif
|
|
12
|
-
|
|
13
|
-
/* This executable is used for testing parser/writer using real JSON files.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
#include <json/json.h>
|
|
17
|
-
#include <algorithm> // sort
|
|
18
|
-
#include <sstream>
|
|
19
|
-
#include <stdio.h>
|
|
20
|
-
|
|
21
|
-
struct Options
|
|
22
|
-
{
|
|
23
|
-
JSONCPP_STRING path;
|
|
24
|
-
Json::Features features;
|
|
25
|
-
bool parseOnly;
|
|
26
|
-
typedef JSONCPP_STRING (*writeFuncType)(Json::Value const&);
|
|
27
|
-
writeFuncType write;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
static JSONCPP_STRING normalizeFloatingPointStr(double value) {
|
|
31
|
-
char buffer[32];
|
|
32
|
-
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
|
33
|
-
sprintf_s(buffer, sizeof(buffer), "%.16g", value);
|
|
34
|
-
#else
|
|
35
|
-
snprintf(buffer, sizeof(buffer), "%.16g", value);
|
|
36
|
-
#endif
|
|
37
|
-
buffer[sizeof(buffer) - 1] = 0;
|
|
38
|
-
JSONCPP_STRING s(buffer);
|
|
39
|
-
JSONCPP_STRING::size_type index = s.find_last_of("eE");
|
|
40
|
-
if (index != JSONCPP_STRING::npos) {
|
|
41
|
-
JSONCPP_STRING::size_type hasSign =
|
|
42
|
-
(s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
|
|
43
|
-
JSONCPP_STRING::size_type exponentStartIndex = index + 1 + hasSign;
|
|
44
|
-
JSONCPP_STRING normalized = s.substr(0, exponentStartIndex);
|
|
45
|
-
JSONCPP_STRING::size_type indexDigit =
|
|
46
|
-
s.find_first_not_of('0', exponentStartIndex);
|
|
47
|
-
JSONCPP_STRING exponent = "0";
|
|
48
|
-
if (indexDigit !=
|
|
49
|
-
JSONCPP_STRING::npos) // There is an exponent different from 0
|
|
50
|
-
{
|
|
51
|
-
exponent = s.substr(indexDigit);
|
|
52
|
-
}
|
|
53
|
-
return normalized + exponent;
|
|
54
|
-
}
|
|
55
|
-
return s;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static JSONCPP_STRING readInputTestFile(const char* path) {
|
|
59
|
-
FILE* file = fopen(path, "rb");
|
|
60
|
-
if (!file)
|
|
61
|
-
return JSONCPP_STRING("");
|
|
62
|
-
fseek(file, 0, SEEK_END);
|
|
63
|
-
long const size = ftell(file);
|
|
64
|
-
unsigned long const usize = static_cast<unsigned long>(size);
|
|
65
|
-
fseek(file, 0, SEEK_SET);
|
|
66
|
-
JSONCPP_STRING text;
|
|
67
|
-
char* buffer = new char[size + 1];
|
|
68
|
-
buffer[size] = 0;
|
|
69
|
-
if (fread(buffer, 1, usize, file) == usize)
|
|
70
|
-
text = buffer;
|
|
71
|
-
fclose(file);
|
|
72
|
-
delete[] buffer;
|
|
73
|
-
return text;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static void
|
|
77
|
-
printValueTree(FILE* fout, Json::Value& value, const JSONCPP_STRING& path = ".") {
|
|
78
|
-
if (value.hasComment(Json::commentBefore)) {
|
|
79
|
-
fprintf(fout, "%s\n", value.getComment(Json::commentBefore).c_str());
|
|
80
|
-
}
|
|
81
|
-
switch (value.type()) {
|
|
82
|
-
case Json::nullValue:
|
|
83
|
-
fprintf(fout, "%s=null\n", path.c_str());
|
|
84
|
-
break;
|
|
85
|
-
case Json::intValue:
|
|
86
|
-
fprintf(fout,
|
|
87
|
-
"%s=%s\n",
|
|
88
|
-
path.c_str(),
|
|
89
|
-
Json::valueToString(value.asLargestInt()).c_str());
|
|
90
|
-
break;
|
|
91
|
-
case Json::uintValue:
|
|
92
|
-
fprintf(fout,
|
|
93
|
-
"%s=%s\n",
|
|
94
|
-
path.c_str(),
|
|
95
|
-
Json::valueToString(value.asLargestUInt()).c_str());
|
|
96
|
-
break;
|
|
97
|
-
case Json::realValue:
|
|
98
|
-
fprintf(fout,
|
|
99
|
-
"%s=%s\n",
|
|
100
|
-
path.c_str(),
|
|
101
|
-
normalizeFloatingPointStr(value.asDouble()).c_str());
|
|
102
|
-
break;
|
|
103
|
-
case Json::stringValue:
|
|
104
|
-
fprintf(fout, "%s=\"%s\"\n", path.c_str(), value.asString().c_str());
|
|
105
|
-
break;
|
|
106
|
-
case Json::booleanValue:
|
|
107
|
-
fprintf(fout, "%s=%s\n", path.c_str(), value.asBool() ? "true" : "false");
|
|
108
|
-
break;
|
|
109
|
-
case Json::arrayValue: {
|
|
110
|
-
fprintf(fout, "%s=[]\n", path.c_str());
|
|
111
|
-
Json::ArrayIndex size = value.size();
|
|
112
|
-
for (Json::ArrayIndex index = 0; index < size; ++index) {
|
|
113
|
-
static char buffer[16];
|
|
114
|
-
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
|
115
|
-
sprintf_s(buffer, sizeof(buffer), "[%d]", index);
|
|
116
|
-
#else
|
|
117
|
-
snprintf(buffer, sizeof(buffer), "[%d]", index);
|
|
118
|
-
#endif
|
|
119
|
-
printValueTree(fout, value[index], path + buffer);
|
|
120
|
-
}
|
|
121
|
-
} break;
|
|
122
|
-
case Json::objectValue: {
|
|
123
|
-
fprintf(fout, "%s={}\n", path.c_str());
|
|
124
|
-
Json::Value::Members members(value.getMemberNames());
|
|
125
|
-
std::sort(members.begin(), members.end());
|
|
126
|
-
JSONCPP_STRING suffix = *(path.end() - 1) == '.' ? "" : ".";
|
|
127
|
-
for (Json::Value::Members::iterator it = members.begin();
|
|
128
|
-
it != members.end();
|
|
129
|
-
++it) {
|
|
130
|
-
const JSONCPP_STRING name = *it;
|
|
131
|
-
printValueTree(fout, value[name], path + suffix + name);
|
|
132
|
-
}
|
|
133
|
-
} break;
|
|
134
|
-
default:
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (value.hasComment(Json::commentAfter)) {
|
|
139
|
-
fprintf(fout, "%s\n", value.getComment(Json::commentAfter).c_str());
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
static int parseAndSaveValueTree(const JSONCPP_STRING& input,
|
|
144
|
-
const JSONCPP_STRING& actual,
|
|
145
|
-
const JSONCPP_STRING& kind,
|
|
146
|
-
const Json::Features& features,
|
|
147
|
-
bool parseOnly,
|
|
148
|
-
Json::Value* root)
|
|
149
|
-
{
|
|
150
|
-
Json::Reader reader(features);
|
|
151
|
-
bool parsingSuccessful = reader.parse(input.data(), input.data() + input.size(), *root);
|
|
152
|
-
if (!parsingSuccessful) {
|
|
153
|
-
printf("Failed to parse %s file: \n%s\n",
|
|
154
|
-
kind.c_str(),
|
|
155
|
-
reader.getFormattedErrorMessages().c_str());
|
|
156
|
-
return 1;
|
|
157
|
-
}
|
|
158
|
-
if (!parseOnly) {
|
|
159
|
-
FILE* factual = fopen(actual.c_str(), "wt");
|
|
160
|
-
if (!factual) {
|
|
161
|
-
printf("Failed to create %s actual file.\n", kind.c_str());
|
|
162
|
-
return 2;
|
|
163
|
-
}
|
|
164
|
-
printValueTree(factual, *root);
|
|
165
|
-
fclose(factual);
|
|
166
|
-
}
|
|
167
|
-
return 0;
|
|
168
|
-
}
|
|
169
|
-
// static JSONCPP_STRING useFastWriter(Json::Value const& root) {
|
|
170
|
-
// Json::FastWriter writer;
|
|
171
|
-
// writer.enableYAMLCompatibility();
|
|
172
|
-
// return writer.write(root);
|
|
173
|
-
// }
|
|
174
|
-
static JSONCPP_STRING useStyledWriter(
|
|
175
|
-
Json::Value const& root)
|
|
176
|
-
{
|
|
177
|
-
Json::StyledWriter writer;
|
|
178
|
-
return writer.write(root);
|
|
179
|
-
}
|
|
180
|
-
static JSONCPP_STRING useStyledStreamWriter(
|
|
181
|
-
Json::Value const& root)
|
|
182
|
-
{
|
|
183
|
-
Json::StyledStreamWriter writer;
|
|
184
|
-
JSONCPP_OSTRINGSTREAM sout;
|
|
185
|
-
writer.write(sout, root);
|
|
186
|
-
return sout.str();
|
|
187
|
-
}
|
|
188
|
-
static JSONCPP_STRING useBuiltStyledStreamWriter(
|
|
189
|
-
Json::Value const& root)
|
|
190
|
-
{
|
|
191
|
-
Json::StreamWriterBuilder builder;
|
|
192
|
-
return Json::writeString(builder, root);
|
|
193
|
-
}
|
|
194
|
-
static int rewriteValueTree(
|
|
195
|
-
const JSONCPP_STRING& rewritePath,
|
|
196
|
-
const Json::Value& root,
|
|
197
|
-
Options::writeFuncType write,
|
|
198
|
-
JSONCPP_STRING* rewrite)
|
|
199
|
-
{
|
|
200
|
-
*rewrite = write(root);
|
|
201
|
-
FILE* fout = fopen(rewritePath.c_str(), "wt");
|
|
202
|
-
if (!fout) {
|
|
203
|
-
printf("Failed to create rewrite file: %s\n", rewritePath.c_str());
|
|
204
|
-
return 2;
|
|
205
|
-
}
|
|
206
|
-
fprintf(fout, "%s\n", rewrite->c_str());
|
|
207
|
-
fclose(fout);
|
|
208
|
-
return 0;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
static JSONCPP_STRING removeSuffix(const JSONCPP_STRING& path,
|
|
212
|
-
const JSONCPP_STRING& extension) {
|
|
213
|
-
if (extension.length() >= path.length())
|
|
214
|
-
return JSONCPP_STRING("");
|
|
215
|
-
JSONCPP_STRING suffix = path.substr(path.length() - extension.length());
|
|
216
|
-
if (suffix != extension)
|
|
217
|
-
return JSONCPP_STRING("");
|
|
218
|
-
return path.substr(0, path.length() - extension.length());
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
static void printConfig() {
|
|
222
|
-
// Print the configuration used to compile JsonCpp
|
|
223
|
-
#if defined(JSON_NO_INT64)
|
|
224
|
-
printf("JSON_NO_INT64=1\n");
|
|
225
|
-
#else
|
|
226
|
-
printf("JSON_NO_INT64=0\n");
|
|
227
|
-
#endif
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
static int printUsage(const char* argv[]) {
|
|
231
|
-
printf("Usage: %s [--strict] input-json-file", argv[0]);
|
|
232
|
-
return 3;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
static int parseCommandLine(
|
|
236
|
-
int argc, const char* argv[], Options* opts)
|
|
237
|
-
{
|
|
238
|
-
opts->parseOnly = false;
|
|
239
|
-
opts->write = &useStyledWriter;
|
|
240
|
-
if (argc < 2) {
|
|
241
|
-
return printUsage(argv);
|
|
242
|
-
}
|
|
243
|
-
int index = 1;
|
|
244
|
-
if (JSONCPP_STRING(argv[index]) == "--json-checker") {
|
|
245
|
-
opts->features = Json::Features::strictMode();
|
|
246
|
-
opts->parseOnly = true;
|
|
247
|
-
++index;
|
|
248
|
-
}
|
|
249
|
-
if (JSONCPP_STRING(argv[index]) == "--json-config") {
|
|
250
|
-
printConfig();
|
|
251
|
-
return 3;
|
|
252
|
-
}
|
|
253
|
-
if (JSONCPP_STRING(argv[index]) == "--json-writer") {
|
|
254
|
-
++index;
|
|
255
|
-
JSONCPP_STRING const writerName(argv[index++]);
|
|
256
|
-
if (writerName == "StyledWriter") {
|
|
257
|
-
opts->write = &useStyledWriter;
|
|
258
|
-
} else if (writerName == "StyledStreamWriter") {
|
|
259
|
-
opts->write = &useStyledStreamWriter;
|
|
260
|
-
} else if (writerName == "BuiltStyledStreamWriter") {
|
|
261
|
-
opts->write = &useBuiltStyledStreamWriter;
|
|
262
|
-
} else {
|
|
263
|
-
printf("Unknown '--json-writer %s'\n", writerName.c_str());
|
|
264
|
-
return 4;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
if (index == argc || index + 1 < argc) {
|
|
268
|
-
return printUsage(argv);
|
|
269
|
-
}
|
|
270
|
-
opts->path = argv[index];
|
|
271
|
-
return 0;
|
|
272
|
-
}
|
|
273
|
-
static int runTest(Options const& opts)
|
|
274
|
-
{
|
|
275
|
-
int exitCode = 0;
|
|
276
|
-
|
|
277
|
-
JSONCPP_STRING input = readInputTestFile(opts.path.c_str());
|
|
278
|
-
if (input.empty()) {
|
|
279
|
-
printf("Failed to read input or empty input: %s\n", opts.path.c_str());
|
|
280
|
-
return 3;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
JSONCPP_STRING basePath = removeSuffix(opts.path, ".json");
|
|
284
|
-
if (!opts.parseOnly && basePath.empty()) {
|
|
285
|
-
printf("Bad input path. Path does not end with '.expected':\n%s\n",
|
|
286
|
-
opts.path.c_str());
|
|
287
|
-
return 3;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
JSONCPP_STRING const actualPath = basePath + ".actual";
|
|
291
|
-
JSONCPP_STRING const rewritePath = basePath + ".rewrite";
|
|
292
|
-
JSONCPP_STRING const rewriteActualPath = basePath + ".actual-rewrite";
|
|
293
|
-
|
|
294
|
-
Json::Value root;
|
|
295
|
-
exitCode = parseAndSaveValueTree(
|
|
296
|
-
input, actualPath, "input",
|
|
297
|
-
opts.features, opts.parseOnly, &root);
|
|
298
|
-
if (exitCode || opts.parseOnly) {
|
|
299
|
-
return exitCode;
|
|
300
|
-
}
|
|
301
|
-
JSONCPP_STRING rewrite;
|
|
302
|
-
exitCode = rewriteValueTree(rewritePath, root, opts.write, &rewrite);
|
|
303
|
-
if (exitCode) {
|
|
304
|
-
return exitCode;
|
|
305
|
-
}
|
|
306
|
-
Json::Value rewriteRoot;
|
|
307
|
-
exitCode = parseAndSaveValueTree(
|
|
308
|
-
rewrite, rewriteActualPath, "rewrite",
|
|
309
|
-
opts.features, opts.parseOnly, &rewriteRoot);
|
|
310
|
-
if (exitCode) {
|
|
311
|
-
return exitCode;
|
|
312
|
-
}
|
|
313
|
-
return 0;
|
|
314
|
-
}
|
|
315
|
-
int main(int argc, const char* argv[]) {
|
|
316
|
-
Options opts;
|
|
317
|
-
try {
|
|
318
|
-
int exitCode = parseCommandLine(argc, argv, &opts);
|
|
319
|
-
if (exitCode != 0) {
|
|
320
|
-
printf("Failed to parse command-line.");
|
|
321
|
-
return exitCode;
|
|
322
|
-
}
|
|
323
|
-
return runTest(opts);
|
|
324
|
-
}
|
|
325
|
-
catch (const std::exception& e) {
|
|
326
|
-
printf("Unhandled exception:\n%s\n", e.what());
|
|
327
|
-
return 1;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
#if defined(__GNUC__)
|
|
332
|
-
#pragma GCC diagnostic pop
|
|
333
|
-
#endif
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
IF( CMAKE_COMPILER_IS_GNUCXX )
|
|
2
|
-
#Get compiler version.
|
|
3
|
-
EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
|
4
|
-
OUTPUT_VARIABLE GNUCXX_VERSION )
|
|
5
|
-
|
|
6
|
-
#-Werror=* was introduced -after- GCC 4.1.2
|
|
7
|
-
IF( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
|
|
8
|
-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
|
9
|
-
ENDIF()
|
|
10
|
-
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
|
|
11
|
-
|
|
12
|
-
INCLUDE(CheckIncludeFileCXX)
|
|
13
|
-
INCLUDE(CheckTypeSize)
|
|
14
|
-
INCLUDE(CheckStructHasMember)
|
|
15
|
-
INCLUDE(CheckCXXSymbolExists)
|
|
16
|
-
|
|
17
|
-
check_include_file_cxx(clocale HAVE_CLOCALE)
|
|
18
|
-
check_cxx_symbol_exists(localeconv clocale HAVE_LOCALECONV)
|
|
19
|
-
|
|
20
|
-
IF(CMAKE_VERSION VERSION_LESS 3.0.0)
|
|
21
|
-
# The "LANGUAGE CXX" parameter is not supported in CMake versions below 3,
|
|
22
|
-
# so the C compiler and header has to be used.
|
|
23
|
-
check_include_file(locale.h HAVE_LOCALE_H)
|
|
24
|
-
SET(CMAKE_EXTRA_INCLUDE_FILES locale.h)
|
|
25
|
-
check_type_size("struct lconv" LCONV_SIZE)
|
|
26
|
-
UNSET(CMAKE_EXTRA_INCLUDE_FILES)
|
|
27
|
-
check_struct_has_member("struct lconv" decimal_point locale.h HAVE_DECIMAL_POINT)
|
|
28
|
-
ELSE()
|
|
29
|
-
SET(CMAKE_EXTRA_INCLUDE_FILES clocale)
|
|
30
|
-
check_type_size(lconv LCONV_SIZE LANGUAGE CXX)
|
|
31
|
-
UNSET(CMAKE_EXTRA_INCLUDE_FILES)
|
|
32
|
-
check_struct_has_member(lconv decimal_point clocale HAVE_DECIMAL_POINT LANGUAGE CXX)
|
|
33
|
-
ENDIF()
|
|
34
|
-
|
|
35
|
-
IF(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALECONV))
|
|
36
|
-
MESSAGE(WARNING "Locale functionality is not supported")
|
|
37
|
-
ADD_DEFINITIONS(-DJSONCPP_NO_LOCALE_SUPPORT)
|
|
38
|
-
ENDIF()
|
|
39
|
-
|
|
40
|
-
SET( JSONCPP_INCLUDE_DIR ../../include )
|
|
41
|
-
|
|
42
|
-
SET( PUBLIC_HEADERS
|
|
43
|
-
${JSONCPP_INCLUDE_DIR}/json/config.h
|
|
44
|
-
${JSONCPP_INCLUDE_DIR}/json/forwards.h
|
|
45
|
-
${JSONCPP_INCLUDE_DIR}/json/features.h
|
|
46
|
-
${JSONCPP_INCLUDE_DIR}/json/value.h
|
|
47
|
-
${JSONCPP_INCLUDE_DIR}/json/reader.h
|
|
48
|
-
${JSONCPP_INCLUDE_DIR}/json/writer.h
|
|
49
|
-
${JSONCPP_INCLUDE_DIR}/json/assertions.h
|
|
50
|
-
${JSONCPP_INCLUDE_DIR}/json/version.h
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
SOURCE_GROUP( "Public API" FILES ${PUBLIC_HEADERS} )
|
|
54
|
-
|
|
55
|
-
SET(jsoncpp_sources
|
|
56
|
-
json_tool.h
|
|
57
|
-
json_reader.cpp
|
|
58
|
-
json_valueiterator.inl
|
|
59
|
-
json_value.cpp
|
|
60
|
-
json_writer.cpp
|
|
61
|
-
version.h.in)
|
|
62
|
-
|
|
63
|
-
# Install instructions for this target
|
|
64
|
-
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
|
65
|
-
SET(INSTALL_EXPORT EXPORT jsoncpp)
|
|
66
|
-
ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
|
|
67
|
-
SET(INSTALL_EXPORT)
|
|
68
|
-
ENDIF()
|
|
69
|
-
|
|
70
|
-
IF(BUILD_SHARED_LIBS)
|
|
71
|
-
ADD_DEFINITIONS( -DJSON_DLL_BUILD )
|
|
72
|
-
ADD_LIBRARY(jsoncpp_lib SHARED ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
|
73
|
-
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
|
|
74
|
-
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
|
|
75
|
-
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
|
|
76
|
-
|
|
77
|
-
# Set library's runtime search path on OSX
|
|
78
|
-
IF(APPLE)
|
|
79
|
-
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
|
|
80
|
-
ENDIF()
|
|
81
|
-
|
|
82
|
-
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
|
83
|
-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
84
|
-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
85
|
-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
86
|
-
|
|
87
|
-
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
|
88
|
-
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
|
|
89
|
-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
90
|
-
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>)
|
|
91
|
-
ENDIF()
|
|
92
|
-
|
|
93
|
-
ENDIF()
|
|
94
|
-
|
|
95
|
-
IF(BUILD_STATIC_LIBS)
|
|
96
|
-
ADD_LIBRARY(jsoncpp_lib_static STATIC ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
|
97
|
-
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
|
|
98
|
-
# avoid name clashes on windows as the shared import lib is also named jsoncpp.lib
|
|
99
|
-
if (NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS)
|
|
100
|
-
set (STATIC_SUFFIX "_static")
|
|
101
|
-
endif ()
|
|
102
|
-
set_target_properties (jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp${STATIC_SUFFIX}
|
|
103
|
-
DEBUG_OUTPUT_NAME jsoncpp${STATIC_SUFFIX}${DEBUG_LIBNAME_SUFFIX})
|
|
104
|
-
|
|
105
|
-
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
|
106
|
-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
107
|
-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
108
|
-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
109
|
-
|
|
110
|
-
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
|
111
|
-
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC
|
|
112
|
-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
|
113
|
-
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
|
114
|
-
)
|
|
115
|
-
ENDIF()
|
|
116
|
-
|
|
117
|
-
ENDIF()
|