├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ ├── native_a_hello_test.cpp │ ├── native_a_jsoncpp_test.cpp │ ├── native_lib.cpp │ ├── native_so_hello_test.cpp │ └── native_so_jsoncpp_test.cpp │ ├── java │ └── com │ │ └── xong │ │ ├── jni │ │ ├── NativeHelloALib.java │ │ ├── NativeHelloSoLib.java │ │ ├── NativeJsonALib.java │ │ ├── NativeJsonSoLib.java │ │ └── Nativelib.java │ │ └── usecmakebuildlib │ │ └── MainActivity.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── export ├── libahello │ ├── include │ │ └── ahello.h │ └── lib │ │ ├── arm64-v8a │ │ └── libhello.a │ │ ├── armeabi-v7a │ │ └── libhello.a │ │ ├── x86 │ │ └── libhello.a │ │ └── x86_64 │ │ └── libhello.a ├── libajsoncpp │ ├── include │ │ └── json │ │ │ ├── allocator.h │ │ │ ├── assertions.h │ │ │ ├── autolink.h │ │ │ ├── config.h │ │ │ ├── features.h │ │ │ ├── forwards.h │ │ │ ├── json.h │ │ │ ├── reader.h │ │ │ ├── value.h │ │ │ ├── version.h │ │ │ └── writer.h │ └── lib │ │ ├── arm64-v8a │ │ └── libjsoncpp.a │ │ ├── armeabi-v7a │ │ └── libjsoncpp.a │ │ ├── x86 │ │ └── libjsoncpp.a │ │ └── x86_64 │ │ └── libjsoncpp.a ├── libsohello │ ├── include │ │ └── sohello.h │ └── lib │ │ ├── arm64-v8a │ │ └── libhello.so │ │ ├── armeabi-v7a │ │ └── libhello.so │ │ ├── x86 │ │ └── libhello.so │ │ └── x86_64 │ │ └── libhello.so └── libsojsoncpp │ ├── include │ └── json │ │ ├── allocator.h │ │ ├── assertions.h │ │ ├── autolink.h │ │ ├── config.h │ │ ├── features.h │ │ ├── forwards.h │ │ ├── json.h │ │ ├── reader.h │ │ ├── value.h │ │ ├── version.h │ │ └── writer.h │ └── lib │ ├── arm64-v8a │ └── libjsoncpp.so │ ├── armeabi-v7a │ └── libjsoncpp.so │ ├── x86 │ └── libjsoncpp.so │ └── x86_64 │ └── libjsoncpp.so ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libajsoncpp ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ └── jsoncpp │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── json │ │ ├── allocator.h │ │ ├── assertions.h │ │ ├── autolink.h │ │ ├── config.h │ │ ├── features.h │ │ ├── forwards.h │ │ ├── json.h │ │ ├── reader.h │ │ ├── value.h │ │ ├── version.h │ │ └── writer.h │ │ ├── json_reader.cpp │ │ ├── json_tool.h │ │ ├── json_value.cpp │ │ ├── json_valueiterator.inl │ │ ├── json_writer.cpp │ │ └── version.h.in │ └── res │ └── values │ └── strings.xml ├── libasimple ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ └── hello │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── ahello.cpp │ │ └── ahello.h │ └── res │ └── values │ └── strings.xml ├── libcode ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ ├── jsoncpp │ │ ├── json │ │ │ ├── allocator.h │ │ │ ├── assertions.h │ │ │ ├── autolink.h │ │ │ ├── config.h │ │ │ ├── features.h │ │ │ ├── forwards.h │ │ │ ├── json.h │ │ │ ├── reader.h │ │ │ ├── value.h │ │ │ ├── version.h │ │ │ └── writer.h │ │ ├── json_reader.cpp │ │ ├── json_tool.h │ │ ├── json_value.cpp │ │ ├── json_valueiterator.inl │ │ ├── json_writer.cpp │ │ └── version.h.in │ └── useCode.cpp │ ├── java │ └── com │ │ └── xong │ │ └── libcode │ │ └── jni │ │ └── NativeCode.java │ └── res │ └── values │ └── strings.xml ├── libsojsoncpp ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ └── jsoncpp │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── json │ │ ├── allocator.h │ │ ├── assertions.h │ │ ├── autolink.h │ │ ├── config.h │ │ ├── features.h │ │ ├── forwards.h │ │ ├── json.h │ │ ├── reader.h │ │ ├── value.h │ │ ├── version.h │ │ └── writer.h │ │ ├── json_reader.cpp │ │ ├── json_tool.h │ │ ├── json_value.cpp │ │ ├── json_valueiterator.inl │ │ ├── json_writer.cpp │ │ └── version.h.in │ └── res │ └── values │ └── strings.xml ├── libsosimple ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── cpp │ ├── CMakeLists.txt │ └── hello │ │ ├── CMakeLists.txt │ │ └── src │ │ ├── sohello.cpp │ │ └── sohello.h │ └── res │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | .gradle 4 | /local.properties 5 | /.idea/caches/build_file_checksums.ser 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | .DS_Store 10 | /build 11 | /captures 12 | .externalNativeBuild 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 使用Cmake构建.a静态库和.so动态库 2 | * Google例子[hello-libs](https://github.com/googlesamples/android-ndk/tree/master/hello-libs) 3 | * 对应文章[关于在Android中使用CMake你所需要了解的一切](https://juejin.im/post/5bb025db5188255c38537198) 4 | ### Demo中子模块说明: 5 | 6 | * **libcode:** 7 | 以源码的形式将SDK依赖到cpp中使用 8 | * **libsosimple:** 9 | 构建hello简单的.so动态库,且将.so和所需头文件导出到 project/export/libsohello 目录中 10 | * **libsojsoncpp:** 11 | 构建jsoncpp的.so动态库,且将.so和所需头文件导出到 project/export/libsojsoncpp 目录中 12 | * **libasimple:** 13 | 构建一个hello简单的.a静态库,且将.a和所需头文件导出到 project/export/libahello 目录中 14 | * **libajsoncpp:** 15 | 构建jsoncpp的.a静态库,且将.a和所需头文件导出到 project/export/libajsoncpp 目录中 16 | 17 | 18 | 19 | ### 注: 20 | 1. export 是编译 任何一个模块 自己在当前项目目录下自动生成的; 21 | 1. app/src/main/cpp/CmakeLists.txt 中的注释是关于链接so动态库、a静态库、链接头文件到native; 22 | 1. libasimple/build.gradle 中需要设置一下 targets 名称,最好和 libasimple/src/main/cpp/hello/CmakeLists.txt 中的名字一样 如下: 23 | ``` 24 | android { 25 | ... 26 | defaultConfig { 27 | ... 28 | externalNativeBuild { 29 | cmake { 30 | ... 31 | targets "hello" 32 | ... 33 | } 34 | } 35 | ... 36 | } 37 | ... 38 | } 39 | ``` 40 | 1. libasimple/src/main/cpp/CmakeLists.txt 中的注释是关于 编译前期目录配置 和 链接 子目录; 41 | 1. libasimple/src/main/cpp/hello/CmakeLists.txt 中的注释是关于 库名字、库类型、库导出路径、头文件导出; 42 | 1. libsosimple/src/main/cpp/hello/CmakeLists.txt 中的注释是关于 so动态库如何导出,相比 **第5条** 只改了一个参数; 43 | 1. libajsoncpp/src/main/cpp/jsoncpp/CmakeLists.txt 中的注释是关于 相比 **第5条** 多了一个 按文件夹导出的命令; 44 | 1. app/build.gradle 中最重要的注释是关于集成so动态库时的注意事项,配置如下: 45 | ``` 46 | android { 47 | ... 48 | sourceSets { 49 | main { 50 | jniLibs.srcDirs = ['../export/libsohello/lib', '../export/libsojsoncpp/lib'] 51 | } 52 | } 53 | ... 54 | } 55 | ``` 56 | 57 | ### OTHER 58 | 提一个问题: 59 | ``` 60 | env->GetStringUTFChars(string, NULL); 61 | env->ReleaseStringUTFChars(string, const char*); 62 | ``` 63 | 这两个必须成对出现吗? 64 | 说出理由。 65 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.xong.usecmakebuildlib" 7 | minSdkVersion 15 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | externalNativeBuild { 12 | cmake { 13 | arguments '-DANDROID_STL=c++_static' 14 | } 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | // 当使用so动态库时 必须设置so库路径让gradle将需要的库打到apk中,若不需要动态库,则将以下命令注释 sourceSets{ } 24 | sourceSets { 25 | main { 26 | jniLibs.srcDirs = ['../export/libsohello/lib', '../export/libsojsoncpp/lib'] 27 | } 28 | } 29 | externalNativeBuild { 30 | cmake { 31 | path 'src/main/cpp/CMakeLists.txt' 32 | } 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation fileTree(dir: 'libs', include: ['*.jar']) 38 | implementation 'com.android.support:appcompat-v7:27.1.1' 39 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 40 | // 若需要测试源码方式,则打开以下注释,且在 setting.gradle 中 打开 include ':libcode' 注释 41 | // implementation project(':libcode') 42 | } 43 | 44 | // 若需要每次都编译libajsoncpp,则在setting.gradle中打开 include ':libajsoncpp' 注释 且将以下的tasks打开, 45 | //tasks.whenTaskAdded { task -> 46 | // if (task.name == 'externalNativeBuildRelease') { 47 | // task.dependsOn ":libajsoncpp:externalNativeBuildRelease" 48 | // } else if (task.name == 'externalNativeBuildDebug') { 49 | // task.dependsOn ":libajsoncpp:externalNativeBuildDebug" 50 | // } 51 | //} 52 | // 若需要每次都编译libasimple,则在setting.gradle中打开 include ':libasimple' 注释 且将以下的tasks打开, 53 | //tasks.whenTaskAdded { task -> 54 | // if (task.name == 'externalNativeBuildRelease') { 55 | // task.dependsOn ":libasimple:externalNativeBuildRelease" 56 | // } else if (task.name == 'externalNativeBuildDebug') { 57 | // task.dependsOn ":libasimple:externalNativeBuildDebug" 58 | // } 59 | //} 60 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | # 设置变量 找到存放资源的目录,".."代表上一级目录 4 | set(export_dir ${CMAKE_SOURCE_DIR}/../../../../export) 5 | 6 | # 添加.so动态库(hello) 7 | add_library( 8 | # 名字 9 | lib_so_hello 10 | # 库类型 11 | SHARED 12 | # 添加 13 | IMPORTED 14 | ) 15 | # 以下so相同 16 | 17 | # 链接so 18 | set_target_properties( 19 | # 名字 20 | lib_so_hello 21 | # 导入库的路径 22 | PROPERTIES IMPORTED_LOCATION ${export_dir}/libsohello/lib/${ANDROID_ABI}/libhello.so) 23 | 24 | # 添加.so动态库(jsoncpp) 25 | add_library(lib_so_jsoncpp SHARED IMPORTED) 26 | # 链接 27 | set_target_properties( 28 | lib_so_jsoncpp 29 | PROPERTIES IMPORTED_LOCATION ${export_dir}/libsojsoncpp/lib/${ANDROID_ABI}/libjsoncpp.so) 30 | 31 | # 添加.a静态库(hello) 32 | add_library( 33 | # 名字 34 | lib_a_hello 35 | # 库类型 36 | STATIC 37 | # 添加 38 | IMPORTED 39 | ) 40 | # 以下a相同 41 | 42 | # 链接 43 | set_target_properties( 44 | lib_a_hello 45 | PROPERTIES IMPORTED_LOCATION ${export_dir}/libahello/lib/${ANDROID_ABI}/libhello.a) 46 | 47 | # 添加.a静态库(jsoncpp) 48 | add_library(lib_a_jsoncpp STATIC IMPORTED) 49 | # 链接 50 | set_target_properties( 51 | lib_a_jsoncpp 52 | PROPERTIES IMPORTED_LOCATION ${export_dir}/libajsoncpp/lib/${ANDROID_ABI}/libjsoncpp.a) 53 | 54 | # build application's shared lib 55 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") 56 | 57 | add_library( 58 | native_test 59 | SHARED 60 | # new project cpp 61 | native_lib.cpp 62 | # .so hello 63 | native_so_hello_test.cpp 64 | # .a hello 65 | native_a_hello_test.cpp 66 | # .so jsoncpp 67 | native_so_jsoncpp_test.cpp 68 | # .a jsoncpp 69 | native_a_jsoncpp_test.cpp 70 | ) 71 | 72 | # 链接头文件 73 | target_include_directories( 74 | native_test 75 | PRIVATE 76 | # native_so_hello_test 需要的头文件 77 | ${export_dir}/libsohello/include 78 | # native_so_jsoncpp_test 需要的头文件 79 | ${export_dir}/libsojsoncpp/include 80 | # native_a_hello_test 需要的头文件 81 | ${export_dir}/libahello/include 82 | # navite_a_jsoncpp_test 需要的头文件 83 | ${export_dir}/libajsoncpp/include 84 | ) 85 | 86 | # 链接库 87 | target_link_libraries( 88 | native_test 89 | android 90 | log 91 | # 链接 hello.so 92 | lib_so_hello 93 | # 链接 jsoncpp.so 94 | lib_so_jsoncpp 95 | # 链接 hello.a 96 | lib_a_hello 97 | # 链接 jsoncpp.a 98 | lib_a_jsoncpp 99 | ) -------------------------------------------------------------------------------- /app/src/main/cpp/native_a_hello_test.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include 5 | #include "ahello.h" 6 | #define XONGFUNC(name)Java_com_xong_jni_##name 7 | 8 | extern "C" JNIEXPORT 9 | jint JNICALL 10 | XONGFUNC(NativeHelloALib_intFromHelloA)(JNIEnv *env, jclass type, 11 | jint i) 12 | { 13 | return ahello(i); 14 | } -------------------------------------------------------------------------------- /app/src/main/cpp/native_a_jsoncpp_test.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include 5 | #include "json/json.h" 6 | #define XONGFUNC(name)Java_com_xong_jni_##name 7 | 8 | extern "C" JNIEXPORT 9 | jstring JNICALL 10 | XONGFUNC(NativeJsonALib_outputJsonA)(JNIEnv *env, jclass thiz, 11 | jstring jname, jstring jage, jstring jsex, jstring jtype) 12 | { 13 | Json::Value root; 14 | const char *name = env->GetStringUTFChars(jname, NULL); 15 | const char *age = env->GetStringUTFChars(jage, NULL); 16 | const char *sex = env->GetStringUTFChars(jsex, NULL); 17 | const char *type = env->GetStringUTFChars(jtype, NULL); 18 | 19 | root["name"] = name; 20 | root["age"] = age; 21 | root["sex"] = sex; 22 | root["type"] = type; 23 | 24 | env->ReleaseStringUTFChars(jname, name); 25 | env->ReleaseStringUTFChars(jage, age); 26 | env->ReleaseStringUTFChars(jsex, sex); 27 | env->ReleaseStringUTFChars(jtype, type); 28 | 29 | return env->NewStringUTF(root.toStyledString().c_str()); 30 | } 31 | 32 | extern "C" JNIEXPORT 33 | jstring JNICALL 34 | XONGFUNC(NativeJsonALib_parseJsonA)(JNIEnv *env, jclass thiz, 35 | jstring jjson) 36 | { 37 | const char *json_str = env->GetStringUTFChars(jjson, NULL); 38 | std::string out_str; 39 | 40 | Json::CharReaderBuilder b; 41 | Json::CharReader *reader(b.newCharReader()); 42 | Json::Value root; 43 | JSONCPP_STRING errs; 44 | bool ok = reader->parse(json_str, json_str + std::strlen(json_str), &root, &errs); 45 | if (ok && errs.size() == 0) { 46 | std::string name = root["name"].asString(); 47 | std::string age = root["age"].asString(); 48 | std::string sex = root["sex"].asString(); 49 | std::string type = root["type"].asString(); 50 | out_str = "name: " + name + "\nage: " + age + "\nsex:" + sex + "\ntype: " + type + "\n"; 51 | } 52 | 53 | env->ReleaseStringUTFChars(jjson, json_str); 54 | 55 | return env->NewStringUTF(out_str.c_str()); 56 | } -------------------------------------------------------------------------------- /app/src/main/cpp/native_lib.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/26. 3 | // 4 | #include 5 | #include 6 | #define XONGFUNC(name)Java_com_xong_jni_##name 7 | 8 | extern "C" JNIEXPORT 9 | jstring JNICALL 10 | XONGFUNC(Nativelib_stringFromNativeLib)(JNIEnv *env, jclass type) { 11 | std::string str = "hello from native_lib"; 12 | // 思考下: 13 | // 为啥不是构建一个string然后调用env->NewStringUTF(str.c_str()) 14 | // 而是直接env->NewStringUTF("hello from native_lib") 15 | // Android Studio 创建C++项目时是上面那种方式,然后…我就被上个老大教育了一下… 16 | return env->NewStringUTF("hello from native_lib"); 17 | // return env->NewStringUTF(str.c_str()); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/cpp/native_so_hello_test.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include 5 | #include "sohello.h" 6 | #define XONGFUNC(name)Java_com_xong_jni_##name 7 | 8 | extern "C" JNIEXPORT 9 | jint JNICALL 10 | XONGFUNC(NativeHelloSoLib_intFromHelloSo)(JNIEnv *env, jclass type, 11 | jint i) 12 | { 13 | return sohello(i); 14 | } -------------------------------------------------------------------------------- /app/src/main/cpp/native_so_jsoncpp_test.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include 5 | #include "json/json.h" 6 | #define XONGFUNC(name)Java_com_xong_jni_##name 7 | 8 | extern "C" JNIEXPORT 9 | jstring JNICALL 10 | XONGFUNC(NativeJsonSoLib_outputJsonSo)(JNIEnv *env, jclass thiz, 11 | jstring jname, jstring jage, jstring jsex, jstring jtype) 12 | { 13 | Json::Value root; 14 | const char *name = env->GetStringUTFChars(jname, NULL); 15 | const char *age = env->GetStringUTFChars(jage, NULL); 16 | const char *sex = env->GetStringUTFChars(jsex, NULL); 17 | const char *type = env->GetStringUTFChars(jtype, NULL); 18 | root["name"] = name; 19 | root["age"] = age; 20 | root["sex"] = sex; 21 | root["type"] = type; 22 | 23 | env->ReleaseStringUTFChars(jname, name); 24 | env->ReleaseStringUTFChars(jage, age); 25 | env->ReleaseStringUTFChars(jsex, sex); 26 | env->ReleaseStringUTFChars(jtype, type); 27 | 28 | return env->NewStringUTF(root.toStyledString().c_str()); 29 | } 30 | 31 | extern "C" JNIEXPORT 32 | jstring JNICALL 33 | XONGFUNC(NativeJsonSoLib_parseJsonSo)(JNIEnv *env, jclass thiz, 34 | jstring jjson) 35 | { 36 | const char *json_str = env->GetStringUTFChars(jjson, NULL); 37 | std::string out_str; 38 | 39 | Json::CharReaderBuilder b; 40 | Json::CharReader *reader(b.newCharReader()); 41 | Json::Value root; 42 | JSONCPP_STRING errs; 43 | bool ok = reader->parse(json_str, json_str + std::strlen(json_str), &root, &errs); 44 | if (ok && errs.size() == 0) { 45 | std::string name = root["name"].asString(); 46 | std::string age = root["age"].asString(); 47 | std::string sex = root["sex"].asString(); 48 | std::string type = root["type"].asString(); 49 | out_str = "name: " + name + "\nage: " + age + "\nsex: " + sex + "\ntype: " + type + "\n"; 50 | } 51 | 52 | env->ReleaseStringUTFChars(jjson, json_str); 53 | 54 | return env->NewStringUTF(out_str.c_str()); 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/xong/jni/NativeHelloALib.java: -------------------------------------------------------------------------------- 1 | package com.xong.jni; 2 | 3 | /** 4 | * Create by xong on 2018/9/26 5 | */ 6 | public class NativeHelloALib { 7 | static { 8 | System.loadLibrary("native_test"); 9 | } 10 | public static native int intFromHelloA(int i); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/xong/jni/NativeHelloSoLib.java: -------------------------------------------------------------------------------- 1 | package com.xong.jni; 2 | 3 | /** 4 | * Create by xong on 2018/9/26 5 | */ 6 | public class NativeHelloSoLib { 7 | static { 8 | System.loadLibrary("native_test"); 9 | } 10 | public static native int intFromHelloSo(int i); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/xong/jni/NativeJsonALib.java: -------------------------------------------------------------------------------- 1 | package com.xong.jni; 2 | 3 | /** 4 | * Create by xong on 2018/9/26 5 | */ 6 | public class NativeJsonALib { 7 | 8 | static { 9 | System.loadLibrary("native_test"); 10 | } 11 | 12 | // 生成json 13 | public static native String outputJsonA(String name, String age, String sex, String type); 14 | // 解析json 15 | public static native String parseJsonA(String json_str); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/xong/jni/NativeJsonSoLib.java: -------------------------------------------------------------------------------- 1 | package com.xong.jni; 2 | 3 | /** 4 | * Create by xong on 2018/9/26 5 | */ 6 | public class NativeJsonSoLib { 7 | 8 | static { 9 | System.loadLibrary("native_test"); 10 | } 11 | 12 | public static native String outputJsonSo(String name, String age, String sex, String type); 13 | 14 | public static native String parseJsonSo(String json_str); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/xong/jni/Nativelib.java: -------------------------------------------------------------------------------- 1 | package com.xong.jni; 2 | 3 | /** 4 | * Create by xong on 2018/9/26 5 | */ 6 | public class Nativelib { 7 | static { 8 | System.loadLibrary("native_test"); 9 | } 10 | public static native String stringFromNativeLib(); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/xong/usecmakebuildlib/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.xong.usecmakebuildlib; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.TextView; 6 | 7 | public class MainActivity extends AppCompatActivity { 8 | 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main); 13 | TextView tv_libs_content = findViewById(R.id.tv_libs_content); 14 | 15 | // new project 16 | // tv_libs_content.setText(Nativelib.stringFromNativeLib()); 17 | 18 | /**---------------------------libcode---------------------------*/ 19 | // 集成cpp源码方式生成json字符串 20 | // String outputJsonCode = NativeCode.outputJsonCode("xong", "21", "man", "code"); 21 | // tv_libs_content.setText(outputJsonCode); 22 | // 集成cpp源码方式中解析json函数 23 | // String parseJsonCode = NativeCode.parseJsonCode(outputJsonCode); 24 | // tv_libs_content.setText(parseJsonCode); 25 | 26 | /**---------------------------libasimple---------------------------*/ 27 | // 调用hello.a静态库中的函数 28 | // tv_libs_content.setText(String.valueOf(NativeHelloALib.intFromHelloA(100))); 29 | 30 | /**---------------------------libsosimple---------------------------*/ 31 | // 调用hello.so动态库中的函数 32 | // tv_libs_content.setText(String.valueOf(NativeHelloSoLib.intFromHelloSo(10))); 33 | 34 | /**---------------------------libajsoncpp---------------------------*/ 35 | // 调用jsoncpp.a生成json 36 | // String outputJson = NativeJsonALib.outputJsonA("xong", "21", "man", "a"); 37 | // tv_libs_content.setText(outputJson); 38 | //// 调用jsoncpp.a解析json 39 | // String parseJson = NativeJsonALib.parseJsonA(outputJson); 40 | // tv_libs_content.setText(parseJson); 41 | 42 | /**---------------------------libsojsoncpp---------------------------*/ 43 | // 调用jsoncpp.so生成json 44 | // String outputJsonSo = NativeJsonSoLib.outputJsonSo("xong", "21", "man", "so"); 45 | // tv_libs_content.setText(outputJsonSo); 46 | // 调用jsoncpp.so解析json 47 | // String parseJsonSo = NativeJsonSoLib.parseJsonSo(outputJsonSo); 48 | // tv_libs_content.setText(parseJsonSo); 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | UseCmakeBuildLib 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.2.0' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /export/libahello/include/ahello.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | 5 | #ifndef USECMAKEBUILDLIB_LIBAHELLO_H 6 | #define USECMAKEBUILDLIB_LIBAHELLO_H 7 | 8 | int ahello(int i); 9 | 10 | #endif //USECMAKEBUILDLIB_LIBAHELLO_H 11 | -------------------------------------------------------------------------------- /export/libahello/lib/arm64-v8a/libhello.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libahello/lib/arm64-v8a/libhello.a -------------------------------------------------------------------------------- /export/libahello/lib/armeabi-v7a/libhello.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libahello/lib/armeabi-v7a/libhello.a -------------------------------------------------------------------------------- /export/libahello/lib/x86/libhello.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libahello/lib/x86/libhello.a -------------------------------------------------------------------------------- /export/libahello/lib/x86_64/libhello.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libahello/lib/x86_64/libhello.a -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/allocator.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED 7 | #define CPPTL_JSON_ALLOCATOR_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #pragma pack(push, 8) 13 | 14 | namespace Json { 15 | template class SecureAllocator { 16 | public: 17 | // Type definitions 18 | using value_type = T; 19 | using pointer = T*; 20 | using const_pointer = const T*; 21 | using reference = T&; 22 | using const_reference = const T&; 23 | using size_type = std::size_t; 24 | using difference_type = std::ptrdiff_t; 25 | 26 | /** 27 | * Allocate memory for N items using the standard allocator. 28 | */ 29 | pointer allocate(size_type n) { 30 | // allocate using "global operator new" 31 | return static_cast(::operator new(n * sizeof(T))); 32 | } 33 | 34 | /** 35 | * Release memory which was allocated for N items at pointer P. 36 | * 37 | * The memory block is filled with zeroes before being released. 38 | * The pointer argument is tagged as "volatile" to prevent the 39 | * compiler optimizing out this critical step. 40 | */ 41 | void deallocate(volatile pointer p, size_type n) { 42 | std::memset(p, 0, n * sizeof(T)); 43 | // free using "global operator delete" 44 | ::operator delete(p); 45 | } 46 | 47 | /** 48 | * Construct an item in-place at pointer P. 49 | */ 50 | template void construct(pointer p, Args&&... args) { 51 | // construct using "placement new" and "perfect forwarding" 52 | ::new (static_cast(p)) T(std::forward(args)...); 53 | } 54 | 55 | size_type max_size() const { return size_t(-1) / sizeof(T); } 56 | 57 | pointer address(reference x) const { return std::addressof(x); } 58 | 59 | const_pointer address(const_reference x) const { return std::addressof(x); } 60 | 61 | /** 62 | * Destroy an item in-place at pointer P. 63 | */ 64 | void destroy(pointer p) { 65 | // destroy using "explicit destructor" 66 | p->~T(); 67 | } 68 | 69 | // Boilerplate 70 | SecureAllocator() {} 71 | template SecureAllocator(const SecureAllocator&) {} 72 | template struct rebind { using other = SecureAllocator; }; 73 | }; 74 | 75 | template 76 | bool operator==(const SecureAllocator&, const SecureAllocator&) { 77 | return true; 78 | } 79 | 80 | template 81 | bool operator!=(const SecureAllocator&, const SecureAllocator&) { 82 | return false; 83 | } 84 | 85 | } // namespace Json 86 | 87 | #pragma pack(pop) 88 | 89 | #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED 90 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/assertions.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED 7 | #define CPPTL_JSON_ASSERTIONS_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #if !defined(JSON_IS_AMALGAMATION) 13 | #include "config.h" 14 | #endif // if !defined(JSON_IS_AMALGAMATION) 15 | 16 | /** It should not be possible for a maliciously designed file to 17 | * cause an abort() or seg-fault, so these macros are used only 18 | * for pre-condition violations and internal logic errors. 19 | */ 20 | #if JSON_USE_EXCEPTION 21 | 22 | // @todo <= add detail about condition in exception 23 | #define JSON_ASSERT(condition) \ 24 | { \ 25 | if (!(condition)) { \ 26 | Json::throwLogicError("assert json failed"); \ 27 | } \ 28 | } 29 | 30 | #define JSON_FAIL_MESSAGE(message) \ 31 | { \ 32 | JSONCPP_OSTRINGSTREAM oss; \ 33 | oss << message; \ 34 | Json::throwLogicError(oss.str()); \ 35 | abort(); \ 36 | } 37 | 38 | #else // JSON_USE_EXCEPTION 39 | 40 | #define JSON_ASSERT(condition) assert(condition) 41 | 42 | // The call to assert() will show the failure message in debug builds. In 43 | // release builds we abort, for a core-dump or debugger. 44 | #define JSON_FAIL_MESSAGE(message) \ 45 | { \ 46 | JSONCPP_OSTRINGSTREAM oss; \ 47 | oss << message; \ 48 | assert(false && oss.str().c_str()); \ 49 | abort(); \ 50 | } 51 | 52 | #endif 53 | 54 | #define JSON_ASSERT_MESSAGE(condition, message) \ 55 | if (!(condition)) { \ 56 | JSON_FAIL_MESSAGE(message); \ 57 | } 58 | 59 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED 60 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/autolink.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_AUTOLINK_H_INCLUDED 7 | #define JSON_AUTOLINK_H_INCLUDED 8 | 9 | #include "config.h" 10 | 11 | #ifdef JSON_IN_CPPTL 12 | #include 13 | #endif 14 | 15 | #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ 16 | !defined(JSON_IN_CPPTL) 17 | #define CPPTL_AUTOLINK_NAME "json" 18 | #undef CPPTL_AUTOLINK_DLL 19 | #ifdef JSON_DLL 20 | #define CPPTL_AUTOLINK_DLL 21 | #endif 22 | #include "autolink.h" 23 | #endif 24 | 25 | #endif // JSON_AUTOLINK_H_INCLUDED 26 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/config.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_CONFIG_H_INCLUDED 7 | #define JSON_CONFIG_H_INCLUDED 8 | #include 9 | #include //typedef int64_t, uint64_t 10 | #include //typedef String 11 | 12 | /// If defined, indicates that json library is embedded in CppTL library. 13 | //# define JSON_IN_CPPTL 1 14 | 15 | /// If defined, indicates that json may leverage CppTL library 16 | //# define JSON_USE_CPPTL 1 17 | /// If defined, indicates that cpptl vector based map should be used instead of 18 | /// std::map 19 | /// as Value container. 20 | //# define JSON_USE_CPPTL_SMALLMAP 1 21 | 22 | // If non-zero, the library uses exceptions to report bad input instead of C 23 | // assertion macros. The default is to use exceptions. 24 | #ifndef JSON_USE_EXCEPTION 25 | #define JSON_USE_EXCEPTION 1 26 | #endif 27 | 28 | /// If defined, indicates that the source file is amalgamated 29 | /// to prevent private header inclusion. 30 | /// Remarks: it is automatically defined in the generated amalgamated header. 31 | // #define JSON_IS_AMALGAMATION 32 | 33 | #ifdef JSON_IN_CPPTL 34 | #include 35 | #ifndef JSON_USE_CPPTL 36 | #define JSON_USE_CPPTL 1 37 | #endif 38 | #endif 39 | 40 | #ifdef JSON_IN_CPPTL 41 | #define JSON_API CPPTL_API 42 | #elif defined(JSON_DLL_BUILD) 43 | #if defined(_MSC_VER) || defined(__MINGW32__) 44 | #define JSON_API __declspec(dllexport) 45 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 46 | #endif // if defined(_MSC_VER) 47 | #elif defined(JSON_DLL) 48 | #if defined(_MSC_VER) || defined(__MINGW32__) 49 | #define JSON_API __declspec(dllimport) 50 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 51 | #endif // if defined(_MSC_VER) 52 | #endif // ifdef JSON_IN_CPPTL 53 | #if !defined(JSON_API) 54 | #define JSON_API 55 | #endif 56 | 57 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for 58 | // integer 59 | // Storages, and 64 bits integer support is disabled. 60 | // #define JSON_NO_INT64 1 61 | 62 | #if defined(_MSC_VER) // MSVC 63 | #if _MSC_VER <= 1200 // MSVC 6 64 | // Microsoft Visual Studio 6 only support conversion from __int64 to double 65 | // (no conversion from unsigned __int64). 66 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 67 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' 68 | // characters in the debug information) 69 | // All projects I've ever seen with VS6 were using this globally (not bothering 70 | // with pragma push/pop). 71 | #pragma warning(disable : 4786) 72 | #endif // MSVC 6 73 | 74 | #if _MSC_VER >= 1500 // MSVC 2008 75 | /// Indicates that the following function is deprecated. 76 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) 77 | #endif 78 | 79 | #endif // defined(_MSC_VER) 80 | 81 | // In c++11 the override keyword allows you to explicitly define that a function 82 | // is intended to override the base-class version. This makes the code more 83 | // manageable and fixes a set of common hard-to-find bugs. 84 | #if __cplusplus >= 201103L 85 | #define JSONCPP_OVERRIDE override 86 | #define JSONCPP_NOEXCEPT noexcept 87 | #define JSONCPP_OP_EXPLICIT explicit 88 | #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 89 | #define JSONCPP_OVERRIDE override 90 | #define JSONCPP_NOEXCEPT throw() 91 | #if _MSC_VER >= 1800 // MSVC 2013 92 | #define JSONCPP_OP_EXPLICIT explicit 93 | #else 94 | #define JSONCPP_OP_EXPLICIT 95 | #endif 96 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 97 | #define JSONCPP_OVERRIDE override 98 | #define JSONCPP_NOEXCEPT noexcept 99 | #define JSONCPP_OP_EXPLICIT explicit 100 | #else 101 | #define JSONCPP_OVERRIDE 102 | #define JSONCPP_NOEXCEPT throw() 103 | #define JSONCPP_OP_EXPLICIT 104 | #endif 105 | 106 | #ifndef JSON_HAS_RVALUE_REFERENCES 107 | 108 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 109 | #define JSON_HAS_RVALUE_REFERENCES 1 110 | #endif // MSVC >= 2010 111 | 112 | #ifdef __clang__ 113 | #if __has_feature(cxx_rvalue_references) 114 | #define JSON_HAS_RVALUE_REFERENCES 1 115 | #endif // has_feature 116 | 117 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 118 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) 119 | #define JSON_HAS_RVALUE_REFERENCES 1 120 | #endif // GXX_EXPERIMENTAL 121 | 122 | #endif // __clang__ || __GNUC__ 123 | 124 | #endif // not defined JSON_HAS_RVALUE_REFERENCES 125 | 126 | #ifndef JSON_HAS_RVALUE_REFERENCES 127 | #define JSON_HAS_RVALUE_REFERENCES 0 128 | #endif 129 | 130 | #ifdef __clang__ 131 | #if __has_extension(attribute_deprecated_with_message) 132 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 133 | #endif 134 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 135 | #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) 136 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 137 | #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 138 | #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) 139 | #endif // GNUC version 140 | #endif // __clang__ || __GNUC__ 141 | 142 | #if !defined(JSONCPP_DEPRECATED) 143 | #define JSONCPP_DEPRECATED(message) 144 | #endif // if !defined(JSONCPP_DEPRECATED) 145 | 146 | #if __GNUC__ >= 6 147 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 148 | #endif 149 | 150 | #if !defined(JSON_IS_AMALGAMATION) 151 | 152 | #include "version.h" 153 | 154 | #if JSONCPP_USING_SECURE_MEMORY 155 | #include "allocator.h" //typedef Allocator 156 | #endif 157 | 158 | #endif // if !defined(JSON_IS_AMALGAMATION) 159 | 160 | namespace Json { 161 | typedef int Int; 162 | typedef unsigned int UInt; 163 | #if defined(JSON_NO_INT64) 164 | typedef int LargestInt; 165 | typedef unsigned int LargestUInt; 166 | #undef JSON_HAS_INT64 167 | #else // if defined(JSON_NO_INT64) 168 | // For Microsoft Visual use specific types as long long is not supported 169 | #if defined(_MSC_VER) // Microsoft Visual Studio 170 | typedef __int64 Int64; 171 | typedef unsigned __int64 UInt64; 172 | #else // if defined(_MSC_VER) // Other platforms, use long long 173 | typedef int64_t Int64; 174 | typedef uint64_t UInt64; 175 | #endif // if defined(_MSC_VER) 176 | typedef Int64 LargestInt; 177 | typedef UInt64 LargestUInt; 178 | #define JSON_HAS_INT64 179 | #endif // if defined(JSON_NO_INT64) 180 | #if JSONCPP_USING_SECURE_MEMORY 181 | #define JSONCPP_STRING \ 182 | std::basic_string, Json::SecureAllocator > 183 | #define JSONCPP_OSTRINGSTREAM \ 184 | std::basic_ostringstream, \ 185 | Json::SecureAllocator > 186 | #define JSONCPP_OSTREAM std::basic_ostream > 187 | #define JSONCPP_ISTRINGSTREAM \ 188 | std::basic_istringstream, \ 189 | Json::SecureAllocator > 190 | #define JSONCPP_ISTREAM std::istream 191 | #else 192 | #define JSONCPP_STRING std::string 193 | #define JSONCPP_OSTRINGSTREAM std::ostringstream 194 | #define JSONCPP_OSTREAM std::ostream 195 | #define JSONCPP_ISTRINGSTREAM std::istringstream 196 | #define JSONCPP_ISTREAM std::istream 197 | #endif // if JSONCPP_USING_SECURE_MEMORY 198 | } // end namespace Json 199 | 200 | #endif // JSON_CONFIG_H_INCLUDED 201 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/features.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 7 | #define CPPTL_JSON_FEATURES_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "forwards.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | #pragma pack(push, 8) 14 | 15 | namespace Json { 16 | 17 | /** \brief Configuration passed to reader and writer. 18 | * This configuration object can be used to force the Reader or Writer 19 | * to behave in a standard conforming way. 20 | */ 21 | class JSON_API Features { 22 | public: 23 | /** \brief A configuration that allows all features and assumes all strings 24 | * are UTF-8. 25 | * - C & C++ comments are allowed 26 | * - Root object can be any JSON value 27 | * - Assumes Value strings are encoded in UTF-8 28 | */ 29 | static Features all(); 30 | 31 | /** \brief A configuration that is strictly compatible with the JSON 32 | * specification. 33 | * - Comments are forbidden. 34 | * - Root object must be either an array or an object value. 35 | * - Assumes Value strings are encoded in UTF-8 36 | */ 37 | static Features strictMode(); 38 | 39 | /** \brief Initialize the configuration like JsonConfig::allFeatures; 40 | */ 41 | Features(); 42 | 43 | /// \c true if comments are allowed. Default: \c true. 44 | bool allowComments_; 45 | 46 | /// \c true if root must be either an array or an object value. Default: \c 47 | /// false. 48 | bool strictRoot_; 49 | 50 | /// \c true if dropped null placeholders are allowed. Default: \c false. 51 | bool allowDroppedNullPlaceholders_; 52 | 53 | /// \c true if numeric object key are allowed. Default: \c false. 54 | bool allowNumericKeys_; 55 | }; 56 | 57 | } // namespace Json 58 | 59 | #pragma pack(pop) 60 | 61 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED 62 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/forwards.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_FORWARDS_H_INCLUDED 7 | #define JSON_FORWARDS_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "config.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | namespace Json { 14 | 15 | // writer.h 16 | class FastWriter; 17 | class StyledWriter; 18 | 19 | // reader.h 20 | class Reader; 21 | 22 | // features.h 23 | class Features; 24 | 25 | // value.h 26 | typedef unsigned int ArrayIndex; 27 | class StaticString; 28 | class Path; 29 | class PathArgument; 30 | class Value; 31 | class ValueIteratorBase; 32 | class ValueIterator; 33 | class ValueConstIterator; 34 | 35 | } // namespace Json 36 | 37 | #endif // JSON_FORWARDS_H_INCLUDED 38 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/json.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_JSON_H_INCLUDED 7 | #define JSON_JSON_H_INCLUDED 8 | 9 | #include "autolink.h" 10 | #include "features.h" 11 | #include "reader.h" 12 | #include "value.h" 13 | #include "writer.h" 14 | 15 | #endif // JSON_JSON_H_INCLUDED 16 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/version.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | #define JSON_VERSION_H_INCLUDED 5 | 6 | #define JSONCPP_VERSION_STRING "1.8.4" 7 | #define JSONCPP_VERSION_MAJOR 1 8 | #define JSONCPP_VERSION_MINOR 8 9 | #define JSONCPP_VERSION_PATCH 4 10 | #define JSONCPP_VERSION_QUALIFIER 11 | #define JSONCPP_VERSION_HEXA \ 12 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ 13 | (JSONCPP_VERSION_PATCH << 8)) 14 | 15 | #ifdef JSONCPP_USING_SECURE_MEMORY 16 | #undef JSONCPP_USING_SECURE_MEMORY 17 | #endif 18 | #define JSONCPP_USING_SECURE_MEMORY 0 19 | // If non-zero, the library zeroes any memory that it has allocated before 20 | // it frees its memory. 21 | 22 | #endif // JSON_VERSION_H_INCLUDED 23 | -------------------------------------------------------------------------------- /export/libajsoncpp/include/json/writer.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_WRITER_H_INCLUDED 7 | #define JSON_WRITER_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "value.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | #include 13 | #include 14 | #include 15 | 16 | // Disable warning C4251: : needs to have dll-interface to 17 | // be used by... 18 | #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) && defined(_MSC_VER) 19 | #pragma warning(push) 20 | #pragma warning(disable : 4251) 21 | #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 22 | 23 | #pragma pack(push, 8) 24 | 25 | namespace Json { 26 | 27 | class Value; 28 | 29 | /** 30 | 31 | Usage: 32 | \code 33 | using namespace Json; 34 | void writeToStdout(StreamWriter::Factory const& factory, Value const& value) { 35 | std::unique_ptr const writer( 36 | factory.newStreamWriter()); 37 | writer->write(value, &std::cout); 38 | std::cout << std::endl; // add lf and flush 39 | } 40 | \endcode 41 | */ 42 | class JSON_API StreamWriter { 43 | protected: 44 | JSONCPP_OSTREAM* sout_; // not owned; will not delete 45 | public: 46 | StreamWriter(); 47 | virtual ~StreamWriter(); 48 | /** Write Value into document as configured in sub-class. 49 | Do not take ownership of sout, but maintain a reference during function. 50 | \pre sout != NULL 51 | \return zero on success (For now, we always return zero, so check the 52 | stream instead.) \throw std::exception possibly, depending on configuration 53 | */ 54 | virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0; 55 | 56 | /** \brief A simple abstract factory. 57 | */ 58 | class JSON_API Factory { 59 | public: 60 | virtual ~Factory(); 61 | /** \brief Allocate a CharReader via operator new(). 62 | * \throw std::exception if something goes wrong (e.g. invalid settings) 63 | */ 64 | virtual StreamWriter* newStreamWriter() const = 0; 65 | }; // Factory 66 | }; // StreamWriter 67 | 68 | /** \brief Write into stringstream, then return string, for convenience. 69 | * A StreamWriter will be created from the factory, used, and then deleted. 70 | */ 71 | JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, 72 | Value const& root); 73 | 74 | /** \brief Build a StreamWriter implementation. 75 | 76 | Usage: 77 | \code 78 | using namespace Json; 79 | Value value = ...; 80 | StreamWriterBuilder builder; 81 | builder["commentStyle"] = "None"; 82 | builder["indentation"] = " "; // or whatever you like 83 | std::unique_ptr writer( 84 | builder.newStreamWriter()); 85 | writer->write(value, &std::cout); 86 | std::cout << std::endl; // add lf and flush 87 | \endcode 88 | */ 89 | class JSON_API StreamWriterBuilder : public StreamWriter::Factory { 90 | public: 91 | // Note: We use a Json::Value so that we can add data-members to this class 92 | // without a major version bump. 93 | /** Configuration of this builder. 94 | Available settings (case-sensitive): 95 | - "commentStyle": "None" or "All" 96 | - "indentation": "". 97 | - Setting this to an empty string also omits newline characters. 98 | - "enableYAMLCompatibility": false or true 99 | - slightly change the whitespace around colons 100 | - "dropNullPlaceholders": false or true 101 | - Drop the "null" string from the writer's output for nullValues. 102 | Strictly speaking, this is not valid JSON. But when the output is being 103 | fed to a browser's JavaScript, it makes for smaller output and the 104 | browser can handle the output just fine. 105 | - "useSpecialFloats": false or true 106 | - If true, outputs non-finite floating point values in the following way: 107 | NaN values as "NaN", positive infinity as "Infinity", and negative 108 | infinity as "-Infinity". 109 | - "precision": int 110 | - Number of precision digits for formatting of real values. 111 | - "precisionType": "significant"(default) or "decimal" 112 | - Type of precision for formatting of real values. 113 | 114 | You can examine 'settings_` yourself 115 | to see the defaults. You can also write and read them just like any 116 | JSON Value. 117 | \sa setDefaults() 118 | */ 119 | Json::Value settings_; 120 | 121 | StreamWriterBuilder(); 122 | ~StreamWriterBuilder() JSONCPP_OVERRIDE; 123 | 124 | /** 125 | * \throw std::exception if something goes wrong (e.g. invalid settings) 126 | */ 127 | StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE; 128 | 129 | /** \return true if 'settings' are legal and consistent; 130 | * otherwise, indicate bad settings via 'invalid'. 131 | */ 132 | bool validate(Json::Value* invalid) const; 133 | /** A simple way to update a specific setting. 134 | */ 135 | Value& operator[](JSONCPP_STRING key); 136 | 137 | /** Called by ctor, but you can use this to reset settings_. 138 | * \pre 'settings' != NULL (but Json::null is fine) 139 | * \remark Defaults: 140 | * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults 141 | */ 142 | static void setDefaults(Json::Value* settings); 143 | }; 144 | 145 | /** \brief Abstract class for writers. 146 | * \deprecated Use StreamWriter. (And really, this is an implementation detail.) 147 | */ 148 | class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer { 149 | public: 150 | virtual ~Writer(); 151 | 152 | virtual JSONCPP_STRING write(const Value& root) = 0; 153 | }; 154 | 155 | /** \brief Outputs a Value in JSON format 156 | *without formatting (not human friendly). 157 | * 158 | * The JSON document is written in a single line. It is not intended for 'human' 159 | *consumption, 160 | * but may be useful to support feature such as RPC where bandwidth is limited. 161 | * \sa Reader, Value 162 | * \deprecated Use StreamWriterBuilder. 163 | */ 164 | #if defined(_MSC_VER) 165 | #pragma warning(push) 166 | #pragma warning(disable : 4996) // Deriving from deprecated class 167 | #endif 168 | class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter 169 | : public Writer { 170 | public: 171 | FastWriter(); 172 | ~FastWriter() JSONCPP_OVERRIDE {} 173 | 174 | void enableYAMLCompatibility(); 175 | 176 | /** \brief Drop the "null" string from the writer's output for nullValues. 177 | * Strictly speaking, this is not valid JSON. But when the output is being 178 | * fed to a browser's JavaScript, it makes for smaller output and the 179 | * browser can handle the output just fine. 180 | */ 181 | void dropNullPlaceholders(); 182 | 183 | void omitEndingLineFeed(); 184 | 185 | public: // overridden from Writer 186 | JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE; 187 | 188 | private: 189 | void writeValue(const Value& value); 190 | 191 | JSONCPP_STRING document_; 192 | bool yamlCompatibilityEnabled_; 193 | bool dropNullPlaceholders_; 194 | bool omitEndingLineFeed_; 195 | }; 196 | #if defined(_MSC_VER) 197 | #pragma warning(pop) 198 | #endif 199 | 200 | /** \brief Writes a Value in JSON format in a 201 | *human friendly way. 202 | * 203 | * The rules for line break and indent are as follow: 204 | * - Object value: 205 | * - if empty then print {} without indent and line break 206 | * - if not empty the print '{', line break & indent, print one value per 207 | *line 208 | * and then unindent and line break and print '}'. 209 | * - Array value: 210 | * - if empty then print [] without indent and line break 211 | * - if the array contains no object value, empty array or some other value 212 | *types, 213 | * and all the values fit on one lines, then print the array on a single 214 | *line. 215 | * - otherwise, it the values do not fit on one line, or the array contains 216 | * object or non empty array, then print one value per line. 217 | * 218 | * If the Value have comments then they are outputed according to their 219 | *#CommentPlacement. 220 | * 221 | * \sa Reader, Value, Value::setComment() 222 | * \deprecated Use StreamWriterBuilder. 223 | */ 224 | #if defined(_MSC_VER) 225 | #pragma warning(push) 226 | #pragma warning(disable : 4996) // Deriving from deprecated class 227 | #endif 228 | class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API 229 | StyledWriter : public Writer { 230 | public: 231 | StyledWriter(); 232 | ~StyledWriter() JSONCPP_OVERRIDE {} 233 | 234 | public: // overridden from Writer 235 | /** \brief Serialize a Value in JSON format. 236 | * \param root Value to serialize. 237 | * \return String containing the JSON document that represents the root value. 238 | */ 239 | JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE; 240 | 241 | private: 242 | void writeValue(const Value& value); 243 | void writeArrayValue(const Value& value); 244 | bool isMultilineArray(const Value& value); 245 | void pushValue(const JSONCPP_STRING& value); 246 | void writeIndent(); 247 | void writeWithIndent(const JSONCPP_STRING& value); 248 | void indent(); 249 | void unindent(); 250 | void writeCommentBeforeValue(const Value& root); 251 | void writeCommentAfterValueOnSameLine(const Value& root); 252 | static bool hasCommentForValue(const Value& value); 253 | static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text); 254 | 255 | typedef std::vector ChildValues; 256 | 257 | ChildValues childValues_; 258 | JSONCPP_STRING document_; 259 | JSONCPP_STRING indentString_; 260 | unsigned int rightMargin_; 261 | unsigned int indentSize_; 262 | bool addChildValues_; 263 | }; 264 | #if defined(_MSC_VER) 265 | #pragma warning(pop) 266 | #endif 267 | 268 | /** \brief Writes a Value in JSON format in a 269 | human friendly way, 270 | to a stream rather than to a string. 271 | * 272 | * The rules for line break and indent are as follow: 273 | * - Object value: 274 | * - if empty then print {} without indent and line break 275 | * - if not empty the print '{', line break & indent, print one value per 276 | line 277 | * and then unindent and line break and print '}'. 278 | * - Array value: 279 | * - if empty then print [] without indent and line break 280 | * - if the array contains no object value, empty array or some other value 281 | types, 282 | * and all the values fit on one lines, then print the array on a single 283 | line. 284 | * - otherwise, it the values do not fit on one line, or the array contains 285 | * object or non empty array, then print one value per line. 286 | * 287 | * If the Value have comments then they are outputed according to their 288 | #CommentPlacement. 289 | * 290 | * \sa Reader, Value, Value::setComment() 291 | * \deprecated Use StreamWriterBuilder. 292 | */ 293 | #if defined(_MSC_VER) 294 | #pragma warning(push) 295 | #pragma warning(disable : 4996) // Deriving from deprecated class 296 | #endif 297 | class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API 298 | StyledStreamWriter { 299 | public: 300 | /** 301 | * \param indentation Each level will be indented by this amount extra. 302 | */ 303 | StyledStreamWriter(const JSONCPP_STRING& indentation = "\t"); 304 | ~StyledStreamWriter() {} 305 | 306 | public: 307 | /** \brief Serialize a Value in JSON format. 308 | * \param out Stream to write to. (Can be ostringstream, e.g.) 309 | * \param root Value to serialize. 310 | * \note There is no point in deriving from Writer, since write() should not 311 | * return a value. 312 | */ 313 | void write(JSONCPP_OSTREAM& out, const Value& root); 314 | 315 | private: 316 | void writeValue(const Value& value); 317 | void writeArrayValue(const Value& value); 318 | bool isMultilineArray(const Value& value); 319 | void pushValue(const JSONCPP_STRING& value); 320 | void writeIndent(); 321 | void writeWithIndent(const JSONCPP_STRING& value); 322 | void indent(); 323 | void unindent(); 324 | void writeCommentBeforeValue(const Value& root); 325 | void writeCommentAfterValueOnSameLine(const Value& root); 326 | static bool hasCommentForValue(const Value& value); 327 | static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text); 328 | 329 | typedef std::vector ChildValues; 330 | 331 | ChildValues childValues_; 332 | JSONCPP_OSTREAM* document_; 333 | JSONCPP_STRING indentString_; 334 | unsigned int rightMargin_; 335 | JSONCPP_STRING indentation_; 336 | bool addChildValues_ : 1; 337 | bool indented_ : 1; 338 | }; 339 | #if defined(_MSC_VER) 340 | #pragma warning(pop) 341 | #endif 342 | 343 | #if defined(JSON_HAS_INT64) 344 | JSONCPP_STRING JSON_API valueToString(Int value); 345 | JSONCPP_STRING JSON_API valueToString(UInt value); 346 | #endif // if defined(JSON_HAS_INT64) 347 | JSONCPP_STRING JSON_API valueToString(LargestInt value); 348 | JSONCPP_STRING JSON_API valueToString(LargestUInt value); 349 | JSONCPP_STRING JSON_API 350 | valueToString(double value, 351 | unsigned int precision = Value::defaultRealPrecision, 352 | PrecisionType precisionType = PrecisionType::significantDigits); 353 | JSONCPP_STRING JSON_API valueToString(bool value); 354 | JSONCPP_STRING JSON_API valueToQuotedString(const char* value); 355 | 356 | /// \brief Output using the StyledStreamWriter. 357 | /// \see Json::operator>>() 358 | JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root); 359 | 360 | } // namespace Json 361 | 362 | #pragma pack(pop) 363 | 364 | #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 365 | #pragma warning(pop) 366 | #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 367 | 368 | #endif // JSON_WRITER_H_INCLUDED 369 | -------------------------------------------------------------------------------- /export/libajsoncpp/lib/arm64-v8a/libjsoncpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libajsoncpp/lib/arm64-v8a/libjsoncpp.a -------------------------------------------------------------------------------- /export/libajsoncpp/lib/armeabi-v7a/libjsoncpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libajsoncpp/lib/armeabi-v7a/libjsoncpp.a -------------------------------------------------------------------------------- /export/libajsoncpp/lib/x86/libjsoncpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libajsoncpp/lib/x86/libjsoncpp.a -------------------------------------------------------------------------------- /export/libajsoncpp/lib/x86_64/libjsoncpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libajsoncpp/lib/x86_64/libjsoncpp.a -------------------------------------------------------------------------------- /export/libsohello/include/sohello.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | 5 | #ifndef USECMAKEBUILDLIB_SOHELLO_H 6 | #define USECMAKEBUILDLIB_SOHELLO_H 7 | 8 | int sohello(int i ); 9 | 10 | #endif //USECMAKEBUILDLIB_SOHELLO_H 11 | -------------------------------------------------------------------------------- /export/libsohello/lib/arm64-v8a/libhello.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsohello/lib/arm64-v8a/libhello.so -------------------------------------------------------------------------------- /export/libsohello/lib/armeabi-v7a/libhello.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsohello/lib/armeabi-v7a/libhello.so -------------------------------------------------------------------------------- /export/libsohello/lib/x86/libhello.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsohello/lib/x86/libhello.so -------------------------------------------------------------------------------- /export/libsohello/lib/x86_64/libhello.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsohello/lib/x86_64/libhello.so -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/allocator.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED 7 | #define CPPTL_JSON_ALLOCATOR_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #pragma pack(push, 8) 13 | 14 | namespace Json { 15 | template class SecureAllocator { 16 | public: 17 | // Type definitions 18 | using value_type = T; 19 | using pointer = T*; 20 | using const_pointer = const T*; 21 | using reference = T&; 22 | using const_reference = const T&; 23 | using size_type = std::size_t; 24 | using difference_type = std::ptrdiff_t; 25 | 26 | /** 27 | * Allocate memory for N items using the standard allocator. 28 | */ 29 | pointer allocate(size_type n) { 30 | // allocate using "global operator new" 31 | return static_cast(::operator new(n * sizeof(T))); 32 | } 33 | 34 | /** 35 | * Release memory which was allocated for N items at pointer P. 36 | * 37 | * The memory block is filled with zeroes before being released. 38 | * The pointer argument is tagged as "volatile" to prevent the 39 | * compiler optimizing out this critical step. 40 | */ 41 | void deallocate(volatile pointer p, size_type n) { 42 | std::memset(p, 0, n * sizeof(T)); 43 | // free using "global operator delete" 44 | ::operator delete(p); 45 | } 46 | 47 | /** 48 | * Construct an item in-place at pointer P. 49 | */ 50 | template void construct(pointer p, Args&&... args) { 51 | // construct using "placement new" and "perfect forwarding" 52 | ::new (static_cast(p)) T(std::forward(args)...); 53 | } 54 | 55 | size_type max_size() const { return size_t(-1) / sizeof(T); } 56 | 57 | pointer address(reference x) const { return std::addressof(x); } 58 | 59 | const_pointer address(const_reference x) const { return std::addressof(x); } 60 | 61 | /** 62 | * Destroy an item in-place at pointer P. 63 | */ 64 | void destroy(pointer p) { 65 | // destroy using "explicit destructor" 66 | p->~T(); 67 | } 68 | 69 | // Boilerplate 70 | SecureAllocator() {} 71 | template SecureAllocator(const SecureAllocator&) {} 72 | template struct rebind { using other = SecureAllocator; }; 73 | }; 74 | 75 | template 76 | bool operator==(const SecureAllocator&, const SecureAllocator&) { 77 | return true; 78 | } 79 | 80 | template 81 | bool operator!=(const SecureAllocator&, const SecureAllocator&) { 82 | return false; 83 | } 84 | 85 | } // namespace Json 86 | 87 | #pragma pack(pop) 88 | 89 | #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED 90 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/assertions.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED 7 | #define CPPTL_JSON_ASSERTIONS_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #if !defined(JSON_IS_AMALGAMATION) 13 | #include "config.h" 14 | #endif // if !defined(JSON_IS_AMALGAMATION) 15 | 16 | /** It should not be possible for a maliciously designed file to 17 | * cause an abort() or seg-fault, so these macros are used only 18 | * for pre-condition violations and internal logic errors. 19 | */ 20 | #if JSON_USE_EXCEPTION 21 | 22 | // @todo <= add detail about condition in exception 23 | #define JSON_ASSERT(condition) \ 24 | { \ 25 | if (!(condition)) { \ 26 | Json::throwLogicError("assert json failed"); \ 27 | } \ 28 | } 29 | 30 | #define JSON_FAIL_MESSAGE(message) \ 31 | { \ 32 | JSONCPP_OSTRINGSTREAM oss; \ 33 | oss << message; \ 34 | Json::throwLogicError(oss.str()); \ 35 | abort(); \ 36 | } 37 | 38 | #else // JSON_USE_EXCEPTION 39 | 40 | #define JSON_ASSERT(condition) assert(condition) 41 | 42 | // The call to assert() will show the failure message in debug builds. In 43 | // release builds we abort, for a core-dump or debugger. 44 | #define JSON_FAIL_MESSAGE(message) \ 45 | { \ 46 | JSONCPP_OSTRINGSTREAM oss; \ 47 | oss << message; \ 48 | assert(false && oss.str().c_str()); \ 49 | abort(); \ 50 | } 51 | 52 | #endif 53 | 54 | #define JSON_ASSERT_MESSAGE(condition, message) \ 55 | if (!(condition)) { \ 56 | JSON_FAIL_MESSAGE(message); \ 57 | } 58 | 59 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED 60 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/autolink.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_AUTOLINK_H_INCLUDED 7 | #define JSON_AUTOLINK_H_INCLUDED 8 | 9 | #include "config.h" 10 | 11 | #ifdef JSON_IN_CPPTL 12 | #include 13 | #endif 14 | 15 | #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ 16 | !defined(JSON_IN_CPPTL) 17 | #define CPPTL_AUTOLINK_NAME "json" 18 | #undef CPPTL_AUTOLINK_DLL 19 | #ifdef JSON_DLL 20 | #define CPPTL_AUTOLINK_DLL 21 | #endif 22 | #include "autolink.h" 23 | #endif 24 | 25 | #endif // JSON_AUTOLINK_H_INCLUDED 26 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/config.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_CONFIG_H_INCLUDED 7 | #define JSON_CONFIG_H_INCLUDED 8 | #include 9 | #include //typedef int64_t, uint64_t 10 | #include //typedef String 11 | 12 | /// If defined, indicates that json library is embedded in CppTL library. 13 | //# define JSON_IN_CPPTL 1 14 | 15 | /// If defined, indicates that json may leverage CppTL library 16 | //# define JSON_USE_CPPTL 1 17 | /// If defined, indicates that cpptl vector based map should be used instead of 18 | /// std::map 19 | /// as Value container. 20 | //# define JSON_USE_CPPTL_SMALLMAP 1 21 | 22 | // If non-zero, the library uses exceptions to report bad input instead of C 23 | // assertion macros. The default is to use exceptions. 24 | #ifndef JSON_USE_EXCEPTION 25 | #define JSON_USE_EXCEPTION 1 26 | #endif 27 | 28 | /// If defined, indicates that the source file is amalgamated 29 | /// to prevent private header inclusion. 30 | /// Remarks: it is automatically defined in the generated amalgamated header. 31 | // #define JSON_IS_AMALGAMATION 32 | 33 | #ifdef JSON_IN_CPPTL 34 | #include 35 | #ifndef JSON_USE_CPPTL 36 | #define JSON_USE_CPPTL 1 37 | #endif 38 | #endif 39 | 40 | #ifdef JSON_IN_CPPTL 41 | #define JSON_API CPPTL_API 42 | #elif defined(JSON_DLL_BUILD) 43 | #if defined(_MSC_VER) || defined(__MINGW32__) 44 | #define JSON_API __declspec(dllexport) 45 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 46 | #endif // if defined(_MSC_VER) 47 | #elif defined(JSON_DLL) 48 | #if defined(_MSC_VER) || defined(__MINGW32__) 49 | #define JSON_API __declspec(dllimport) 50 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 51 | #endif // if defined(_MSC_VER) 52 | #endif // ifdef JSON_IN_CPPTL 53 | #if !defined(JSON_API) 54 | #define JSON_API 55 | #endif 56 | 57 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for 58 | // integer 59 | // Storages, and 64 bits integer support is disabled. 60 | // #define JSON_NO_INT64 1 61 | 62 | #if defined(_MSC_VER) // MSVC 63 | #if _MSC_VER <= 1200 // MSVC 6 64 | // Microsoft Visual Studio 6 only support conversion from __int64 to double 65 | // (no conversion from unsigned __int64). 66 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 67 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' 68 | // characters in the debug information) 69 | // All projects I've ever seen with VS6 were using this globally (not bothering 70 | // with pragma push/pop). 71 | #pragma warning(disable : 4786) 72 | #endif // MSVC 6 73 | 74 | #if _MSC_VER >= 1500 // MSVC 2008 75 | /// Indicates that the following function is deprecated. 76 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) 77 | #endif 78 | 79 | #endif // defined(_MSC_VER) 80 | 81 | // In c++11 the override keyword allows you to explicitly define that a function 82 | // is intended to override the base-class version. This makes the code more 83 | // manageable and fixes a set of common hard-to-find bugs. 84 | #if __cplusplus >= 201103L 85 | #define JSONCPP_OVERRIDE override 86 | #define JSONCPP_NOEXCEPT noexcept 87 | #define JSONCPP_OP_EXPLICIT explicit 88 | #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 89 | #define JSONCPP_OVERRIDE override 90 | #define JSONCPP_NOEXCEPT throw() 91 | #if _MSC_VER >= 1800 // MSVC 2013 92 | #define JSONCPP_OP_EXPLICIT explicit 93 | #else 94 | #define JSONCPP_OP_EXPLICIT 95 | #endif 96 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 97 | #define JSONCPP_OVERRIDE override 98 | #define JSONCPP_NOEXCEPT noexcept 99 | #define JSONCPP_OP_EXPLICIT explicit 100 | #else 101 | #define JSONCPP_OVERRIDE 102 | #define JSONCPP_NOEXCEPT throw() 103 | #define JSONCPP_OP_EXPLICIT 104 | #endif 105 | 106 | #ifndef JSON_HAS_RVALUE_REFERENCES 107 | 108 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 109 | #define JSON_HAS_RVALUE_REFERENCES 1 110 | #endif // MSVC >= 2010 111 | 112 | #ifdef __clang__ 113 | #if __has_feature(cxx_rvalue_references) 114 | #define JSON_HAS_RVALUE_REFERENCES 1 115 | #endif // has_feature 116 | 117 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 118 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) 119 | #define JSON_HAS_RVALUE_REFERENCES 1 120 | #endif // GXX_EXPERIMENTAL 121 | 122 | #endif // __clang__ || __GNUC__ 123 | 124 | #endif // not defined JSON_HAS_RVALUE_REFERENCES 125 | 126 | #ifndef JSON_HAS_RVALUE_REFERENCES 127 | #define JSON_HAS_RVALUE_REFERENCES 0 128 | #endif 129 | 130 | #ifdef __clang__ 131 | #if __has_extension(attribute_deprecated_with_message) 132 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 133 | #endif 134 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 135 | #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) 136 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 137 | #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 138 | #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) 139 | #endif // GNUC version 140 | #endif // __clang__ || __GNUC__ 141 | 142 | #if !defined(JSONCPP_DEPRECATED) 143 | #define JSONCPP_DEPRECATED(message) 144 | #endif // if !defined(JSONCPP_DEPRECATED) 145 | 146 | #if __GNUC__ >= 6 147 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 148 | #endif 149 | 150 | #if !defined(JSON_IS_AMALGAMATION) 151 | 152 | #include "version.h" 153 | 154 | #if JSONCPP_USING_SECURE_MEMORY 155 | #include "allocator.h" //typedef Allocator 156 | #endif 157 | 158 | #endif // if !defined(JSON_IS_AMALGAMATION) 159 | 160 | namespace Json { 161 | typedef int Int; 162 | typedef unsigned int UInt; 163 | #if defined(JSON_NO_INT64) 164 | typedef int LargestInt; 165 | typedef unsigned int LargestUInt; 166 | #undef JSON_HAS_INT64 167 | #else // if defined(JSON_NO_INT64) 168 | // For Microsoft Visual use specific types as long long is not supported 169 | #if defined(_MSC_VER) // Microsoft Visual Studio 170 | typedef __int64 Int64; 171 | typedef unsigned __int64 UInt64; 172 | #else // if defined(_MSC_VER) // Other platforms, use long long 173 | typedef int64_t Int64; 174 | typedef uint64_t UInt64; 175 | #endif // if defined(_MSC_VER) 176 | typedef Int64 LargestInt; 177 | typedef UInt64 LargestUInt; 178 | #define JSON_HAS_INT64 179 | #endif // if defined(JSON_NO_INT64) 180 | #if JSONCPP_USING_SECURE_MEMORY 181 | #define JSONCPP_STRING \ 182 | std::basic_string, Json::SecureAllocator > 183 | #define JSONCPP_OSTRINGSTREAM \ 184 | std::basic_ostringstream, \ 185 | Json::SecureAllocator > 186 | #define JSONCPP_OSTREAM std::basic_ostream > 187 | #define JSONCPP_ISTRINGSTREAM \ 188 | std::basic_istringstream, \ 189 | Json::SecureAllocator > 190 | #define JSONCPP_ISTREAM std::istream 191 | #else 192 | #define JSONCPP_STRING std::string 193 | #define JSONCPP_OSTRINGSTREAM std::ostringstream 194 | #define JSONCPP_OSTREAM std::ostream 195 | #define JSONCPP_ISTRINGSTREAM std::istringstream 196 | #define JSONCPP_ISTREAM std::istream 197 | #endif // if JSONCPP_USING_SECURE_MEMORY 198 | } // end namespace Json 199 | 200 | #endif // JSON_CONFIG_H_INCLUDED 201 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/features.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 7 | #define CPPTL_JSON_FEATURES_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "forwards.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | #pragma pack(push, 8) 14 | 15 | namespace Json { 16 | 17 | /** \brief Configuration passed to reader and writer. 18 | * This configuration object can be used to force the Reader or Writer 19 | * to behave in a standard conforming way. 20 | */ 21 | class JSON_API Features { 22 | public: 23 | /** \brief A configuration that allows all features and assumes all strings 24 | * are UTF-8. 25 | * - C & C++ comments are allowed 26 | * - Root object can be any JSON value 27 | * - Assumes Value strings are encoded in UTF-8 28 | */ 29 | static Features all(); 30 | 31 | /** \brief A configuration that is strictly compatible with the JSON 32 | * specification. 33 | * - Comments are forbidden. 34 | * - Root object must be either an array or an object value. 35 | * - Assumes Value strings are encoded in UTF-8 36 | */ 37 | static Features strictMode(); 38 | 39 | /** \brief Initialize the configuration like JsonConfig::allFeatures; 40 | */ 41 | Features(); 42 | 43 | /// \c true if comments are allowed. Default: \c true. 44 | bool allowComments_; 45 | 46 | /// \c true if root must be either an array or an object value. Default: \c 47 | /// false. 48 | bool strictRoot_; 49 | 50 | /// \c true if dropped null placeholders are allowed. Default: \c false. 51 | bool allowDroppedNullPlaceholders_; 52 | 53 | /// \c true if numeric object key are allowed. Default: \c false. 54 | bool allowNumericKeys_; 55 | }; 56 | 57 | } // namespace Json 58 | 59 | #pragma pack(pop) 60 | 61 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED 62 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/forwards.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_FORWARDS_H_INCLUDED 7 | #define JSON_FORWARDS_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "config.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | namespace Json { 14 | 15 | // writer.h 16 | class FastWriter; 17 | class StyledWriter; 18 | 19 | // reader.h 20 | class Reader; 21 | 22 | // features.h 23 | class Features; 24 | 25 | // value.h 26 | typedef unsigned int ArrayIndex; 27 | class StaticString; 28 | class Path; 29 | class PathArgument; 30 | class Value; 31 | class ValueIteratorBase; 32 | class ValueIterator; 33 | class ValueConstIterator; 34 | 35 | } // namespace Json 36 | 37 | #endif // JSON_FORWARDS_H_INCLUDED 38 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/json.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_JSON_H_INCLUDED 7 | #define JSON_JSON_H_INCLUDED 8 | 9 | #include "autolink.h" 10 | #include "features.h" 11 | #include "reader.h" 12 | #include "value.h" 13 | #include "writer.h" 14 | 15 | #endif // JSON_JSON_H_INCLUDED 16 | -------------------------------------------------------------------------------- /export/libsojsoncpp/include/json/version.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | #define JSON_VERSION_H_INCLUDED 5 | 6 | #define JSONCPP_VERSION_STRING "1.8.4" 7 | #define JSONCPP_VERSION_MAJOR 1 8 | #define JSONCPP_VERSION_MINOR 8 9 | #define JSONCPP_VERSION_PATCH 4 10 | #define JSONCPP_VERSION_QUALIFIER 11 | #define JSONCPP_VERSION_HEXA \ 12 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ 13 | (JSONCPP_VERSION_PATCH << 8)) 14 | 15 | #ifdef JSONCPP_USING_SECURE_MEMORY 16 | #undef JSONCPP_USING_SECURE_MEMORY 17 | #endif 18 | #define JSONCPP_USING_SECURE_MEMORY 0 19 | // If non-zero, the library zeroes any memory that it has allocated before 20 | // it frees its memory. 21 | 22 | #endif // JSON_VERSION_H_INCLUDED 23 | -------------------------------------------------------------------------------- /export/libsojsoncpp/lib/arm64-v8a/libjsoncpp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsojsoncpp/lib/arm64-v8a/libjsoncpp.so -------------------------------------------------------------------------------- /export/libsojsoncpp/lib/armeabi-v7a/libjsoncpp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsojsoncpp/lib/armeabi-v7a/libjsoncpp.so -------------------------------------------------------------------------------- /export/libsojsoncpp/lib/x86/libjsoncpp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsojsoncpp/lib/x86/libjsoncpp.so -------------------------------------------------------------------------------- /export/libsojsoncpp/lib/x86_64/libjsoncpp.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/export/libsojsoncpp/lib/x86_64/libjsoncpp.so -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilinxiong/UseCmakeBuildLib/a41dfb0858bd84678fcc522cdd383c6af0be922b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /libajsoncpp/.gitignore: -------------------------------------------------------------------------------- 1 | /.externalNativeBuild 2 | /build 3 | -------------------------------------------------------------------------------- /libajsoncpp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | minSdkVersion 15 7 | targetSdkVersion 27 8 | versionCode 1 9 | versionName "1.0" 10 | externalNativeBuild { 11 | cmake { 12 | targets "jsoncpp" 13 | } 14 | } 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | externalNativeBuild { 24 | cmake { 25 | path 'src/main/cpp/CMakeLists.txt' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(dir: 'libs', include: ['*.jar']) 32 | implementation 'com.android.support:appcompat-v7:27.1.1' 33 | } 34 | -------------------------------------------------------------------------------- /libajsoncpp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | set(lib_src_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 6 | 7 | set(lib_build_DIR $ENV{HOME}/tmp) 8 | 9 | file(MAKE_DIRECTORY ${lib_build_DIR}) 10 | 11 | add_subdirectory(${lib_src_DIR}/jsoncpp ${lib_build_DIR}/jsoncpp) 12 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | add_library( 6 | jsoncpp 7 | STATIC 8 | src/json_tool.h 9 | src/json_reader.cpp 10 | src/json_valueiterator.inl 11 | src/json_value.cpp 12 | src/json_writer.cpp 13 | src/version.h.in) 14 | 15 | set(export_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../export) 16 | 17 | set_target_properties( 18 | jsoncpp 19 | PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${export_dir}/libajsoncpp/lib/${ANDROID_ABI}") 20 | 21 | # 按文件挨个导出头文件 22 | #add_custom_command( 23 | # TARGET jsoncpp POST_BUILD 24 | 25 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/allocator.h" "${export_dir}/libajsoncpp/include/json/allocator.h" 26 | # 27 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/config.h" "${export_dir}/libajsoncpp/include/json/config.h" 28 | # 29 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/forwards.h" "${export_dir}/libajsoncpp/include/json/forwards.h" 30 | # 31 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/features.h" "${export_dir}/libajsoncpp/include/json/features.h" 32 | # 33 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/value.h" "${export_dir}/libajsoncpp/include/json/value.h" 34 | # 35 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/reader.h" "${export_dir}/libajsoncpp/include/json/reader.h" 36 | # 37 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/writer.h" "${export_dir}/libajsoncpp/include/json/writer.h" 38 | # 39 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/assertions.h" "${export_dir}/libajsoncpp/include/json/assertions.h" 40 | # 41 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/autolink.h" "${export_dir}/libajsoncpp/include/json/autolink.h" 42 | # 43 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/json.h" "${export_dir}/libajsoncpp/include/json/json.h" 44 | # 45 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/version.h" "${export_dir}/libajsoncpp/include/json/version.h" 46 | #) 47 | 48 | # 按文件夹导出 49 | add_custom_command( 50 | TARGET jsoncpp POST_BUILD 51 | # 将 ${CMAKE_CURRENT_SOURCE_DIR}/src/json 文件夹下的文件 导出到 ${export_dir}/libajsoncpp/include/json/ 文件夹内 52 | COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/src/json" "${export_dir}/libajsoncpp/include/json/" 53 | ) -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/allocator.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED 7 | #define CPPTL_JSON_ALLOCATOR_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #pragma pack(push, 8) 13 | 14 | namespace Json { 15 | template class SecureAllocator { 16 | public: 17 | // Type definitions 18 | using value_type = T; 19 | using pointer = T*; 20 | using const_pointer = const T*; 21 | using reference = T&; 22 | using const_reference = const T&; 23 | using size_type = std::size_t; 24 | using difference_type = std::ptrdiff_t; 25 | 26 | /** 27 | * Allocate memory for N items using the standard allocator. 28 | */ 29 | pointer allocate(size_type n) { 30 | // allocate using "global operator new" 31 | return static_cast(::operator new(n * sizeof(T))); 32 | } 33 | 34 | /** 35 | * Release memory which was allocated for N items at pointer P. 36 | * 37 | * The memory block is filled with zeroes before being released. 38 | * The pointer argument is tagged as "volatile" to prevent the 39 | * compiler optimizing out this critical step. 40 | */ 41 | void deallocate(volatile pointer p, size_type n) { 42 | std::memset(p, 0, n * sizeof(T)); 43 | // free using "global operator delete" 44 | ::operator delete(p); 45 | } 46 | 47 | /** 48 | * Construct an item in-place at pointer P. 49 | */ 50 | template void construct(pointer p, Args&&... args) { 51 | // construct using "placement new" and "perfect forwarding" 52 | ::new (static_cast(p)) T(std::forward(args)...); 53 | } 54 | 55 | size_type max_size() const { return size_t(-1) / sizeof(T); } 56 | 57 | pointer address(reference x) const { return std::addressof(x); } 58 | 59 | const_pointer address(const_reference x) const { return std::addressof(x); } 60 | 61 | /** 62 | * Destroy an item in-place at pointer P. 63 | */ 64 | void destroy(pointer p) { 65 | // destroy using "explicit destructor" 66 | p->~T(); 67 | } 68 | 69 | // Boilerplate 70 | SecureAllocator() {} 71 | template SecureAllocator(const SecureAllocator&) {} 72 | template struct rebind { using other = SecureAllocator; }; 73 | }; 74 | 75 | template 76 | bool operator==(const SecureAllocator&, const SecureAllocator&) { 77 | return true; 78 | } 79 | 80 | template 81 | bool operator!=(const SecureAllocator&, const SecureAllocator&) { 82 | return false; 83 | } 84 | 85 | } // namespace Json 86 | 87 | #pragma pack(pop) 88 | 89 | #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED 90 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/assertions.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED 7 | #define CPPTL_JSON_ASSERTIONS_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #if !defined(JSON_IS_AMALGAMATION) 13 | #include "config.h" 14 | #endif // if !defined(JSON_IS_AMALGAMATION) 15 | 16 | /** It should not be possible for a maliciously designed file to 17 | * cause an abort() or seg-fault, so these macros are used only 18 | * for pre-condition violations and internal logic errors. 19 | */ 20 | #if JSON_USE_EXCEPTION 21 | 22 | // @todo <= add detail about condition in exception 23 | #define JSON_ASSERT(condition) \ 24 | { \ 25 | if (!(condition)) { \ 26 | Json::throwLogicError("assert json failed"); \ 27 | } \ 28 | } 29 | 30 | #define JSON_FAIL_MESSAGE(message) \ 31 | { \ 32 | JSONCPP_OSTRINGSTREAM oss; \ 33 | oss << message; \ 34 | Json::throwLogicError(oss.str()); \ 35 | abort(); \ 36 | } 37 | 38 | #else // JSON_USE_EXCEPTION 39 | 40 | #define JSON_ASSERT(condition) assert(condition) 41 | 42 | // The call to assert() will show the failure message in debug builds. In 43 | // release builds we abort, for a core-dump or debugger. 44 | #define JSON_FAIL_MESSAGE(message) \ 45 | { \ 46 | JSONCPP_OSTRINGSTREAM oss; \ 47 | oss << message; \ 48 | assert(false && oss.str().c_str()); \ 49 | abort(); \ 50 | } 51 | 52 | #endif 53 | 54 | #define JSON_ASSERT_MESSAGE(condition, message) \ 55 | if (!(condition)) { \ 56 | JSON_FAIL_MESSAGE(message); \ 57 | } 58 | 59 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED 60 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/autolink.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_AUTOLINK_H_INCLUDED 7 | #define JSON_AUTOLINK_H_INCLUDED 8 | 9 | #include "config.h" 10 | 11 | #ifdef JSON_IN_CPPTL 12 | #include 13 | #endif 14 | 15 | #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ 16 | !defined(JSON_IN_CPPTL) 17 | #define CPPTL_AUTOLINK_NAME "json" 18 | #undef CPPTL_AUTOLINK_DLL 19 | #ifdef JSON_DLL 20 | #define CPPTL_AUTOLINK_DLL 21 | #endif 22 | #include "autolink.h" 23 | #endif 24 | 25 | #endif // JSON_AUTOLINK_H_INCLUDED 26 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/config.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_CONFIG_H_INCLUDED 7 | #define JSON_CONFIG_H_INCLUDED 8 | #include 9 | #include //typedef int64_t, uint64_t 10 | #include //typedef String 11 | 12 | /// If defined, indicates that json library is embedded in CppTL library. 13 | //# define JSON_IN_CPPTL 1 14 | 15 | /// If defined, indicates that json may leverage CppTL library 16 | //# define JSON_USE_CPPTL 1 17 | /// If defined, indicates that cpptl vector based map should be used instead of 18 | /// std::map 19 | /// as Value container. 20 | //# define JSON_USE_CPPTL_SMALLMAP 1 21 | 22 | // If non-zero, the library uses exceptions to report bad input instead of C 23 | // assertion macros. The default is to use exceptions. 24 | #ifndef JSON_USE_EXCEPTION 25 | #define JSON_USE_EXCEPTION 1 26 | #endif 27 | 28 | /// If defined, indicates that the source file is amalgamated 29 | /// to prevent private header inclusion. 30 | /// Remarks: it is automatically defined in the generated amalgamated header. 31 | // #define JSON_IS_AMALGAMATION 32 | 33 | #ifdef JSON_IN_CPPTL 34 | #include 35 | #ifndef JSON_USE_CPPTL 36 | #define JSON_USE_CPPTL 1 37 | #endif 38 | #endif 39 | 40 | #ifdef JSON_IN_CPPTL 41 | #define JSON_API CPPTL_API 42 | #elif defined(JSON_DLL_BUILD) 43 | #if defined(_MSC_VER) || defined(__MINGW32__) 44 | #define JSON_API __declspec(dllexport) 45 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 46 | #endif // if defined(_MSC_VER) 47 | #elif defined(JSON_DLL) 48 | #if defined(_MSC_VER) || defined(__MINGW32__) 49 | #define JSON_API __declspec(dllimport) 50 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 51 | #endif // if defined(_MSC_VER) 52 | #endif // ifdef JSON_IN_CPPTL 53 | #if !defined(JSON_API) 54 | #define JSON_API 55 | #endif 56 | 57 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for 58 | // integer 59 | // Storages, and 64 bits integer support is disabled. 60 | // #define JSON_NO_INT64 1 61 | 62 | #if defined(_MSC_VER) // MSVC 63 | #if _MSC_VER <= 1200 // MSVC 6 64 | // Microsoft Visual Studio 6 only support conversion from __int64 to double 65 | // (no conversion from unsigned __int64). 66 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 67 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' 68 | // characters in the debug information) 69 | // All projects I've ever seen with VS6 were using this globally (not bothering 70 | // with pragma push/pop). 71 | #pragma warning(disable : 4786) 72 | #endif // MSVC 6 73 | 74 | #if _MSC_VER >= 1500 // MSVC 2008 75 | /// Indicates that the following function is deprecated. 76 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) 77 | #endif 78 | 79 | #endif // defined(_MSC_VER) 80 | 81 | // In c++11 the override keyword allows you to explicitly define that a function 82 | // is intended to override the base-class version. This makes the code more 83 | // manageable and fixes a set of common hard-to-find bugs. 84 | #if __cplusplus >= 201103L 85 | #define JSONCPP_OVERRIDE override 86 | #define JSONCPP_NOEXCEPT noexcept 87 | #define JSONCPP_OP_EXPLICIT explicit 88 | #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 89 | #define JSONCPP_OVERRIDE override 90 | #define JSONCPP_NOEXCEPT throw() 91 | #if _MSC_VER >= 1800 // MSVC 2013 92 | #define JSONCPP_OP_EXPLICIT explicit 93 | #else 94 | #define JSONCPP_OP_EXPLICIT 95 | #endif 96 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 97 | #define JSONCPP_OVERRIDE override 98 | #define JSONCPP_NOEXCEPT noexcept 99 | #define JSONCPP_OP_EXPLICIT explicit 100 | #else 101 | #define JSONCPP_OVERRIDE 102 | #define JSONCPP_NOEXCEPT throw() 103 | #define JSONCPP_OP_EXPLICIT 104 | #endif 105 | 106 | #ifndef JSON_HAS_RVALUE_REFERENCES 107 | 108 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 109 | #define JSON_HAS_RVALUE_REFERENCES 1 110 | #endif // MSVC >= 2010 111 | 112 | #ifdef __clang__ 113 | #if __has_feature(cxx_rvalue_references) 114 | #define JSON_HAS_RVALUE_REFERENCES 1 115 | #endif // has_feature 116 | 117 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 118 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) 119 | #define JSON_HAS_RVALUE_REFERENCES 1 120 | #endif // GXX_EXPERIMENTAL 121 | 122 | #endif // __clang__ || __GNUC__ 123 | 124 | #endif // not defined JSON_HAS_RVALUE_REFERENCES 125 | 126 | #ifndef JSON_HAS_RVALUE_REFERENCES 127 | #define JSON_HAS_RVALUE_REFERENCES 0 128 | #endif 129 | 130 | #ifdef __clang__ 131 | #if __has_extension(attribute_deprecated_with_message) 132 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 133 | #endif 134 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 135 | #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) 136 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 137 | #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 138 | #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) 139 | #endif // GNUC version 140 | #endif // __clang__ || __GNUC__ 141 | 142 | #if !defined(JSONCPP_DEPRECATED) 143 | #define JSONCPP_DEPRECATED(message) 144 | #endif // if !defined(JSONCPP_DEPRECATED) 145 | 146 | #if __GNUC__ >= 6 147 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 148 | #endif 149 | 150 | #if !defined(JSON_IS_AMALGAMATION) 151 | 152 | #include "version.h" 153 | 154 | #if JSONCPP_USING_SECURE_MEMORY 155 | #include "allocator.h" //typedef Allocator 156 | #endif 157 | 158 | #endif // if !defined(JSON_IS_AMALGAMATION) 159 | 160 | namespace Json { 161 | typedef int Int; 162 | typedef unsigned int UInt; 163 | #if defined(JSON_NO_INT64) 164 | typedef int LargestInt; 165 | typedef unsigned int LargestUInt; 166 | #undef JSON_HAS_INT64 167 | #else // if defined(JSON_NO_INT64) 168 | // For Microsoft Visual use specific types as long long is not supported 169 | #if defined(_MSC_VER) // Microsoft Visual Studio 170 | typedef __int64 Int64; 171 | typedef unsigned __int64 UInt64; 172 | #else // if defined(_MSC_VER) // Other platforms, use long long 173 | typedef int64_t Int64; 174 | typedef uint64_t UInt64; 175 | #endif // if defined(_MSC_VER) 176 | typedef Int64 LargestInt; 177 | typedef UInt64 LargestUInt; 178 | #define JSON_HAS_INT64 179 | #endif // if defined(JSON_NO_INT64) 180 | #if JSONCPP_USING_SECURE_MEMORY 181 | #define JSONCPP_STRING \ 182 | std::basic_string, Json::SecureAllocator > 183 | #define JSONCPP_OSTRINGSTREAM \ 184 | std::basic_ostringstream, \ 185 | Json::SecureAllocator > 186 | #define JSONCPP_OSTREAM std::basic_ostream > 187 | #define JSONCPP_ISTRINGSTREAM \ 188 | std::basic_istringstream, \ 189 | Json::SecureAllocator > 190 | #define JSONCPP_ISTREAM std::istream 191 | #else 192 | #define JSONCPP_STRING std::string 193 | #define JSONCPP_OSTRINGSTREAM std::ostringstream 194 | #define JSONCPP_OSTREAM std::ostream 195 | #define JSONCPP_ISTRINGSTREAM std::istringstream 196 | #define JSONCPP_ISTREAM std::istream 197 | #endif // if JSONCPP_USING_SECURE_MEMORY 198 | } // end namespace Json 199 | 200 | #endif // JSON_CONFIG_H_INCLUDED 201 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/features.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 7 | #define CPPTL_JSON_FEATURES_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "forwards.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | #pragma pack(push, 8) 14 | 15 | namespace Json { 16 | 17 | /** \brief Configuration passed to reader and writer. 18 | * This configuration object can be used to force the Reader or Writer 19 | * to behave in a standard conforming way. 20 | */ 21 | class JSON_API Features { 22 | public: 23 | /** \brief A configuration that allows all features and assumes all strings 24 | * are UTF-8. 25 | * - C & C++ comments are allowed 26 | * - Root object can be any JSON value 27 | * - Assumes Value strings are encoded in UTF-8 28 | */ 29 | static Features all(); 30 | 31 | /** \brief A configuration that is strictly compatible with the JSON 32 | * specification. 33 | * - Comments are forbidden. 34 | * - Root object must be either an array or an object value. 35 | * - Assumes Value strings are encoded in UTF-8 36 | */ 37 | static Features strictMode(); 38 | 39 | /** \brief Initialize the configuration like JsonConfig::allFeatures; 40 | */ 41 | Features(); 42 | 43 | /// \c true if comments are allowed. Default: \c true. 44 | bool allowComments_; 45 | 46 | /// \c true if root must be either an array or an object value. Default: \c 47 | /// false. 48 | bool strictRoot_; 49 | 50 | /// \c true if dropped null placeholders are allowed. Default: \c false. 51 | bool allowDroppedNullPlaceholders_; 52 | 53 | /// \c true if numeric object key are allowed. Default: \c false. 54 | bool allowNumericKeys_; 55 | }; 56 | 57 | } // namespace Json 58 | 59 | #pragma pack(pop) 60 | 61 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED 62 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/forwards.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_FORWARDS_H_INCLUDED 7 | #define JSON_FORWARDS_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "config.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | namespace Json { 14 | 15 | // writer.h 16 | class FastWriter; 17 | class StyledWriter; 18 | 19 | // reader.h 20 | class Reader; 21 | 22 | // features.h 23 | class Features; 24 | 25 | // value.h 26 | typedef unsigned int ArrayIndex; 27 | class StaticString; 28 | class Path; 29 | class PathArgument; 30 | class Value; 31 | class ValueIteratorBase; 32 | class ValueIterator; 33 | class ValueConstIterator; 34 | 35 | } // namespace Json 36 | 37 | #endif // JSON_FORWARDS_H_INCLUDED 38 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/json.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_JSON_H_INCLUDED 7 | #define JSON_JSON_H_INCLUDED 8 | 9 | #include "autolink.h" 10 | #include "features.h" 11 | #include "reader.h" 12 | #include "value.h" 13 | #include "writer.h" 14 | 15 | #endif // JSON_JSON_H_INCLUDED 16 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json/version.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | #define JSON_VERSION_H_INCLUDED 5 | 6 | #define JSONCPP_VERSION_STRING "1.8.4" 7 | #define JSONCPP_VERSION_MAJOR 1 8 | #define JSONCPP_VERSION_MINOR 8 9 | #define JSONCPP_VERSION_PATCH 4 10 | #define JSONCPP_VERSION_QUALIFIER 11 | #define JSONCPP_VERSION_HEXA \ 12 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ 13 | (JSONCPP_VERSION_PATCH << 8)) 14 | 15 | #ifdef JSONCPP_USING_SECURE_MEMORY 16 | #undef JSONCPP_USING_SECURE_MEMORY 17 | #endif 18 | #define JSONCPP_USING_SECURE_MEMORY 0 19 | // If non-zero, the library zeroes any memory that it has allocated before 20 | // it frees its memory. 21 | 22 | #endif // JSON_VERSION_H_INCLUDED 23 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json_tool.h: -------------------------------------------------------------------------------- 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 | #ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED 7 | #define LIB_JSONCPP_JSON_TOOL_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "json/config.h" 11 | #endif 12 | 13 | // Also support old flag NO_LOCALE_SUPPORT 14 | #ifdef NO_LOCALE_SUPPORT 15 | #define JSONCPP_NO_LOCALE_SUPPORT 16 | #endif 17 | 18 | #ifndef JSONCPP_NO_LOCALE_SUPPORT 19 | #include 20 | #endif 21 | 22 | /* This header provides common string manipulation support, such as UTF-8, 23 | * portable conversion from/to string... 24 | * 25 | * It is an internal header that must not be exposed. 26 | */ 27 | 28 | namespace Json { 29 | static inline char getDecimalPoint() { 30 | #ifdef JSONCPP_NO_LOCALE_SUPPORT 31 | return '\0'; 32 | #else 33 | struct lconv* lc = localeconv(); 34 | return lc ? *(lc->decimal_point) : '\0'; 35 | #endif 36 | } 37 | 38 | /// Converts a unicode code-point to UTF-8. 39 | static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) { 40 | JSONCPP_STRING result; 41 | 42 | // based on description from http://en.wikipedia.org/wiki/UTF-8 43 | 44 | if (cp <= 0x7f) { 45 | result.resize(1); 46 | result[0] = static_cast(cp); 47 | } else if (cp <= 0x7FF) { 48 | result.resize(2); 49 | result[1] = static_cast(0x80 | (0x3f & cp)); 50 | result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); 51 | } else if (cp <= 0xFFFF) { 52 | result.resize(3); 53 | result[2] = static_cast(0x80 | (0x3f & cp)); 54 | result[1] = static_cast(0x80 | (0x3f & (cp >> 6))); 55 | result[0] = static_cast(0xE0 | (0xf & (cp >> 12))); 56 | } else if (cp <= 0x10FFFF) { 57 | result.resize(4); 58 | result[3] = static_cast(0x80 | (0x3f & cp)); 59 | result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); 60 | result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); 61 | result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); 62 | } 63 | 64 | return result; 65 | } 66 | 67 | enum { 68 | /// Constant that specify the size of the buffer that must be passed to 69 | /// uintToString. 70 | uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 71 | }; 72 | 73 | // Defines a char buffer for use with uintToString(). 74 | typedef char UIntToStringBuffer[uintToStringBufferSize]; 75 | 76 | /** Converts an unsigned integer to string. 77 | * @param value Unsigned integer to convert to string 78 | * @param current Input/Output string buffer. 79 | * Must have at least uintToStringBufferSize chars free. 80 | */ 81 | static inline void uintToString(LargestUInt value, char*& current) { 82 | *--current = 0; 83 | do { 84 | *--current = static_cast(value % 10U + static_cast('0')); 85 | value /= 10; 86 | } while (value != 0); 87 | } 88 | 89 | /** Change ',' to '.' everywhere in buffer. 90 | * 91 | * We had a sophisticated way, but it did not work in WinCE. 92 | * @see https://github.com/open-source-parsers/jsoncpp/pull/9 93 | */ 94 | template Iter fixNumericLocale(Iter begin, Iter end) { 95 | for (; begin != end; ++begin) { 96 | if (*begin == ',') { 97 | *begin = '.'; 98 | } 99 | } 100 | return begin; 101 | } 102 | 103 | template void fixNumericLocaleInput(Iter begin, Iter end) { 104 | char decimalPoint = getDecimalPoint(); 105 | if (decimalPoint == '\0' || decimalPoint == '.') { 106 | return; 107 | } 108 | for (; begin != end; ++begin) { 109 | if (*begin == '.') { 110 | *begin = decimalPoint; 111 | } 112 | } 113 | } 114 | 115 | /** 116 | * Return iterator that would be the new end of the range [begin,end), if we 117 | * were to delete zeros in the end of string, but not the last zero before '.'. 118 | */ 119 | template Iter fixZerosInTheEnd(Iter begin, Iter end) { 120 | for (; begin != end; --end) { 121 | if (*(end - 1) != '0') { 122 | return end; 123 | } 124 | // Don't delete the last zero before the decimal point. 125 | if (begin != (end - 1) && *(end - 2) == '.') { 126 | return end; 127 | } 128 | } 129 | return end; 130 | } 131 | 132 | } // namespace Json 133 | 134 | #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED 135 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/json_valueiterator.inl: -------------------------------------------------------------------------------- 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 | // included by json_value.cpp 7 | 8 | namespace Json { 9 | 10 | // ////////////////////////////////////////////////////////////////// 11 | // ////////////////////////////////////////////////////////////////// 12 | // ////////////////////////////////////////////////////////////////// 13 | // class ValueIteratorBase 14 | // ////////////////////////////////////////////////////////////////// 15 | // ////////////////////////////////////////////////////////////////// 16 | // ////////////////////////////////////////////////////////////////// 17 | 18 | ValueIteratorBase::ValueIteratorBase() 19 | : current_(), isNull_(true) { 20 | } 21 | 22 | ValueIteratorBase::ValueIteratorBase( 23 | const Value::ObjectValues::iterator& current) 24 | : current_(current), isNull_(false) {} 25 | 26 | Value& ValueIteratorBase::deref() const { 27 | return current_->second; 28 | } 29 | 30 | void ValueIteratorBase::increment() { 31 | ++current_; 32 | } 33 | 34 | void ValueIteratorBase::decrement() { 35 | --current_; 36 | } 37 | 38 | ValueIteratorBase::difference_type 39 | ValueIteratorBase::computeDistance(const SelfType& other) const { 40 | #ifdef JSON_USE_CPPTL_SMALLMAP 41 | return other.current_ - current_; 42 | #else 43 | // Iterator for null value are initialized using the default 44 | // constructor, which initialize current_ to the default 45 | // std::map::iterator. As begin() and end() are two instance 46 | // of the default std::map::iterator, they can not be compared. 47 | // To allow this, we handle this comparison specifically. 48 | if (isNull_ && other.isNull_) { 49 | return 0; 50 | } 51 | 52 | // Usage of std::distance is not portable (does not compile with Sun Studio 12 53 | // RogueWave STL, 54 | // which is the one used by default). 55 | // Using a portable hand-made version for non random iterator instead: 56 | // return difference_type( std::distance( current_, other.current_ ) ); 57 | difference_type myDistance = 0; 58 | for (Value::ObjectValues::iterator it = current_; it != other.current_; 59 | ++it) { 60 | ++myDistance; 61 | } 62 | return myDistance; 63 | #endif 64 | } 65 | 66 | bool ValueIteratorBase::isEqual(const SelfType& other) const { 67 | if (isNull_) { 68 | return other.isNull_; 69 | } 70 | return current_ == other.current_; 71 | } 72 | 73 | void ValueIteratorBase::copy(const SelfType& other) { 74 | current_ = other.current_; 75 | isNull_ = other.isNull_; 76 | } 77 | 78 | Value ValueIteratorBase::key() const { 79 | const Value::CZString czstring = (*current_).first; 80 | if (czstring.data()) { 81 | if (czstring.isStaticString()) 82 | return Value(StaticString(czstring.data())); 83 | return Value(czstring.data(), czstring.data() + czstring.length()); 84 | } 85 | return Value(czstring.index()); 86 | } 87 | 88 | UInt ValueIteratorBase::index() const { 89 | const Value::CZString czstring = (*current_).first; 90 | if (!czstring.data()) 91 | return czstring.index(); 92 | return Value::UInt(-1); 93 | } 94 | 95 | JSONCPP_STRING ValueIteratorBase::name() const { 96 | char const* keey; 97 | char const* end; 98 | keey = memberName(&end); 99 | if (!keey) return JSONCPP_STRING(); 100 | return JSONCPP_STRING(keey, end); 101 | } 102 | 103 | char const* ValueIteratorBase::memberName() const { 104 | const char* cname = (*current_).first.data(); 105 | return cname ? cname : ""; 106 | } 107 | 108 | char const* ValueIteratorBase::memberName(char const** end) const { 109 | const char* cname = (*current_).first.data(); 110 | if (!cname) { 111 | *end = NULL; 112 | return NULL; 113 | } 114 | *end = cname + (*current_).first.length(); 115 | return cname; 116 | } 117 | 118 | // ////////////////////////////////////////////////////////////////// 119 | // ////////////////////////////////////////////////////////////////// 120 | // ////////////////////////////////////////////////////////////////// 121 | // class ValueConstIterator 122 | // ////////////////////////////////////////////////////////////////// 123 | // ////////////////////////////////////////////////////////////////// 124 | // ////////////////////////////////////////////////////////////////// 125 | 126 | ValueConstIterator::ValueConstIterator() {} 127 | 128 | ValueConstIterator::ValueConstIterator( 129 | const Value::ObjectValues::iterator& current) 130 | : ValueIteratorBase(current) {} 131 | 132 | ValueConstIterator::ValueConstIterator(ValueIterator const& other) 133 | : ValueIteratorBase(other) {} 134 | 135 | ValueConstIterator& ValueConstIterator:: 136 | operator=(const ValueIteratorBase& other) { 137 | copy(other); 138 | return *this; 139 | } 140 | 141 | // ////////////////////////////////////////////////////////////////// 142 | // ////////////////////////////////////////////////////////////////// 143 | // ////////////////////////////////////////////////////////////////// 144 | // class ValueIterator 145 | // ////////////////////////////////////////////////////////////////// 146 | // ////////////////////////////////////////////////////////////////// 147 | // ////////////////////////////////////////////////////////////////// 148 | 149 | ValueIterator::ValueIterator() {} 150 | 151 | ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) 152 | : ValueIteratorBase(current) {} 153 | 154 | ValueIterator::ValueIterator(const ValueConstIterator& other) 155 | : ValueIteratorBase(other) { 156 | throwRuntimeError("ConstIterator to Iterator should never be allowed."); 157 | } 158 | 159 | ValueIterator::ValueIterator(const ValueIterator& other) 160 | : ValueIteratorBase(other) {} 161 | 162 | ValueIterator& ValueIterator::operator=(const SelfType& other) { 163 | copy(other); 164 | return *this; 165 | } 166 | 167 | } // namespace Json 168 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/cpp/jsoncpp/src/version.h.in: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | # define JSON_VERSION_H_INCLUDED 5 | 6 | # define JSONCPP_VERSION_STRING "@JSONCPP_VERSION@" 7 | # define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@ 8 | # define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@ 9 | # define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@ 10 | # define JSONCPP_VERSION_QUALIFIER 11 | # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) 12 | 13 | #ifdef JSONCPP_USING_SECURE_MEMORY 14 | #undef JSONCPP_USING_SECURE_MEMORY 15 | #endif 16 | #define JSONCPP_USING_SECURE_MEMORY @JSONCPP_USE_SECURE_MEMORY@ 17 | // If non-zero, the library zeroes any memory that it has allocated before 18 | // it frees its memory. 19 | 20 | #endif // JSON_VERSION_H_INCLUDED 21 | -------------------------------------------------------------------------------- /libajsoncpp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | libajsoncpp 3 | 4 | -------------------------------------------------------------------------------- /libasimple/.gitignore: -------------------------------------------------------------------------------- 1 | /.externalNativeBuild 2 | /build 3 | -------------------------------------------------------------------------------- /libasimple/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | minSdkVersion 15 7 | targetSdkVersion 27 8 | versionCode 1 9 | versionName "1.0" 10 | externalNativeBuild { 11 | cmake { 12 | // 任务名称 13 | targets "hello" 14 | } 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | externalNativeBuild { 24 | cmake { 25 | path 'src/main/cpp/CMakeLists.txt' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(dir: 'libs', include: ['*.jar']) 32 | implementation 'com.android.support:appcompat-v7:27.1.1' 33 | } 34 | -------------------------------------------------------------------------------- /libasimple/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /libasimple/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /libasimple/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | # 设置资源主目录 CMAKE_CURRENT_SOURCE_DIR 代表当前CmakeLists.txt 所在的目录 6 | set(lib_src_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 7 | 8 | # 设置Cmake编译后文件的存放的临时目录 9 | set(lib_build_DIR $ENV{HOME}/tmp) 10 | 11 | # 将生成的临时文件放在 lib_build_DIR 中 12 | file(MAKE_DIRECTORY ${lib_build_DIR}) 13 | 14 | # 添加子项目 15 | add_subdirectory(${lib_src_DIR}/hello ${lib_build_DIR}/hello) 16 | 17 | -------------------------------------------------------------------------------- /libasimple/src/main/cpp/hello/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | add_library( 6 | # 库名字 7 | hello 8 | # 库类型 9 | STATIC 10 | # 库中所包含的源文件 11 | src/ahello.cpp 12 | ) 13 | 14 | # 设置变量 15 | set(export_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../export) 16 | 17 | set_target_properties( 18 | # 库名字 19 | hello 20 | # 设置输出.a静态库的路径 21 | PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${export_dir}/libahello/lib/${ANDROID_ABI}") 22 | 23 | add_custom_command( 24 | # POST_BUILD 处 有三个值可选 25 | # 分别是: 26 | # PRE_BUILD:在 hello 运行其他规则前执行 27 | # PRE_LINK:在编译源文件之后但在 链接其他二进制文件 或 运行静态库的库管理器 或 归档工具 之前执行 28 | # POST_BUILD:最后执行 29 | TARGET hello POST_BUILD 30 | # 拷贝命令 将 ${CMAKE_CURRENT_SOURCE_DIR}/src/ahello.h 文件拷贝到 ${export_dir}/libahello/include/ 文件夹内 且名字和之前的相同 31 | COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/ahello.h" "${export_dir}/libahello/include/ahello.h" 32 | ) 33 | 34 | -------------------------------------------------------------------------------- /libasimple/src/main/cpp/hello/src/ahello.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include "ahello.h" 5 | 6 | int ahello(int i) 7 | { 8 | return i + 1; 9 | } 10 | -------------------------------------------------------------------------------- /libasimple/src/main/cpp/hello/src/ahello.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | 5 | #ifndef USECMAKEBUILDLIB_LIBAHELLO_H 6 | #define USECMAKEBUILDLIB_LIBAHELLO_H 7 | 8 | int ahello(int i); 9 | 10 | #endif //USECMAKEBUILDLIB_LIBAHELLO_H 11 | -------------------------------------------------------------------------------- /libasimple/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | libasimple 3 | 4 | -------------------------------------------------------------------------------- /libcode/.gitignore: -------------------------------------------------------------------------------- 1 | /.externalNativeBuild 2 | /build 3 | -------------------------------------------------------------------------------- /libcode/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | minSdkVersion 15 7 | targetSdkVersion 27 8 | versionCode 1 9 | versionName "1.0" 10 | externalNativeBuild { 11 | cmake { 12 | cppFlags "" 13 | } 14 | } 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | externalNativeBuild { 23 | cmake { 24 | path 'src/main/cpp/CMakeLists.txt' 25 | } 26 | } 27 | } 28 | 29 | dependencies { 30 | implementation fileTree(dir: 'libs', include: ['*.jar']) 31 | implementation 'com.android.support:appcompat-v7:27.1.1' 32 | } 33 | -------------------------------------------------------------------------------- /libcode/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /libcode/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | add_library( 4 | usecode_lib 5 | SHARED 6 | jsoncpp/json_tool.h 7 | jsoncpp/json_reader.cpp 8 | jsoncpp/json_valueiterator.inl 9 | jsoncpp/json_value.cpp 10 | jsoncpp/json_writer.cpp 11 | jsoncpp/version.h.in 12 | useCode.cpp 13 | ) 14 | 15 | 16 | target_link_libraries( 17 | usecode_lib 18 | android 19 | log 20 | ) -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/allocator.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED 7 | #define CPPTL_JSON_ALLOCATOR_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #pragma pack(push, 8) 13 | 14 | namespace Json { 15 | template class SecureAllocator { 16 | public: 17 | // Type definitions 18 | using value_type = T; 19 | using pointer = T*; 20 | using const_pointer = const T*; 21 | using reference = T&; 22 | using const_reference = const T&; 23 | using size_type = std::size_t; 24 | using difference_type = std::ptrdiff_t; 25 | 26 | /** 27 | * Allocate memory for N items using the standard allocator. 28 | */ 29 | pointer allocate(size_type n) { 30 | // allocate using "global operator new" 31 | return static_cast(::operator new(n * sizeof(T))); 32 | } 33 | 34 | /** 35 | * Release memory which was allocated for N items at pointer P. 36 | * 37 | * The memory block is filled with zeroes before being released. 38 | * The pointer argument is tagged as "volatile" to prevent the 39 | * compiler optimizing out this critical step. 40 | */ 41 | void deallocate(volatile pointer p, size_type n) { 42 | std::memset(p, 0, n * sizeof(T)); 43 | // free using "global operator delete" 44 | ::operator delete(p); 45 | } 46 | 47 | /** 48 | * Construct an item in-place at pointer P. 49 | */ 50 | template void construct(pointer p, Args&&... args) { 51 | // construct using "placement new" and "perfect forwarding" 52 | ::new (static_cast(p)) T(std::forward(args)...); 53 | } 54 | 55 | size_type max_size() const { return size_t(-1) / sizeof(T); } 56 | 57 | pointer address(reference x) const { return std::addressof(x); } 58 | 59 | const_pointer address(const_reference x) const { return std::addressof(x); } 60 | 61 | /** 62 | * Destroy an item in-place at pointer P. 63 | */ 64 | void destroy(pointer p) { 65 | // destroy using "explicit destructor" 66 | p->~T(); 67 | } 68 | 69 | // Boilerplate 70 | SecureAllocator() {} 71 | template SecureAllocator(const SecureAllocator&) {} 72 | template struct rebind { using other = SecureAllocator; }; 73 | }; 74 | 75 | template 76 | bool operator==(const SecureAllocator&, const SecureAllocator&) { 77 | return true; 78 | } 79 | 80 | template 81 | bool operator!=(const SecureAllocator&, const SecureAllocator&) { 82 | return false; 83 | } 84 | 85 | } // namespace Json 86 | 87 | #pragma pack(pop) 88 | 89 | #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED 90 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/assertions.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED 7 | #define CPPTL_JSON_ASSERTIONS_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #if !defined(JSON_IS_AMALGAMATION) 13 | #include "config.h" 14 | #endif // if !defined(JSON_IS_AMALGAMATION) 15 | 16 | /** It should not be possible for a maliciously designed file to 17 | * cause an abort() or seg-fault, so these macros are used only 18 | * for pre-condition violations and internal logic errors. 19 | */ 20 | #if JSON_USE_EXCEPTION 21 | 22 | // @todo <= add detail about condition in exception 23 | #define JSON_ASSERT(condition) \ 24 | { \ 25 | if (!(condition)) { \ 26 | Json::throwLogicError("assert json failed"); \ 27 | } \ 28 | } 29 | 30 | #define JSON_FAIL_MESSAGE(message) \ 31 | { \ 32 | JSONCPP_OSTRINGSTREAM oss; \ 33 | oss << message; \ 34 | Json::throwLogicError(oss.str()); \ 35 | abort(); \ 36 | } 37 | 38 | #else // JSON_USE_EXCEPTION 39 | 40 | #define JSON_ASSERT(condition) assert(condition) 41 | 42 | // The call to assert() will show the failure message in debug builds. In 43 | // release builds we abort, for a core-dump or debugger. 44 | #define JSON_FAIL_MESSAGE(message) \ 45 | { \ 46 | JSONCPP_OSTRINGSTREAM oss; \ 47 | oss << message; \ 48 | assert(false && oss.str().c_str()); \ 49 | abort(); \ 50 | } 51 | 52 | #endif 53 | 54 | #define JSON_ASSERT_MESSAGE(condition, message) \ 55 | if (!(condition)) { \ 56 | JSON_FAIL_MESSAGE(message); \ 57 | } 58 | 59 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED 60 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/autolink.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_AUTOLINK_H_INCLUDED 7 | #define JSON_AUTOLINK_H_INCLUDED 8 | 9 | #include "config.h" 10 | 11 | #ifdef JSON_IN_CPPTL 12 | #include 13 | #endif 14 | 15 | #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ 16 | !defined(JSON_IN_CPPTL) 17 | #define CPPTL_AUTOLINK_NAME "json" 18 | #undef CPPTL_AUTOLINK_DLL 19 | #ifdef JSON_DLL 20 | #define CPPTL_AUTOLINK_DLL 21 | #endif 22 | #include "autolink.h" 23 | #endif 24 | 25 | #endif // JSON_AUTOLINK_H_INCLUDED 26 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/config.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_CONFIG_H_INCLUDED 7 | #define JSON_CONFIG_H_INCLUDED 8 | #include 9 | #include //typedef int64_t, uint64_t 10 | #include //typedef String 11 | 12 | /// If defined, indicates that json library is embedded in CppTL library. 13 | //# define JSON_IN_CPPTL 1 14 | 15 | /// If defined, indicates that json may leverage CppTL library 16 | //# define JSON_USE_CPPTL 1 17 | /// If defined, indicates that cpptl vector based map should be used instead of 18 | /// std::map 19 | /// as Value container. 20 | //# define JSON_USE_CPPTL_SMALLMAP 1 21 | 22 | // If non-zero, the library uses exceptions to report bad input instead of C 23 | // assertion macros. The default is to use exceptions. 24 | #ifndef JSON_USE_EXCEPTION 25 | #define JSON_USE_EXCEPTION 1 26 | #endif 27 | 28 | /// If defined, indicates that the source file is amalgamated 29 | /// to prevent private header inclusion. 30 | /// Remarks: it is automatically defined in the generated amalgamated header. 31 | // #define JSON_IS_AMALGAMATION 32 | 33 | #ifdef JSON_IN_CPPTL 34 | #include 35 | #ifndef JSON_USE_CPPTL 36 | #define JSON_USE_CPPTL 1 37 | #endif 38 | #endif 39 | 40 | #ifdef JSON_IN_CPPTL 41 | #define JSON_API CPPTL_API 42 | #elif defined(JSON_DLL_BUILD) 43 | #if defined(_MSC_VER) || defined(__MINGW32__) 44 | #define JSON_API __declspec(dllexport) 45 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 46 | #endif // if defined(_MSC_VER) 47 | #elif defined(JSON_DLL) 48 | #if defined(_MSC_VER) || defined(__MINGW32__) 49 | #define JSON_API __declspec(dllimport) 50 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 51 | #endif // if defined(_MSC_VER) 52 | #endif // ifdef JSON_IN_CPPTL 53 | #if !defined(JSON_API) 54 | #define JSON_API 55 | #endif 56 | 57 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for 58 | // integer 59 | // Storages, and 64 bits integer support is disabled. 60 | // #define JSON_NO_INT64 1 61 | 62 | #if defined(_MSC_VER) // MSVC 63 | #if _MSC_VER <= 1200 // MSVC 6 64 | // Microsoft Visual Studio 6 only support conversion from __int64 to double 65 | // (no conversion from unsigned __int64). 66 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 67 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' 68 | // characters in the debug information) 69 | // All projects I've ever seen with VS6 were using this globally (not bothering 70 | // with pragma push/pop). 71 | #pragma warning(disable : 4786) 72 | #endif // MSVC 6 73 | 74 | #if _MSC_VER >= 1500 // MSVC 2008 75 | /// Indicates that the following function is deprecated. 76 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) 77 | #endif 78 | 79 | #endif // defined(_MSC_VER) 80 | 81 | // In c++11 the override keyword allows you to explicitly define that a function 82 | // is intended to override the base-class version. This makes the code more 83 | // manageable and fixes a set of common hard-to-find bugs. 84 | #if __cplusplus >= 201103L 85 | #define JSONCPP_OVERRIDE override 86 | #define JSONCPP_NOEXCEPT noexcept 87 | #define JSONCPP_OP_EXPLICIT explicit 88 | #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 89 | #define JSONCPP_OVERRIDE override 90 | #define JSONCPP_NOEXCEPT throw() 91 | #if _MSC_VER >= 1800 // MSVC 2013 92 | #define JSONCPP_OP_EXPLICIT explicit 93 | #else 94 | #define JSONCPP_OP_EXPLICIT 95 | #endif 96 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 97 | #define JSONCPP_OVERRIDE override 98 | #define JSONCPP_NOEXCEPT noexcept 99 | #define JSONCPP_OP_EXPLICIT explicit 100 | #else 101 | #define JSONCPP_OVERRIDE 102 | #define JSONCPP_NOEXCEPT throw() 103 | #define JSONCPP_OP_EXPLICIT 104 | #endif 105 | 106 | #ifndef JSON_HAS_RVALUE_REFERENCES 107 | 108 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 109 | #define JSON_HAS_RVALUE_REFERENCES 1 110 | #endif // MSVC >= 2010 111 | 112 | #ifdef __clang__ 113 | #if __has_feature(cxx_rvalue_references) 114 | #define JSON_HAS_RVALUE_REFERENCES 1 115 | #endif // has_feature 116 | 117 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 118 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) 119 | #define JSON_HAS_RVALUE_REFERENCES 1 120 | #endif // GXX_EXPERIMENTAL 121 | 122 | #endif // __clang__ || __GNUC__ 123 | 124 | #endif // not defined JSON_HAS_RVALUE_REFERENCES 125 | 126 | #ifndef JSON_HAS_RVALUE_REFERENCES 127 | #define JSON_HAS_RVALUE_REFERENCES 0 128 | #endif 129 | 130 | #ifdef __clang__ 131 | #if __has_extension(attribute_deprecated_with_message) 132 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 133 | #endif 134 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 135 | #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) 136 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 137 | #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 138 | #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) 139 | #endif // GNUC version 140 | #endif // __clang__ || __GNUC__ 141 | 142 | #if !defined(JSONCPP_DEPRECATED) 143 | #define JSONCPP_DEPRECATED(message) 144 | #endif // if !defined(JSONCPP_DEPRECATED) 145 | 146 | #if __GNUC__ >= 6 147 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 148 | #endif 149 | 150 | #if !defined(JSON_IS_AMALGAMATION) 151 | 152 | #include "version.h" 153 | 154 | #if JSONCPP_USING_SECURE_MEMORY 155 | #include "allocator.h" //typedef Allocator 156 | #endif 157 | 158 | #endif // if !defined(JSON_IS_AMALGAMATION) 159 | 160 | namespace Json { 161 | typedef int Int; 162 | typedef unsigned int UInt; 163 | #if defined(JSON_NO_INT64) 164 | typedef int LargestInt; 165 | typedef unsigned int LargestUInt; 166 | #undef JSON_HAS_INT64 167 | #else // if defined(JSON_NO_INT64) 168 | // For Microsoft Visual use specific types as long long is not supported 169 | #if defined(_MSC_VER) // Microsoft Visual Studio 170 | typedef __int64 Int64; 171 | typedef unsigned __int64 UInt64; 172 | #else // if defined(_MSC_VER) // Other platforms, use long long 173 | typedef int64_t Int64; 174 | typedef uint64_t UInt64; 175 | #endif // if defined(_MSC_VER) 176 | typedef Int64 LargestInt; 177 | typedef UInt64 LargestUInt; 178 | #define JSON_HAS_INT64 179 | #endif // if defined(JSON_NO_INT64) 180 | #if JSONCPP_USING_SECURE_MEMORY 181 | #define JSONCPP_STRING \ 182 | std::basic_string, Json::SecureAllocator > 183 | #define JSONCPP_OSTRINGSTREAM \ 184 | std::basic_ostringstream, \ 185 | Json::SecureAllocator > 186 | #define JSONCPP_OSTREAM std::basic_ostream > 187 | #define JSONCPP_ISTRINGSTREAM \ 188 | std::basic_istringstream, \ 189 | Json::SecureAllocator > 190 | #define JSONCPP_ISTREAM std::istream 191 | #else 192 | #define JSONCPP_STRING std::string 193 | #define JSONCPP_OSTRINGSTREAM std::ostringstream 194 | #define JSONCPP_OSTREAM std::ostream 195 | #define JSONCPP_ISTRINGSTREAM std::istringstream 196 | #define JSONCPP_ISTREAM std::istream 197 | #endif // if JSONCPP_USING_SECURE_MEMORY 198 | } // end namespace Json 199 | 200 | #endif // JSON_CONFIG_H_INCLUDED 201 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/features.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 7 | #define CPPTL_JSON_FEATURES_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "forwards.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | #pragma pack(push, 8) 14 | 15 | namespace Json { 16 | 17 | /** \brief Configuration passed to reader and writer. 18 | * This configuration object can be used to force the Reader or Writer 19 | * to behave in a standard conforming way. 20 | */ 21 | class JSON_API Features { 22 | public: 23 | /** \brief A configuration that allows all features and assumes all strings 24 | * are UTF-8. 25 | * - C & C++ comments are allowed 26 | * - Root object can be any JSON value 27 | * - Assumes Value strings are encoded in UTF-8 28 | */ 29 | static Features all(); 30 | 31 | /** \brief A configuration that is strictly compatible with the JSON 32 | * specification. 33 | * - Comments are forbidden. 34 | * - Root object must be either an array or an object value. 35 | * - Assumes Value strings are encoded in UTF-8 36 | */ 37 | static Features strictMode(); 38 | 39 | /** \brief Initialize the configuration like JsonConfig::allFeatures; 40 | */ 41 | Features(); 42 | 43 | /// \c true if comments are allowed. Default: \c true. 44 | bool allowComments_; 45 | 46 | /// \c true if root must be either an array or an object value. Default: \c 47 | /// false. 48 | bool strictRoot_; 49 | 50 | /// \c true if dropped null placeholders are allowed. Default: \c false. 51 | bool allowDroppedNullPlaceholders_; 52 | 53 | /// \c true if numeric object key are allowed. Default: \c false. 54 | bool allowNumericKeys_; 55 | }; 56 | 57 | } // namespace Json 58 | 59 | #pragma pack(pop) 60 | 61 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED 62 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/forwards.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_FORWARDS_H_INCLUDED 7 | #define JSON_FORWARDS_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "config.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | namespace Json { 14 | 15 | // writer.h 16 | class FastWriter; 17 | class StyledWriter; 18 | 19 | // reader.h 20 | class Reader; 21 | 22 | // features.h 23 | class Features; 24 | 25 | // value.h 26 | typedef unsigned int ArrayIndex; 27 | class StaticString; 28 | class Path; 29 | class PathArgument; 30 | class Value; 31 | class ValueIteratorBase; 32 | class ValueIterator; 33 | class ValueConstIterator; 34 | 35 | } // namespace Json 36 | 37 | #endif // JSON_FORWARDS_H_INCLUDED 38 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/json.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_JSON_H_INCLUDED 7 | #define JSON_JSON_H_INCLUDED 8 | 9 | #include "autolink.h" 10 | #include "features.h" 11 | #include "reader.h" 12 | #include "value.h" 13 | #include "writer.h" 14 | 15 | #endif // JSON_JSON_H_INCLUDED 16 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json/version.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | #define JSON_VERSION_H_INCLUDED 5 | 6 | #define JSONCPP_VERSION_STRING "1.8.4" 7 | #define JSONCPP_VERSION_MAJOR 1 8 | #define JSONCPP_VERSION_MINOR 8 9 | #define JSONCPP_VERSION_PATCH 4 10 | #define JSONCPP_VERSION_QUALIFIER 11 | #define JSONCPP_VERSION_HEXA \ 12 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ 13 | (JSONCPP_VERSION_PATCH << 8)) 14 | 15 | #ifdef JSONCPP_USING_SECURE_MEMORY 16 | #undef JSONCPP_USING_SECURE_MEMORY 17 | #endif 18 | #define JSONCPP_USING_SECURE_MEMORY 0 19 | // If non-zero, the library zeroes any memory that it has allocated before 20 | // it frees its memory. 21 | 22 | #endif // JSON_VERSION_H_INCLUDED 23 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json_tool.h: -------------------------------------------------------------------------------- 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 | #ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED 7 | #define LIB_JSONCPP_JSON_TOOL_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "json/config.h" 11 | #endif 12 | 13 | // Also support old flag NO_LOCALE_SUPPORT 14 | #ifdef NO_LOCALE_SUPPORT 15 | #define JSONCPP_NO_LOCALE_SUPPORT 16 | #endif 17 | 18 | #ifndef JSONCPP_NO_LOCALE_SUPPORT 19 | #include 20 | #endif 21 | 22 | /* This header provides common string manipulation support, such as UTF-8, 23 | * portable conversion from/to string... 24 | * 25 | * It is an internal header that must not be exposed. 26 | */ 27 | 28 | namespace Json { 29 | static inline char getDecimalPoint() { 30 | #ifdef JSONCPP_NO_LOCALE_SUPPORT 31 | return '\0'; 32 | #else 33 | struct lconv* lc = localeconv(); 34 | return lc ? *(lc->decimal_point) : '\0'; 35 | #endif 36 | } 37 | 38 | /// Converts a unicode code-point to UTF-8. 39 | static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) { 40 | JSONCPP_STRING result; 41 | 42 | // based on description from http://en.wikipedia.org/wiki/UTF-8 43 | 44 | if (cp <= 0x7f) { 45 | result.resize(1); 46 | result[0] = static_cast(cp); 47 | } else if (cp <= 0x7FF) { 48 | result.resize(2); 49 | result[1] = static_cast(0x80 | (0x3f & cp)); 50 | result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); 51 | } else if (cp <= 0xFFFF) { 52 | result.resize(3); 53 | result[2] = static_cast(0x80 | (0x3f & cp)); 54 | result[1] = static_cast(0x80 | (0x3f & (cp >> 6))); 55 | result[0] = static_cast(0xE0 | (0xf & (cp >> 12))); 56 | } else if (cp <= 0x10FFFF) { 57 | result.resize(4); 58 | result[3] = static_cast(0x80 | (0x3f & cp)); 59 | result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); 60 | result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); 61 | result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); 62 | } 63 | 64 | return result; 65 | } 66 | 67 | enum { 68 | /// Constant that specify the size of the buffer that must be passed to 69 | /// uintToString. 70 | uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 71 | }; 72 | 73 | // Defines a char buffer for use with uintToString(). 74 | typedef char UIntToStringBuffer[uintToStringBufferSize]; 75 | 76 | /** Converts an unsigned integer to string. 77 | * @param value Unsigned integer to convert to string 78 | * @param current Input/Output string buffer. 79 | * Must have at least uintToStringBufferSize chars free. 80 | */ 81 | static inline void uintToString(LargestUInt value, char*& current) { 82 | *--current = 0; 83 | do { 84 | *--current = static_cast(value % 10U + static_cast('0')); 85 | value /= 10; 86 | } while (value != 0); 87 | } 88 | 89 | /** Change ',' to '.' everywhere in buffer. 90 | * 91 | * We had a sophisticated way, but it did not work in WinCE. 92 | * @see https://github.com/open-source-parsers/jsoncpp/pull/9 93 | */ 94 | template Iter fixNumericLocale(Iter begin, Iter end) { 95 | for (; begin != end; ++begin) { 96 | if (*begin == ',') { 97 | *begin = '.'; 98 | } 99 | } 100 | return begin; 101 | } 102 | 103 | template void fixNumericLocaleInput(Iter begin, Iter end) { 104 | char decimalPoint = getDecimalPoint(); 105 | if (decimalPoint == '\0' || decimalPoint == '.') { 106 | return; 107 | } 108 | for (; begin != end; ++begin) { 109 | if (*begin == '.') { 110 | *begin = decimalPoint; 111 | } 112 | } 113 | } 114 | 115 | /** 116 | * Return iterator that would be the new end of the range [begin,end), if we 117 | * were to delete zeros in the end of string, but not the last zero before '.'. 118 | */ 119 | template Iter fixZerosInTheEnd(Iter begin, Iter end) { 120 | for (; begin != end; --end) { 121 | if (*(end - 1) != '0') { 122 | return end; 123 | } 124 | // Don't delete the last zero before the decimal point. 125 | if (begin != (end - 1) && *(end - 2) == '.') { 126 | return end; 127 | } 128 | } 129 | return end; 130 | } 131 | 132 | } // namespace Json 133 | 134 | #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED 135 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/json_valueiterator.inl: -------------------------------------------------------------------------------- 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 | // included by json_value.cpp 7 | 8 | namespace Json { 9 | 10 | // ////////////////////////////////////////////////////////////////// 11 | // ////////////////////////////////////////////////////////////////// 12 | // ////////////////////////////////////////////////////////////////// 13 | // class ValueIteratorBase 14 | // ////////////////////////////////////////////////////////////////// 15 | // ////////////////////////////////////////////////////////////////// 16 | // ////////////////////////////////////////////////////////////////// 17 | 18 | ValueIteratorBase::ValueIteratorBase() 19 | : current_(), isNull_(true) { 20 | } 21 | 22 | ValueIteratorBase::ValueIteratorBase( 23 | const Value::ObjectValues::iterator& current) 24 | : current_(current), isNull_(false) {} 25 | 26 | Value& ValueIteratorBase::deref() const { 27 | return current_->second; 28 | } 29 | 30 | void ValueIteratorBase::increment() { 31 | ++current_; 32 | } 33 | 34 | void ValueIteratorBase::decrement() { 35 | --current_; 36 | } 37 | 38 | ValueIteratorBase::difference_type 39 | ValueIteratorBase::computeDistance(const SelfType& other) const { 40 | #ifdef JSON_USE_CPPTL_SMALLMAP 41 | return other.current_ - current_; 42 | #else 43 | // Iterator for null value are initialized using the default 44 | // constructor, which initialize current_ to the default 45 | // std::map::iterator. As begin() and end() are two instance 46 | // of the default std::map::iterator, they can not be compared. 47 | // To allow this, we handle this comparison specifically. 48 | if (isNull_ && other.isNull_) { 49 | return 0; 50 | } 51 | 52 | // Usage of std::distance is not portable (does not compile with Sun Studio 12 53 | // RogueWave STL, 54 | // which is the one used by default). 55 | // Using a portable hand-made version for non random iterator instead: 56 | // return difference_type( std::distance( current_, other.current_ ) ); 57 | difference_type myDistance = 0; 58 | for (Value::ObjectValues::iterator it = current_; it != other.current_; 59 | ++it) { 60 | ++myDistance; 61 | } 62 | return myDistance; 63 | #endif 64 | } 65 | 66 | bool ValueIteratorBase::isEqual(const SelfType& other) const { 67 | if (isNull_) { 68 | return other.isNull_; 69 | } 70 | return current_ == other.current_; 71 | } 72 | 73 | void ValueIteratorBase::copy(const SelfType& other) { 74 | current_ = other.current_; 75 | isNull_ = other.isNull_; 76 | } 77 | 78 | Value ValueIteratorBase::key() const { 79 | const Value::CZString czstring = (*current_).first; 80 | if (czstring.data()) { 81 | if (czstring.isStaticString()) 82 | return Value(StaticString(czstring.data())); 83 | return Value(czstring.data(), czstring.data() + czstring.length()); 84 | } 85 | return Value(czstring.index()); 86 | } 87 | 88 | UInt ValueIteratorBase::index() const { 89 | const Value::CZString czstring = (*current_).first; 90 | if (!czstring.data()) 91 | return czstring.index(); 92 | return Value::UInt(-1); 93 | } 94 | 95 | JSONCPP_STRING ValueIteratorBase::name() const { 96 | char const* keey; 97 | char const* end; 98 | keey = memberName(&end); 99 | if (!keey) return JSONCPP_STRING(); 100 | return JSONCPP_STRING(keey, end); 101 | } 102 | 103 | char const* ValueIteratorBase::memberName() const { 104 | const char* cname = (*current_).first.data(); 105 | return cname ? cname : ""; 106 | } 107 | 108 | char const* ValueIteratorBase::memberName(char const** end) const { 109 | const char* cname = (*current_).first.data(); 110 | if (!cname) { 111 | *end = NULL; 112 | return NULL; 113 | } 114 | *end = cname + (*current_).first.length(); 115 | return cname; 116 | } 117 | 118 | // ////////////////////////////////////////////////////////////////// 119 | // ////////////////////////////////////////////////////////////////// 120 | // ////////////////////////////////////////////////////////////////// 121 | // class ValueConstIterator 122 | // ////////////////////////////////////////////////////////////////// 123 | // ////////////////////////////////////////////////////////////////// 124 | // ////////////////////////////////////////////////////////////////// 125 | 126 | ValueConstIterator::ValueConstIterator() {} 127 | 128 | ValueConstIterator::ValueConstIterator( 129 | const Value::ObjectValues::iterator& current) 130 | : ValueIteratorBase(current) {} 131 | 132 | ValueConstIterator::ValueConstIterator(ValueIterator const& other) 133 | : ValueIteratorBase(other) {} 134 | 135 | ValueConstIterator& ValueConstIterator:: 136 | operator=(const ValueIteratorBase& other) { 137 | copy(other); 138 | return *this; 139 | } 140 | 141 | // ////////////////////////////////////////////////////////////////// 142 | // ////////////////////////////////////////////////////////////////// 143 | // ////////////////////////////////////////////////////////////////// 144 | // class ValueIterator 145 | // ////////////////////////////////////////////////////////////////// 146 | // ////////////////////////////////////////////////////////////////// 147 | // ////////////////////////////////////////////////////////////////// 148 | 149 | ValueIterator::ValueIterator() {} 150 | 151 | ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) 152 | : ValueIteratorBase(current) {} 153 | 154 | ValueIterator::ValueIterator(const ValueConstIterator& other) 155 | : ValueIteratorBase(other) { 156 | throwRuntimeError("ConstIterator to Iterator should never be allowed."); 157 | } 158 | 159 | ValueIterator::ValueIterator(const ValueIterator& other) 160 | : ValueIteratorBase(other) {} 161 | 162 | ValueIterator& ValueIterator::operator=(const SelfType& other) { 163 | copy(other); 164 | return *this; 165 | } 166 | 167 | } // namespace Json 168 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/jsoncpp/version.h.in: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | # define JSON_VERSION_H_INCLUDED 5 | 6 | # define JSONCPP_VERSION_STRING "@JSONCPP_VERSION@" 7 | # define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@ 8 | # define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@ 9 | # define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@ 10 | # define JSONCPP_VERSION_QUALIFIER 11 | # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) 12 | 13 | #ifdef JSONCPP_USING_SECURE_MEMORY 14 | #undef JSONCPP_USING_SECURE_MEMORY 15 | #endif 16 | #define JSONCPP_USING_SECURE_MEMORY @JSONCPP_USE_SECURE_MEMORY@ 17 | // If non-zero, the library zeroes any memory that it has allocated before 18 | // it frees its memory. 19 | 20 | #endif // JSON_VERSION_H_INCLUDED 21 | -------------------------------------------------------------------------------- /libcode/src/main/cpp/useCode.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include 5 | #include "jsoncpp/json/json.h" 6 | #define XONGFUNC(name)Java_com_xong_libcode_jni_##name 7 | 8 | extern "C" JNIEXPORT 9 | jstring JNICALL 10 | XONGFUNC(NativeCode_outputJsonCode)(JNIEnv *env, jclass thiz, 11 | jstring jname, jstring jage, jstring jsex, jstring jtype) 12 | { 13 | Json::Value root; 14 | const char *name = env->GetStringUTFChars(jname, NULL); 15 | const char *age = env->GetStringUTFChars(jage, NULL); 16 | const char *sex = env->GetStringUTFChars(jsex, NULL); 17 | const char *type = env->GetStringUTFChars(jtype, NULL); 18 | root["name"] = name; 19 | root["age"] = age; 20 | root["sex"] = sex; 21 | root["type"] = type; 22 | return env->NewStringUTF(root.toStyledString().c_str()); 23 | } 24 | 25 | extern "C" JNIEXPORT 26 | jstring JNICALL 27 | XONGFUNC(NativeCode_parseJsonCode)(JNIEnv *env, jclass thiz, 28 | jstring jjson) 29 | { 30 | const char *json_str = env->GetStringUTFChars(jjson, NULL); 31 | std::string out_str; 32 | 33 | Json::CharReaderBuilder b; 34 | Json::CharReader *reader(b.newCharReader()); 35 | Json::Value root; 36 | JSONCPP_STRING errs; 37 | bool ok = reader->parse(json_str, json_str + std::strlen(json_str), &root, &errs); 38 | if (ok && errs.size() == 0) { 39 | std::string name = root["name"].asString(); 40 | std::string age = root["age"].asString(); 41 | std::string sex = root["sex"].asString(); 42 | std::string type = root["type"].asString(); 43 | out_str = "name: " + name + "\nage: " + age + "\nsex:" + sex + "\ntype: " + type + "\n"; 44 | } 45 | return env->NewStringUTF(out_str.c_str()); 46 | } 47 | -------------------------------------------------------------------------------- /libcode/src/main/java/com/xong/libcode/jni/NativeCode.java: -------------------------------------------------------------------------------- 1 | package com.xong.libcode.jni; 2 | 3 | /** 4 | * Create by xong on 2018/9/26 5 | */ 6 | public class NativeCode { 7 | 8 | static { 9 | System.loadLibrary("usecode_lib"); 10 | } 11 | 12 | public static native String outputJsonCode(String name, String age, String sex, String type); 13 | 14 | public static native String parseJsonCode(String json_str); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /libcode/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | libcode 3 | 4 | -------------------------------------------------------------------------------- /libsojsoncpp/.gitignore: -------------------------------------------------------------------------------- 1 | /.externalNativeBuild 2 | /build 3 | -------------------------------------------------------------------------------- /libsojsoncpp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | minSdkVersion 15 7 | targetSdkVersion 27 8 | versionCode 1 9 | versionName "1.0" 10 | externalNativeBuild { 11 | cmake { 12 | targets 'jsoncpp' 13 | } 14 | } 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | externalNativeBuild { 24 | cmake { 25 | path 'src/main/cpp/CMakeLists.txt' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(dir: 'libs', include: ['*.jar']) 32 | implementation 'com.android.support:appcompat-v7:27.1.1' 33 | } 34 | -------------------------------------------------------------------------------- /libsojsoncpp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | set(lib_src_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 6 | 7 | set(lib_build_DIR $ENV{HOME}/tmp) 8 | 9 | file(MAKE_DIRECTORY ${lib_build_DIR}) 10 | 11 | add_subdirectory(${lib_src_DIR}/jsoncpp ${lib_build_DIR}/jsoncpp) 12 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | add_library(jsoncpp SHARED 6 | src/json_tool.h 7 | src/json_reader.cpp 8 | src/json_valueiterator.inl 9 | src/json_value.cpp 10 | src/json_writer.cpp 11 | src/version.h.in) 12 | 13 | set(export_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../export) 14 | 15 | set_target_properties( 16 | jsoncpp 17 | PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${export_dir}/libsojsoncpp/lib/${ANDROID_ABI}") 18 | 19 | #add_custom_command( 20 | # TARGET jsoncpp POST_BUILD 21 | 22 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/allocator.h" "${export_dir}/libsojsoncpp/include/json/allocator.h" 23 | # 24 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/config.h" "${export_dir}/libsojsoncpp/include/json/config.h" 25 | # 26 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/forwards.h" "${export_dir}/libsojsoncpp/include/json/forwards.h" 27 | # 28 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/features.h" "${export_dir}/libsojsoncpp/include/json/features.h" 29 | # 30 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/value.h" "${export_dir}/libsojsoncpp/include/json/value.h" 31 | # 32 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/reader.h" "${export_dir}/libsojsoncpp/include/json/reader.h" 33 | # 34 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/writer.h" "${export_dir}/libsojsoncpp/include/json/writer.h" 35 | # 36 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/assertions.h" "${export_dir}/libsojsoncpp/include/json/assertions.h" 37 | # 38 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/autolink.h" "${export_dir}/libsojsoncpp/include/json/autolink.h" 39 | # 40 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/json.h" "${export_dir}/libsojsoncpp/include/json/json.h" 41 | # 42 | # COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/json/version.h" "${export_dir}/libsojsoncpp/include/json/version.h" 43 | 44 | # ) 45 | 46 | add_custom_command( 47 | TARGET jsoncpp POST_BUILD 48 | COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/src/json" "${export_dir}/libsojsoncpp/include/json/") -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/allocator.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED 7 | #define CPPTL_JSON_ALLOCATOR_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #pragma pack(push, 8) 13 | 14 | namespace Json { 15 | template class SecureAllocator { 16 | public: 17 | // Type definitions 18 | using value_type = T; 19 | using pointer = T*; 20 | using const_pointer = const T*; 21 | using reference = T&; 22 | using const_reference = const T&; 23 | using size_type = std::size_t; 24 | using difference_type = std::ptrdiff_t; 25 | 26 | /** 27 | * Allocate memory for N items using the standard allocator. 28 | */ 29 | pointer allocate(size_type n) { 30 | // allocate using "global operator new" 31 | return static_cast(::operator new(n * sizeof(T))); 32 | } 33 | 34 | /** 35 | * Release memory which was allocated for N items at pointer P. 36 | * 37 | * The memory block is filled with zeroes before being released. 38 | * The pointer argument is tagged as "volatile" to prevent the 39 | * compiler optimizing out this critical step. 40 | */ 41 | void deallocate(volatile pointer p, size_type n) { 42 | std::memset(p, 0, n * sizeof(T)); 43 | // free using "global operator delete" 44 | ::operator delete(p); 45 | } 46 | 47 | /** 48 | * Construct an item in-place at pointer P. 49 | */ 50 | template void construct(pointer p, Args&&... args) { 51 | // construct using "placement new" and "perfect forwarding" 52 | ::new (static_cast(p)) T(std::forward(args)...); 53 | } 54 | 55 | size_type max_size() const { return size_t(-1) / sizeof(T); } 56 | 57 | pointer address(reference x) const { return std::addressof(x); } 58 | 59 | const_pointer address(const_reference x) const { return std::addressof(x); } 60 | 61 | /** 62 | * Destroy an item in-place at pointer P. 63 | */ 64 | void destroy(pointer p) { 65 | // destroy using "explicit destructor" 66 | p->~T(); 67 | } 68 | 69 | // Boilerplate 70 | SecureAllocator() {} 71 | template SecureAllocator(const SecureAllocator&) {} 72 | template struct rebind { using other = SecureAllocator; }; 73 | }; 74 | 75 | template 76 | bool operator==(const SecureAllocator&, const SecureAllocator&) { 77 | return true; 78 | } 79 | 80 | template 81 | bool operator!=(const SecureAllocator&, const SecureAllocator&) { 82 | return false; 83 | } 84 | 85 | } // namespace Json 86 | 87 | #pragma pack(pop) 88 | 89 | #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED 90 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/assertions.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED 7 | #define CPPTL_JSON_ASSERTIONS_H_INCLUDED 8 | 9 | #include 10 | #include 11 | 12 | #if !defined(JSON_IS_AMALGAMATION) 13 | #include "config.h" 14 | #endif // if !defined(JSON_IS_AMALGAMATION) 15 | 16 | /** It should not be possible for a maliciously designed file to 17 | * cause an abort() or seg-fault, so these macros are used only 18 | * for pre-condition violations and internal logic errors. 19 | */ 20 | #if JSON_USE_EXCEPTION 21 | 22 | // @todo <= add detail about condition in exception 23 | #define JSON_ASSERT(condition) \ 24 | { \ 25 | if (!(condition)) { \ 26 | Json::throwLogicError("assert json failed"); \ 27 | } \ 28 | } 29 | 30 | #define JSON_FAIL_MESSAGE(message) \ 31 | { \ 32 | JSONCPP_OSTRINGSTREAM oss; \ 33 | oss << message; \ 34 | Json::throwLogicError(oss.str()); \ 35 | abort(); \ 36 | } 37 | 38 | #else // JSON_USE_EXCEPTION 39 | 40 | #define JSON_ASSERT(condition) assert(condition) 41 | 42 | // The call to assert() will show the failure message in debug builds. In 43 | // release builds we abort, for a core-dump or debugger. 44 | #define JSON_FAIL_MESSAGE(message) \ 45 | { \ 46 | JSONCPP_OSTRINGSTREAM oss; \ 47 | oss << message; \ 48 | assert(false && oss.str().c_str()); \ 49 | abort(); \ 50 | } 51 | 52 | #endif 53 | 54 | #define JSON_ASSERT_MESSAGE(condition, message) \ 55 | if (!(condition)) { \ 56 | JSON_FAIL_MESSAGE(message); \ 57 | } 58 | 59 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED 60 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/autolink.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_AUTOLINK_H_INCLUDED 7 | #define JSON_AUTOLINK_H_INCLUDED 8 | 9 | #include "config.h" 10 | 11 | #ifdef JSON_IN_CPPTL 12 | #include 13 | #endif 14 | 15 | #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \ 16 | !defined(JSON_IN_CPPTL) 17 | #define CPPTL_AUTOLINK_NAME "json" 18 | #undef CPPTL_AUTOLINK_DLL 19 | #ifdef JSON_DLL 20 | #define CPPTL_AUTOLINK_DLL 21 | #endif 22 | #include "autolink.h" 23 | #endif 24 | 25 | #endif // JSON_AUTOLINK_H_INCLUDED 26 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/config.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_CONFIG_H_INCLUDED 7 | #define JSON_CONFIG_H_INCLUDED 8 | #include 9 | #include //typedef int64_t, uint64_t 10 | #include //typedef String 11 | 12 | /// If defined, indicates that json library is embedded in CppTL library. 13 | //# define JSON_IN_CPPTL 1 14 | 15 | /// If defined, indicates that json may leverage CppTL library 16 | //# define JSON_USE_CPPTL 1 17 | /// If defined, indicates that cpptl vector based map should be used instead of 18 | /// std::map 19 | /// as Value container. 20 | //# define JSON_USE_CPPTL_SMALLMAP 1 21 | 22 | // If non-zero, the library uses exceptions to report bad input instead of C 23 | // assertion macros. The default is to use exceptions. 24 | #ifndef JSON_USE_EXCEPTION 25 | #define JSON_USE_EXCEPTION 1 26 | #endif 27 | 28 | /// If defined, indicates that the source file is amalgamated 29 | /// to prevent private header inclusion. 30 | /// Remarks: it is automatically defined in the generated amalgamated header. 31 | // #define JSON_IS_AMALGAMATION 32 | 33 | #ifdef JSON_IN_CPPTL 34 | #include 35 | #ifndef JSON_USE_CPPTL 36 | #define JSON_USE_CPPTL 1 37 | #endif 38 | #endif 39 | 40 | #ifdef JSON_IN_CPPTL 41 | #define JSON_API CPPTL_API 42 | #elif defined(JSON_DLL_BUILD) 43 | #if defined(_MSC_VER) || defined(__MINGW32__) 44 | #define JSON_API __declspec(dllexport) 45 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 46 | #endif // if defined(_MSC_VER) 47 | #elif defined(JSON_DLL) 48 | #if defined(_MSC_VER) || defined(__MINGW32__) 49 | #define JSON_API __declspec(dllimport) 50 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 51 | #endif // if defined(_MSC_VER) 52 | #endif // ifdef JSON_IN_CPPTL 53 | #if !defined(JSON_API) 54 | #define JSON_API 55 | #endif 56 | 57 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for 58 | // integer 59 | // Storages, and 64 bits integer support is disabled. 60 | // #define JSON_NO_INT64 1 61 | 62 | #if defined(_MSC_VER) // MSVC 63 | #if _MSC_VER <= 1200 // MSVC 6 64 | // Microsoft Visual Studio 6 only support conversion from __int64 to double 65 | // (no conversion from unsigned __int64). 66 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 67 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' 68 | // characters in the debug information) 69 | // All projects I've ever seen with VS6 were using this globally (not bothering 70 | // with pragma push/pop). 71 | #pragma warning(disable : 4786) 72 | #endif // MSVC 6 73 | 74 | #if _MSC_VER >= 1500 // MSVC 2008 75 | /// Indicates that the following function is deprecated. 76 | #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) 77 | #endif 78 | 79 | #endif // defined(_MSC_VER) 80 | 81 | // In c++11 the override keyword allows you to explicitly define that a function 82 | // is intended to override the base-class version. This makes the code more 83 | // manageable and fixes a set of common hard-to-find bugs. 84 | #if __cplusplus >= 201103L 85 | #define JSONCPP_OVERRIDE override 86 | #define JSONCPP_NOEXCEPT noexcept 87 | #define JSONCPP_OP_EXPLICIT explicit 88 | #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 89 | #define JSONCPP_OVERRIDE override 90 | #define JSONCPP_NOEXCEPT throw() 91 | #if _MSC_VER >= 1800 // MSVC 2013 92 | #define JSONCPP_OP_EXPLICIT explicit 93 | #else 94 | #define JSONCPP_OP_EXPLICIT 95 | #endif 96 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 97 | #define JSONCPP_OVERRIDE override 98 | #define JSONCPP_NOEXCEPT noexcept 99 | #define JSONCPP_OP_EXPLICIT explicit 100 | #else 101 | #define JSONCPP_OVERRIDE 102 | #define JSONCPP_NOEXCEPT throw() 103 | #define JSONCPP_OP_EXPLICIT 104 | #endif 105 | 106 | #ifndef JSON_HAS_RVALUE_REFERENCES 107 | 108 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 109 | #define JSON_HAS_RVALUE_REFERENCES 1 110 | #endif // MSVC >= 2010 111 | 112 | #ifdef __clang__ 113 | #if __has_feature(cxx_rvalue_references) 114 | #define JSON_HAS_RVALUE_REFERENCES 1 115 | #endif // has_feature 116 | 117 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 118 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) 119 | #define JSON_HAS_RVALUE_REFERENCES 1 120 | #endif // GXX_EXPERIMENTAL 121 | 122 | #endif // __clang__ || __GNUC__ 123 | 124 | #endif // not defined JSON_HAS_RVALUE_REFERENCES 125 | 126 | #ifndef JSON_HAS_RVALUE_REFERENCES 127 | #define JSON_HAS_RVALUE_REFERENCES 0 128 | #endif 129 | 130 | #ifdef __clang__ 131 | #if __has_extension(attribute_deprecated_with_message) 132 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 133 | #endif 134 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 135 | #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) 136 | #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message))) 137 | #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 138 | #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) 139 | #endif // GNUC version 140 | #endif // __clang__ || __GNUC__ 141 | 142 | #if !defined(JSONCPP_DEPRECATED) 143 | #define JSONCPP_DEPRECATED(message) 144 | #endif // if !defined(JSONCPP_DEPRECATED) 145 | 146 | #if __GNUC__ >= 6 147 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 148 | #endif 149 | 150 | #if !defined(JSON_IS_AMALGAMATION) 151 | 152 | #include "version.h" 153 | 154 | #if JSONCPP_USING_SECURE_MEMORY 155 | #include "allocator.h" //typedef Allocator 156 | #endif 157 | 158 | #endif // if !defined(JSON_IS_AMALGAMATION) 159 | 160 | namespace Json { 161 | typedef int Int; 162 | typedef unsigned int UInt; 163 | #if defined(JSON_NO_INT64) 164 | typedef int LargestInt; 165 | typedef unsigned int LargestUInt; 166 | #undef JSON_HAS_INT64 167 | #else // if defined(JSON_NO_INT64) 168 | // For Microsoft Visual use specific types as long long is not supported 169 | #if defined(_MSC_VER) // Microsoft Visual Studio 170 | typedef __int64 Int64; 171 | typedef unsigned __int64 UInt64; 172 | #else // if defined(_MSC_VER) // Other platforms, use long long 173 | typedef int64_t Int64; 174 | typedef uint64_t UInt64; 175 | #endif // if defined(_MSC_VER) 176 | typedef Int64 LargestInt; 177 | typedef UInt64 LargestUInt; 178 | #define JSON_HAS_INT64 179 | #endif // if defined(JSON_NO_INT64) 180 | #if JSONCPP_USING_SECURE_MEMORY 181 | #define JSONCPP_STRING \ 182 | std::basic_string, Json::SecureAllocator > 183 | #define JSONCPP_OSTRINGSTREAM \ 184 | std::basic_ostringstream, \ 185 | Json::SecureAllocator > 186 | #define JSONCPP_OSTREAM std::basic_ostream > 187 | #define JSONCPP_ISTRINGSTREAM \ 188 | std::basic_istringstream, \ 189 | Json::SecureAllocator > 190 | #define JSONCPP_ISTREAM std::istream 191 | #else 192 | #define JSONCPP_STRING std::string 193 | #define JSONCPP_OSTRINGSTREAM std::ostringstream 194 | #define JSONCPP_OSTREAM std::ostream 195 | #define JSONCPP_ISTRINGSTREAM std::istringstream 196 | #define JSONCPP_ISTREAM std::istream 197 | #endif // if JSONCPP_USING_SECURE_MEMORY 198 | } // end namespace Json 199 | 200 | #endif // JSON_CONFIG_H_INCLUDED 201 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/features.h: -------------------------------------------------------------------------------- 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 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 7 | #define CPPTL_JSON_FEATURES_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "forwards.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | #pragma pack(push, 8) 14 | 15 | namespace Json { 16 | 17 | /** \brief Configuration passed to reader and writer. 18 | * This configuration object can be used to force the Reader or Writer 19 | * to behave in a standard conforming way. 20 | */ 21 | class JSON_API Features { 22 | public: 23 | /** \brief A configuration that allows all features and assumes all strings 24 | * are UTF-8. 25 | * - C & C++ comments are allowed 26 | * - Root object can be any JSON value 27 | * - Assumes Value strings are encoded in UTF-8 28 | */ 29 | static Features all(); 30 | 31 | /** \brief A configuration that is strictly compatible with the JSON 32 | * specification. 33 | * - Comments are forbidden. 34 | * - Root object must be either an array or an object value. 35 | * - Assumes Value strings are encoded in UTF-8 36 | */ 37 | static Features strictMode(); 38 | 39 | /** \brief Initialize the configuration like JsonConfig::allFeatures; 40 | */ 41 | Features(); 42 | 43 | /// \c true if comments are allowed. Default: \c true. 44 | bool allowComments_; 45 | 46 | /// \c true if root must be either an array or an object value. Default: \c 47 | /// false. 48 | bool strictRoot_; 49 | 50 | /// \c true if dropped null placeholders are allowed. Default: \c false. 51 | bool allowDroppedNullPlaceholders_; 52 | 53 | /// \c true if numeric object key are allowed. Default: \c false. 54 | bool allowNumericKeys_; 55 | }; 56 | 57 | } // namespace Json 58 | 59 | #pragma pack(pop) 60 | 61 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED 62 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/forwards.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_FORWARDS_H_INCLUDED 7 | #define JSON_FORWARDS_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "config.h" 11 | #endif // if !defined(JSON_IS_AMALGAMATION) 12 | 13 | namespace Json { 14 | 15 | // writer.h 16 | class FastWriter; 17 | class StyledWriter; 18 | 19 | // reader.h 20 | class Reader; 21 | 22 | // features.h 23 | class Features; 24 | 25 | // value.h 26 | typedef unsigned int ArrayIndex; 27 | class StaticString; 28 | class Path; 29 | class PathArgument; 30 | class Value; 31 | class ValueIteratorBase; 32 | class ValueIterator; 33 | class ValueConstIterator; 34 | 35 | } // namespace Json 36 | 37 | #endif // JSON_FORWARDS_H_INCLUDED 38 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/json.h: -------------------------------------------------------------------------------- 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 | #ifndef JSON_JSON_H_INCLUDED 7 | #define JSON_JSON_H_INCLUDED 8 | 9 | #include "autolink.h" 10 | #include "features.h" 11 | #include "reader.h" 12 | #include "value.h" 13 | #include "writer.h" 14 | 15 | #endif // JSON_JSON_H_INCLUDED 16 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json/version.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | #define JSON_VERSION_H_INCLUDED 5 | 6 | #define JSONCPP_VERSION_STRING "1.8.4" 7 | #define JSONCPP_VERSION_MAJOR 1 8 | #define JSONCPP_VERSION_MINOR 8 9 | #define JSONCPP_VERSION_PATCH 4 10 | #define JSONCPP_VERSION_QUALIFIER 11 | #define JSONCPP_VERSION_HEXA \ 12 | ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ 13 | (JSONCPP_VERSION_PATCH << 8)) 14 | 15 | #ifdef JSONCPP_USING_SECURE_MEMORY 16 | #undef JSONCPP_USING_SECURE_MEMORY 17 | #endif 18 | #define JSONCPP_USING_SECURE_MEMORY 0 19 | // If non-zero, the library zeroes any memory that it has allocated before 20 | // it frees its memory. 21 | 22 | #endif // JSON_VERSION_H_INCLUDED 23 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json_tool.h: -------------------------------------------------------------------------------- 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 | #ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED 7 | #define LIB_JSONCPP_JSON_TOOL_H_INCLUDED 8 | 9 | #if !defined(JSON_IS_AMALGAMATION) 10 | #include "json/config.h" 11 | #endif 12 | 13 | // Also support old flag NO_LOCALE_SUPPORT 14 | #ifdef NO_LOCALE_SUPPORT 15 | #define JSONCPP_NO_LOCALE_SUPPORT 16 | #endif 17 | 18 | #ifndef JSONCPP_NO_LOCALE_SUPPORT 19 | #include 20 | #endif 21 | 22 | /* This header provides common string manipulation support, such as UTF-8, 23 | * portable conversion from/to string... 24 | * 25 | * It is an internal header that must not be exposed. 26 | */ 27 | 28 | namespace Json { 29 | static inline char getDecimalPoint() { 30 | #ifdef JSONCPP_NO_LOCALE_SUPPORT 31 | return '\0'; 32 | #else 33 | struct lconv* lc = localeconv(); 34 | return lc ? *(lc->decimal_point) : '\0'; 35 | #endif 36 | } 37 | 38 | /// Converts a unicode code-point to UTF-8. 39 | static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) { 40 | JSONCPP_STRING result; 41 | 42 | // based on description from http://en.wikipedia.org/wiki/UTF-8 43 | 44 | if (cp <= 0x7f) { 45 | result.resize(1); 46 | result[0] = static_cast(cp); 47 | } else if (cp <= 0x7FF) { 48 | result.resize(2); 49 | result[1] = static_cast(0x80 | (0x3f & cp)); 50 | result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); 51 | } else if (cp <= 0xFFFF) { 52 | result.resize(3); 53 | result[2] = static_cast(0x80 | (0x3f & cp)); 54 | result[1] = static_cast(0x80 | (0x3f & (cp >> 6))); 55 | result[0] = static_cast(0xE0 | (0xf & (cp >> 12))); 56 | } else if (cp <= 0x10FFFF) { 57 | result.resize(4); 58 | result[3] = static_cast(0x80 | (0x3f & cp)); 59 | result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); 60 | result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); 61 | result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); 62 | } 63 | 64 | return result; 65 | } 66 | 67 | enum { 68 | /// Constant that specify the size of the buffer that must be passed to 69 | /// uintToString. 70 | uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 71 | }; 72 | 73 | // Defines a char buffer for use with uintToString(). 74 | typedef char UIntToStringBuffer[uintToStringBufferSize]; 75 | 76 | /** Converts an unsigned integer to string. 77 | * @param value Unsigned integer to convert to string 78 | * @param current Input/Output string buffer. 79 | * Must have at least uintToStringBufferSize chars free. 80 | */ 81 | static inline void uintToString(LargestUInt value, char*& current) { 82 | *--current = 0; 83 | do { 84 | *--current = static_cast(value % 10U + static_cast('0')); 85 | value /= 10; 86 | } while (value != 0); 87 | } 88 | 89 | /** Change ',' to '.' everywhere in buffer. 90 | * 91 | * We had a sophisticated way, but it did not work in WinCE. 92 | * @see https://github.com/open-source-parsers/jsoncpp/pull/9 93 | */ 94 | template Iter fixNumericLocale(Iter begin, Iter end) { 95 | for (; begin != end; ++begin) { 96 | if (*begin == ',') { 97 | *begin = '.'; 98 | } 99 | } 100 | return begin; 101 | } 102 | 103 | template void fixNumericLocaleInput(Iter begin, Iter end) { 104 | char decimalPoint = getDecimalPoint(); 105 | if (decimalPoint == '\0' || decimalPoint == '.') { 106 | return; 107 | } 108 | for (; begin != end; ++begin) { 109 | if (*begin == '.') { 110 | *begin = decimalPoint; 111 | } 112 | } 113 | } 114 | 115 | /** 116 | * Return iterator that would be the new end of the range [begin,end), if we 117 | * were to delete zeros in the end of string, but not the last zero before '.'. 118 | */ 119 | template Iter fixZerosInTheEnd(Iter begin, Iter end) { 120 | for (; begin != end; --end) { 121 | if (*(end - 1) != '0') { 122 | return end; 123 | } 124 | // Don't delete the last zero before the decimal point. 125 | if (begin != (end - 1) && *(end - 2) == '.') { 126 | return end; 127 | } 128 | } 129 | return end; 130 | } 131 | 132 | } // namespace Json 133 | 134 | #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED 135 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/json_valueiterator.inl: -------------------------------------------------------------------------------- 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 | // included by json_value.cpp 7 | 8 | namespace Json { 9 | 10 | // ////////////////////////////////////////////////////////////////// 11 | // ////////////////////////////////////////////////////////////////// 12 | // ////////////////////////////////////////////////////////////////// 13 | // class ValueIteratorBase 14 | // ////////////////////////////////////////////////////////////////// 15 | // ////////////////////////////////////////////////////////////////// 16 | // ////////////////////////////////////////////////////////////////// 17 | 18 | ValueIteratorBase::ValueIteratorBase() 19 | : current_(), isNull_(true) { 20 | } 21 | 22 | ValueIteratorBase::ValueIteratorBase( 23 | const Value::ObjectValues::iterator& current) 24 | : current_(current), isNull_(false) {} 25 | 26 | Value& ValueIteratorBase::deref() const { 27 | return current_->second; 28 | } 29 | 30 | void ValueIteratorBase::increment() { 31 | ++current_; 32 | } 33 | 34 | void ValueIteratorBase::decrement() { 35 | --current_; 36 | } 37 | 38 | ValueIteratorBase::difference_type 39 | ValueIteratorBase::computeDistance(const SelfType& other) const { 40 | #ifdef JSON_USE_CPPTL_SMALLMAP 41 | return other.current_ - current_; 42 | #else 43 | // Iterator for null value are initialized using the default 44 | // constructor, which initialize current_ to the default 45 | // std::map::iterator. As begin() and end() are two instance 46 | // of the default std::map::iterator, they can not be compared. 47 | // To allow this, we handle this comparison specifically. 48 | if (isNull_ && other.isNull_) { 49 | return 0; 50 | } 51 | 52 | // Usage of std::distance is not portable (does not compile with Sun Studio 12 53 | // RogueWave STL, 54 | // which is the one used by default). 55 | // Using a portable hand-made version for non random iterator instead: 56 | // return difference_type( std::distance( current_, other.current_ ) ); 57 | difference_type myDistance = 0; 58 | for (Value::ObjectValues::iterator it = current_; it != other.current_; 59 | ++it) { 60 | ++myDistance; 61 | } 62 | return myDistance; 63 | #endif 64 | } 65 | 66 | bool ValueIteratorBase::isEqual(const SelfType& other) const { 67 | if (isNull_) { 68 | return other.isNull_; 69 | } 70 | return current_ == other.current_; 71 | } 72 | 73 | void ValueIteratorBase::copy(const SelfType& other) { 74 | current_ = other.current_; 75 | isNull_ = other.isNull_; 76 | } 77 | 78 | Value ValueIteratorBase::key() const { 79 | const Value::CZString czstring = (*current_).first; 80 | if (czstring.data()) { 81 | if (czstring.isStaticString()) 82 | return Value(StaticString(czstring.data())); 83 | return Value(czstring.data(), czstring.data() + czstring.length()); 84 | } 85 | return Value(czstring.index()); 86 | } 87 | 88 | UInt ValueIteratorBase::index() const { 89 | const Value::CZString czstring = (*current_).first; 90 | if (!czstring.data()) 91 | return czstring.index(); 92 | return Value::UInt(-1); 93 | } 94 | 95 | JSONCPP_STRING ValueIteratorBase::name() const { 96 | char const* keey; 97 | char const* end; 98 | keey = memberName(&end); 99 | if (!keey) return JSONCPP_STRING(); 100 | return JSONCPP_STRING(keey, end); 101 | } 102 | 103 | char const* ValueIteratorBase::memberName() const { 104 | const char* cname = (*current_).first.data(); 105 | return cname ? cname : ""; 106 | } 107 | 108 | char const* ValueIteratorBase::memberName(char const** end) const { 109 | const char* cname = (*current_).first.data(); 110 | if (!cname) { 111 | *end = NULL; 112 | return NULL; 113 | } 114 | *end = cname + (*current_).first.length(); 115 | return cname; 116 | } 117 | 118 | // ////////////////////////////////////////////////////////////////// 119 | // ////////////////////////////////////////////////////////////////// 120 | // ////////////////////////////////////////////////////////////////// 121 | // class ValueConstIterator 122 | // ////////////////////////////////////////////////////////////////// 123 | // ////////////////////////////////////////////////////////////////// 124 | // ////////////////////////////////////////////////////////////////// 125 | 126 | ValueConstIterator::ValueConstIterator() {} 127 | 128 | ValueConstIterator::ValueConstIterator( 129 | const Value::ObjectValues::iterator& current) 130 | : ValueIteratorBase(current) {} 131 | 132 | ValueConstIterator::ValueConstIterator(ValueIterator const& other) 133 | : ValueIteratorBase(other) {} 134 | 135 | ValueConstIterator& ValueConstIterator:: 136 | operator=(const ValueIteratorBase& other) { 137 | copy(other); 138 | return *this; 139 | } 140 | 141 | // ////////////////////////////////////////////////////////////////// 142 | // ////////////////////////////////////////////////////////////////// 143 | // ////////////////////////////////////////////////////////////////// 144 | // class ValueIterator 145 | // ////////////////////////////////////////////////////////////////// 146 | // ////////////////////////////////////////////////////////////////// 147 | // ////////////////////////////////////////////////////////////////// 148 | 149 | ValueIterator::ValueIterator() {} 150 | 151 | ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) 152 | : ValueIteratorBase(current) {} 153 | 154 | ValueIterator::ValueIterator(const ValueConstIterator& other) 155 | : ValueIteratorBase(other) { 156 | throwRuntimeError("ConstIterator to Iterator should never be allowed."); 157 | } 158 | 159 | ValueIterator::ValueIterator(const ValueIterator& other) 160 | : ValueIteratorBase(other) {} 161 | 162 | ValueIterator& ValueIterator::operator=(const SelfType& other) { 163 | copy(other); 164 | return *this; 165 | } 166 | 167 | } // namespace Json 168 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/cpp/jsoncpp/src/version.h.in: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file (and "version") is generated by CMake. 2 | // Run CMake configure step to update it. 3 | #ifndef JSON_VERSION_H_INCLUDED 4 | # define JSON_VERSION_H_INCLUDED 5 | 6 | # define JSONCPP_VERSION_STRING "@JSONCPP_VERSION@" 7 | # define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@ 8 | # define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@ 9 | # define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@ 10 | # define JSONCPP_VERSION_QUALIFIER 11 | # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) 12 | 13 | #ifdef JSONCPP_USING_SECURE_MEMORY 14 | #undef JSONCPP_USING_SECURE_MEMORY 15 | #endif 16 | #define JSONCPP_USING_SECURE_MEMORY @JSONCPP_USE_SECURE_MEMORY@ 17 | // If non-zero, the library zeroes any memory that it has allocated before 18 | // it frees its memory. 19 | 20 | #endif // JSON_VERSION_H_INCLUDED 21 | -------------------------------------------------------------------------------- /libsojsoncpp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | libsojsoncpp 3 | 4 | -------------------------------------------------------------------------------- /libsosimple/.gitignore: -------------------------------------------------------------------------------- 1 | /.externalNativeBuild 2 | /build 3 | -------------------------------------------------------------------------------- /libsosimple/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | minSdkVersion 15 7 | targetSdkVersion 27 8 | versionCode 1 9 | versionName "1.0" 10 | externalNativeBuild { 11 | cmake { 12 | targets 'hello' 13 | } 14 | } 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | externalNativeBuild { 24 | cmake { 25 | path 'src/main/cpp/CMakeLists.txt' 26 | } 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(dir: 'libs', include: ['*.jar']) 32 | implementation 'com.android.support:appcompat-v7:27.1.1' 33 | } 34 | -------------------------------------------------------------------------------- /libsosimple/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /libsosimple/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /libsosimple/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | set(lib_src_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 6 | 7 | set(lib_build_DIR $ENV{HOME}/tmp) 8 | 9 | file(MAKE_DIRECTORY ${lib_build_DIR}) 10 | 11 | add_subdirectory(${lib_src_DIR}/hello ${lib_build_DIR}/hello) 12 | 13 | -------------------------------------------------------------------------------- /libsosimple/src/main/cpp/hello/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set(CMAKE_VERBOSE_MAKEFILE on) 4 | 5 | add_library( 6 | hello 7 | SHARED 8 | src/sohello.cpp 9 | ) 10 | 11 | set(export_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../export) 12 | 13 | set_target_properties( 14 | hello 15 | # 设置输出.so动态库的路径 16 | PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${export_dir}/libsohello/lib/${ANDROID_ABI}") 17 | 18 | add_custom_command( 19 | TARGET hello POST_BUILD 20 | COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/sohello.h" "${export_dir}/libsohello/include/sohello.h" 21 | ) 22 | 23 | -------------------------------------------------------------------------------- /libsosimple/src/main/cpp/hello/src/sohello.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | #include "sohello.h" 5 | 6 | int sohello(int i ) 7 | { 8 | return i + 2; 9 | } 10 | -------------------------------------------------------------------------------- /libsosimple/src/main/cpp/hello/src/sohello.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by xong on 2018/9/25. 3 | // 4 | 5 | #ifndef USECMAKEBUILDLIB_SOHELLO_H 6 | #define USECMAKEBUILDLIB_SOHELLO_H 7 | 8 | int sohello(int i ); 9 | 10 | #endif //USECMAKEBUILDLIB_SOHELLO_H 11 | -------------------------------------------------------------------------------- /libsosimple/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | libsosimple 3 | 4 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | // 拷贝源码的方式 3 | //include ':libcode' 4 | //// 构建简单的so动态库 5 | //include ':libsosimple' 6 | //// 构建jsoncpp so动态库 7 | //include ':libsojsoncpp' 8 | //// 构建简单的a静态库 9 | //include ':libasimple' 10 | //// 构建jsoncpp so静态库 11 | //include ':libajsoncpp' 12 | --------------------------------------------------------------------------------