├── AndCode
├── .gitignore
├── .idea
│ ├── caches
│ │ └── build_file_checksums.ser
│ ├── codeStyles
│ │ └── Project.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── app
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── ming
│ │ │ └── com
│ │ │ └── andcode
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── cpp
│ │ │ └── native-lib.cpp
│ │ ├── java
│ │ │ └── ming
│ │ │ │ └── com
│ │ │ │ └── andcode
│ │ │ │ ├── AndApplication.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── arouter
│ │ │ │ ├── LoginInterceptor.java
│ │ │ │ └── SaidInterceptor.java
│ │ │ │ ├── dagger2
│ │ │ │ ├── DaggerActivity.java
│ │ │ │ ├── component
│ │ │ │ │ ├── DaggerActivityComp.java
│ │ │ │ │ ├── FlowerComponent.java
│ │ │ │ │ └── PotComponent.java
│ │ │ │ ├── delo
│ │ │ │ │ ├── Flower.java
│ │ │ │ │ ├── Lily.java
│ │ │ │ │ ├── OkHttpClient.java
│ │ │ │ │ ├── Pot.java
│ │ │ │ │ ├── RetrofitManager.java
│ │ │ │ │ └── Rose.java
│ │ │ │ ├── module
│ │ │ │ │ ├── DaggeActivityModule.java
│ │ │ │ │ ├── FlowerModule.java
│ │ │ │ │ └── PotModule.java
│ │ │ │ ├── qualifier
│ │ │ │ │ ├── LilyFlower.java
│ │ │ │ │ └── RoseFlower.java
│ │ │ │ └── scope
│ │ │ │ │ └── ActivityScope.java
│ │ │ │ ├── dbbase
│ │ │ │ ├── BaseDao.java
│ │ │ │ ├── BasicEntity.java
│ │ │ │ ├── BasicSQLHelper.java
│ │ │ │ ├── Where.java
│ │ │ │ └── dbcontact
│ │ │ │ │ ├── ContactEntity.java
│ │ │ │ │ ├── ContactEntityDao.java
│ │ │ │ │ ├── ContactManager.java
│ │ │ │ │ ├── ContactSQLHelper.java
│ │ │ │ │ ├── ContactStore.java
│ │ │ │ │ └── DBContactStore.java
│ │ │ │ ├── jni
│ │ │ │ └── JNIManage.java
│ │ │ │ ├── lifebind
│ │ │ │ ├── ActivityFragmentLifecycle.java
│ │ │ │ ├── LifeUtil.java
│ │ │ │ ├── Lifecycle.java
│ │ │ │ ├── LifecycleDetector.java
│ │ │ │ ├── LifecycleListener.java
│ │ │ │ ├── LifecycleManagerFragment.java
│ │ │ │ └── TestLife.java
│ │ │ │ └── mvp
│ │ │ │ ├── MVPActivity.java
│ │ │ │ ├── base
│ │ │ │ ├── Api.java
│ │ │ │ ├── BasePresenter.java
│ │ │ │ ├── IModel.java
│ │ │ │ ├── IPresenter.java
│ │ │ │ └── IView.java
│ │ │ │ ├── callback
│ │ │ │ └── CallBack.java
│ │ │ │ └── getdata
│ │ │ │ ├── GetDataContract.java
│ │ │ │ ├── GetDataModel.java
│ │ │ │ ├── GetDataModeli.java
│ │ │ │ ├── GetDataPresenter.java
│ │ │ │ ├── bean
│ │ │ │ ├── ArticleListBean.java
│ │ │ │ └── BannerBean.java
│ │ │ │ └── utils
│ │ │ │ ├── LogUtil.java
│ │ │ │ └── RetrofitUtils.java
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ ├── activity_dagger.xml
│ │ │ ├── activity_main.xml
│ │ │ └── activity_mvp.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
│ │ │ ├── dimen.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── ming
│ │ └── com
│ │ └── andcode
│ │ └── ExampleUnitTest.java
├── basemodule
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── ming
│ │ │ └── com
│ │ │ └── basemodule
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── ming
│ │ │ │ └── com
│ │ │ │ └── basemodule
│ │ │ │ └── Books.java
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ │ └── test
│ │ └── java
│ │ └── ming
│ │ └── com
│ │ └── basemodule
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── modulerone
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── ming
│ │ │ └── com
│ │ │ └── modulerone
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── ming
│ │ │ │ └── com
│ │ │ │ └── modulerone
│ │ │ │ └── ModulerMainActivity.java
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_moduler_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
│ │ └── test
│ │ └── java
│ │ └── ming
│ │ └── com
│ │ └── modulerone
│ │ └── ExampleUnitTest.java
├── modulertwo
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── ming
│ │ │ └── com
│ │ │ └── modulertwo
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── ming
│ │ │ │ └── com
│ │ │ │ └── modulertwo
│ │ │ │ └── ModulerTMainActivity.java
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_moduler_tmain.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
│ │ └── test
│ │ └── java
│ │ └── ming
│ │ └── com
│ │ └── modulertwo
│ │ └── ExampleUnitTest.java
└── settings.gradle
├── CCodes
├── .gitignore
├── .idea
│ ├── CCodes.iml
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── vcs.xml
│ └── workspace.xml
├── CMakeLists.txt
└── com.ming.code
│ ├── blogcode
│ ├── blogcodes.c
│ ├── method.h
│ ├── operatorhead.h
│ ├── socket_client_tcp.c
│ ├── socket_client_udp.c
│ ├── socket_server_tcp.c
│ ├── socket_server_udp.c
│ ├── support.c
│ ├── ycodes.c
│ └── ycodes.h
│ ├── easylogger
│ ├── inc
│ │ ├── elog.h
│ │ └── elog_cfg.h
│ ├── port
│ │ └── elog_port.c
│ └── src
│ │ ├── elog.c
│ │ ├── elog_async.c
│ │ ├── elog_buf.c
│ │ └── elog_utils.c
│ ├── libcurl
│ ├── request
│ │ ├── cluster_curl.c
│ │ ├── cluster_curl.h
│ │ └── libcurlclient.c
│ └── socket
│ │ ├── externalsocket.c
│ │ └── sendrecvheart.c
│ ├── main.c
│ └── tinyhttp
│ ├── simpleclient.c
│ └── smarthttp.c
├── CMakeDemo
├── .idea
│ ├── CMakeDemo.iml
│ ├── encodings.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── vcs.xml
├── CMakeLists.txt
├── License.txt
├── config.h.in
├── main.c
└── math
│ ├── CMakeLists.txt
│ ├── MathUtils.c
│ └── MathUtils.h
├── CppCodes
├── .gitignore
├── .idea
│ └── vcs.xml
├── CMakeLists.txt
├── com.ming.codes
│ ├── blogcodes
│ │ ├── Cppblogcode.cpp
│ │ ├── Cppblogcode.h
│ │ └── googletest.cpp
│ ├── codinginterview
│ │ ├── ConstructBinaryTree.cpp
│ │ ├── CopyComplexList.cpp
│ │ ├── FindDuplicate.cpp
│ │ ├── MinNumberInRotatedArray.cpp
│ │ ├── NextNodeInBinaryTree.cpp
│ │ ├── PrintListInReOrder.cpp
│ │ ├── QueueInTwoStack.cpp
│ │ ├── ReplaceSpace.cpp
│ │ └── ReverseLinkedList.cpp
│ └── res
│ │ └── IntelGFXCoin.log
├── googletest
│ ├── .gitignore
│ ├── .travis.yml
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── CONTRIBUTING.md
│ ├── LICENSE
│ ├── Makefile.am
│ ├── README.md
│ ├── WORKSPACE
│ ├── appveyor.yml
│ ├── ci
│ │ ├── build-linux-autotools.sh
│ │ ├── build-linux-bazel.sh
│ │ ├── env-linux.sh
│ │ ├── env-osx.sh
│ │ ├── get-nprocessors.sh
│ │ ├── install-linux.sh
│ │ ├── install-osx.sh
│ │ ├── log-config.sh
│ │ └── travis.sh
│ ├── configure.ac
│ ├── googlemock
│ │ ├── CHANGES
│ │ ├── CMakeLists.txt
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ ├── Makefile.am
│ │ ├── README.md
│ │ ├── cmake
│ │ │ ├── gmock.pc.in
│ │ │ └── gmock_main.pc.in
│ │ ├── configure.ac
│ │ ├── docs
│ │ │ ├── CheatSheet.md
│ │ │ ├── CookBook.md
│ │ │ ├── DesignDoc.md
│ │ │ ├── Documentation.md
│ │ │ ├── ForDummies.md
│ │ │ ├── FrequentlyAskedQuestions.md
│ │ │ └── KnownIssues.md
│ │ ├── include
│ │ │ └── gmock
│ │ │ │ ├── gmock-actions.h
│ │ │ │ ├── gmock-cardinalities.h
│ │ │ │ ├── gmock-generated-actions.h
│ │ │ │ ├── gmock-generated-actions.h.pump
│ │ │ │ ├── gmock-generated-function-mockers.h
│ │ │ │ ├── gmock-generated-function-mockers.h.pump
│ │ │ │ ├── gmock-generated-matchers.h
│ │ │ │ ├── gmock-generated-matchers.h.pump
│ │ │ │ ├── gmock-generated-nice-strict.h
│ │ │ │ ├── gmock-generated-nice-strict.h.pump
│ │ │ │ ├── gmock-matchers.h
│ │ │ │ ├── gmock-more-actions.h
│ │ │ │ ├── gmock-more-matchers.h
│ │ │ │ ├── gmock-spec-builders.h
│ │ │ │ ├── gmock.h
│ │ │ │ └── internal
│ │ │ │ ├── custom
│ │ │ │ ├── README.md
│ │ │ │ ├── gmock-generated-actions.h
│ │ │ │ ├── gmock-generated-actions.h.pump
│ │ │ │ ├── gmock-matchers.h
│ │ │ │ └── gmock-port.h
│ │ │ │ ├── gmock-generated-internal-utils.h
│ │ │ │ ├── gmock-generated-internal-utils.h.pump
│ │ │ │ ├── gmock-internal-utils.h
│ │ │ │ └── gmock-port.h
│ │ ├── msvc
│ │ │ ├── 2005
│ │ │ │ ├── gmock.sln
│ │ │ │ ├── gmock.vcproj
│ │ │ │ ├── gmock_config.vsprops
│ │ │ │ ├── gmock_main.vcproj
│ │ │ │ └── gmock_test.vcproj
│ │ │ ├── 2010
│ │ │ │ ├── gmock.sln
│ │ │ │ ├── gmock.vcxproj
│ │ │ │ ├── gmock_config.props
│ │ │ │ ├── gmock_main.vcxproj
│ │ │ │ └── gmock_test.vcxproj
│ │ │ └── 2015
│ │ │ │ ├── gmock.sln
│ │ │ │ ├── gmock.vcxproj
│ │ │ │ ├── gmock_config.props
│ │ │ │ ├── gmock_main.vcxproj
│ │ │ │ └── gmock_test.vcxproj
│ │ ├── scripts
│ │ │ ├── fuse_gmock_files.py
│ │ │ ├── generator
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README
│ │ │ │ ├── README.cppclean
│ │ │ │ ├── cpp
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── ast.py
│ │ │ │ │ ├── gmock_class.py
│ │ │ │ │ ├── gmock_class_test.py
│ │ │ │ │ ├── keywords.py
│ │ │ │ │ ├── tokenize.py
│ │ │ │ │ └── utils.py
│ │ │ │ └── gmock_gen.py
│ │ │ ├── gmock-config.in
│ │ │ ├── gmock_doctor.py
│ │ │ ├── upload.py
│ │ │ └── upload_gmock.py
│ │ ├── src
│ │ │ ├── gmock-all.cc
│ │ │ ├── gmock-cardinalities.cc
│ │ │ ├── gmock-internal-utils.cc
│ │ │ ├── gmock-matchers.cc
│ │ │ ├── gmock-spec-builders.cc
│ │ │ ├── gmock.cc
│ │ │ └── gmock_main.cc
│ │ └── test
│ │ │ ├── BUILD.bazel
│ │ │ ├── gmock-actions_test.cc
│ │ │ ├── gmock-cardinalities_test.cc
│ │ │ ├── gmock-generated-actions_test.cc
│ │ │ ├── gmock-generated-function-mockers_test.cc
│ │ │ ├── gmock-generated-internal-utils_test.cc
│ │ │ ├── gmock-generated-matchers_test.cc
│ │ │ ├── gmock-internal-utils_test.cc
│ │ │ ├── gmock-matchers_test.cc
│ │ │ ├── gmock-more-actions_test.cc
│ │ │ ├── gmock-nice-strict_test.cc
│ │ │ ├── gmock-port_test.cc
│ │ │ ├── gmock-spec-builders_test.cc
│ │ │ ├── gmock_all_test.cc
│ │ │ ├── gmock_ex_test.cc
│ │ │ ├── gmock_leak_test.py
│ │ │ ├── gmock_leak_test_.cc
│ │ │ ├── gmock_link2_test.cc
│ │ │ ├── gmock_link_test.cc
│ │ │ ├── gmock_link_test.h
│ │ │ ├── gmock_output_test.py
│ │ │ ├── gmock_output_test_.cc
│ │ │ ├── gmock_output_test_golden.txt
│ │ │ ├── gmock_stress_test.cc
│ │ │ ├── gmock_test.cc
│ │ │ └── gmock_test_utils.py
│ └── googletest
│ │ ├── CHANGES
│ │ ├── CMakeLists.txt
│ │ ├── CONTRIBUTORS
│ │ ├── LICENSE
│ │ ├── Makefile.am
│ │ ├── README.md
│ │ ├── cmake
│ │ ├── Config.cmake.in
│ │ ├── gtest.pc.in
│ │ ├── gtest_main.pc.in
│ │ └── internal_utils.cmake
│ │ ├── codegear
│ │ ├── gtest.cbproj
│ │ ├── gtest.groupproj
│ │ ├── gtest_all.cc
│ │ ├── gtest_link.cc
│ │ ├── gtest_main.cbproj
│ │ └── gtest_unittest.cbproj
│ │ ├── configure.ac
│ │ ├── docs
│ │ ├── Pkgconfig.md
│ │ ├── PumpManual.md
│ │ ├── XcodeGuide.md
│ │ ├── advanced.md
│ │ ├── faq.md
│ │ ├── primer.md
│ │ └── samples.md
│ │ ├── include
│ │ └── gtest
│ │ │ ├── gtest-death-test.h
│ │ │ ├── gtest-message.h
│ │ │ ├── gtest-param-test.h
│ │ │ ├── gtest-param-test.h.pump
│ │ │ ├── gtest-printers.h
│ │ │ ├── gtest-spi.h
│ │ │ ├── gtest-test-part.h
│ │ │ ├── gtest-typed-test.h
│ │ │ ├── gtest.h
│ │ │ ├── gtest_pred_impl.h
│ │ │ ├── gtest_prod.h
│ │ │ └── internal
│ │ │ ├── custom
│ │ │ ├── README.md
│ │ │ ├── gtest-port.h
│ │ │ ├── gtest-printers.h
│ │ │ └── gtest.h
│ │ │ ├── gtest-death-test-internal.h
│ │ │ ├── gtest-filepath.h
│ │ │ ├── gtest-internal.h
│ │ │ ├── gtest-linked_ptr.h
│ │ │ ├── gtest-param-util-generated.h
│ │ │ ├── gtest-param-util-generated.h.pump
│ │ │ ├── gtest-param-util.h
│ │ │ ├── gtest-port-arch.h
│ │ │ ├── gtest-port.h
│ │ │ ├── gtest-string.h
│ │ │ ├── gtest-tuple.h
│ │ │ ├── gtest-tuple.h.pump
│ │ │ ├── gtest-type-util.h
│ │ │ └── gtest-type-util.h.pump
│ │ ├── m4
│ │ ├── acx_pthread.m4
│ │ └── gtest.m4
│ │ ├── msvc
│ │ └── 2010
│ │ │ ├── gtest-md.sln
│ │ │ ├── gtest-md.vcxproj
│ │ │ ├── gtest-md.vcxproj.filters
│ │ │ ├── gtest.sln
│ │ │ ├── gtest.vcxproj
│ │ │ ├── gtest.vcxproj.filters
│ │ │ ├── gtest_main-md.vcxproj
│ │ │ ├── gtest_main-md.vcxproj.filters
│ │ │ ├── gtest_main.vcxproj
│ │ │ ├── gtest_main.vcxproj.filters
│ │ │ ├── gtest_prod_test-md.vcxproj
│ │ │ ├── gtest_prod_test-md.vcxproj.filters
│ │ │ ├── gtest_prod_test.vcxproj
│ │ │ ├── gtest_prod_test.vcxproj.filters
│ │ │ ├── gtest_unittest-md.vcxproj
│ │ │ ├── gtest_unittest-md.vcxproj.filters
│ │ │ ├── gtest_unittest.vcxproj
│ │ │ └── gtest_unittest.vcxproj.filters
│ │ ├── samples
│ │ ├── prime_tables.h
│ │ ├── sample1.cc
│ │ ├── sample1.h
│ │ ├── sample10_unittest.cc
│ │ ├── sample1_unittest.cc
│ │ ├── sample2.cc
│ │ ├── sample2.h
│ │ ├── sample2_unittest.cc
│ │ ├── sample3-inl.h
│ │ ├── sample3_unittest.cc
│ │ ├── sample4.cc
│ │ ├── sample4.h
│ │ ├── sample4_unittest.cc
│ │ ├── sample5_unittest.cc
│ │ ├── sample6_unittest.cc
│ │ ├── sample7_unittest.cc
│ │ ├── sample8_unittest.cc
│ │ └── sample9_unittest.cc
│ │ ├── scripts
│ │ ├── common.py
│ │ ├── fuse_gtest_files.py
│ │ ├── gen_gtest_pred_impl.py
│ │ ├── gtest-config.in
│ │ ├── pump.py
│ │ ├── release_docs.py
│ │ ├── upload.py
│ │ └── upload_gtest.py
│ │ ├── src
│ │ ├── gtest-all.cc
│ │ ├── gtest-death-test.cc
│ │ ├── gtest-filepath.cc
│ │ ├── gtest-internal-inl.h
│ │ ├── gtest-port.cc
│ │ ├── gtest-printers.cc
│ │ ├── gtest-test-part.cc
│ │ ├── gtest-typed-test.cc
│ │ ├── gtest.cc
│ │ └── gtest_main.cc
│ │ ├── test
│ │ ├── BUILD.bazel
│ │ ├── googletest-break-on-failure-unittest.py
│ │ ├── googletest-break-on-failure-unittest_.cc
│ │ ├── googletest-catch-exceptions-test.py
│ │ ├── googletest-catch-exceptions-test_.cc
│ │ ├── googletest-color-test.py
│ │ ├── googletest-color-test_.cc
│ │ ├── googletest-death-test-test.cc
│ │ ├── googletest-death-test_ex_test.cc
│ │ ├── googletest-env-var-test.py
│ │ ├── googletest-env-var-test_.cc
│ │ ├── googletest-filepath-test.cc
│ │ ├── googletest-filter-unittest.py
│ │ ├── googletest-filter-unittest_.cc
│ │ ├── googletest-json-outfiles-test.py
│ │ ├── googletest-json-output-unittest.py
│ │ ├── googletest-linked-ptr-test.cc
│ │ ├── googletest-list-tests-unittest.py
│ │ ├── googletest-list-tests-unittest_.cc
│ │ ├── googletest-listener-test.cc
│ │ ├── googletest-message-test.cc
│ │ ├── googletest-options-test.cc
│ │ ├── googletest-output-test-golden-lin.txt
│ │ ├── googletest-output-test.py
│ │ ├── googletest-output-test_.cc
│ │ ├── googletest-param-test-invalid-name1-test.py
│ │ ├── googletest-param-test-invalid-name1-test_.cc
│ │ ├── googletest-param-test-invalid-name2-test.py
│ │ ├── googletest-param-test-invalid-name2-test_.cc
│ │ ├── googletest-param-test-test.cc
│ │ ├── googletest-param-test-test.h
│ │ ├── googletest-param-test2-test.cc
│ │ ├── googletest-port-test.cc
│ │ ├── googletest-printers-test.cc
│ │ ├── googletest-shuffle-test.py
│ │ ├── googletest-shuffle-test_.cc
│ │ ├── googletest-test-part-test.cc
│ │ ├── googletest-test2_test.cc
│ │ ├── googletest-throw-on-failure-test.py
│ │ ├── googletest-throw-on-failure-test_.cc
│ │ ├── googletest-tuple-test.cc
│ │ ├── googletest-uninitialized-test.py
│ │ ├── googletest-uninitialized-test_.cc
│ │ ├── gtest-typed-test2_test.cc
│ │ ├── gtest-typed-test_test.cc
│ │ ├── gtest-typed-test_test.h
│ │ ├── gtest-unittest-api_test.cc
│ │ ├── gtest_all_test.cc
│ │ ├── gtest_assert_by_exception_test.cc
│ │ ├── gtest_environment_test.cc
│ │ ├── gtest_help_test.py
│ │ ├── gtest_help_test_.cc
│ │ ├── gtest_json_test_utils.py
│ │ ├── gtest_list_output_unittest.py
│ │ ├── gtest_list_output_unittest_.cc
│ │ ├── gtest_main_unittest.cc
│ │ ├── gtest_no_test_unittest.cc
│ │ ├── gtest_pred_impl_unittest.cc
│ │ ├── gtest_premature_exit_test.cc
│ │ ├── gtest_prod_test.cc
│ │ ├── gtest_repeat_test.cc
│ │ ├── gtest_sole_header_test.cc
│ │ ├── gtest_stress_test.cc
│ │ ├── gtest_test_macro_stack_footprint_test.cc
│ │ ├── gtest_test_utils.py
│ │ ├── gtest_testbridge_test.py
│ │ ├── gtest_testbridge_test_.cc
│ │ ├── gtest_throw_on_failure_ex_test.cc
│ │ ├── gtest_unittest.cc
│ │ ├── gtest_xml_outfile1_test_.cc
│ │ ├── gtest_xml_outfile2_test_.cc
│ │ ├── gtest_xml_outfiles_test.py
│ │ ├── gtest_xml_output_unittest.py
│ │ ├── gtest_xml_output_unittest_.cc
│ │ ├── gtest_xml_test_utils.py
│ │ ├── production.cc
│ │ └── production.h
│ │ └── xcode
│ │ ├── Config
│ │ ├── DebugProject.xcconfig
│ │ ├── FrameworkTarget.xcconfig
│ │ ├── General.xcconfig
│ │ ├── ReleaseProject.xcconfig
│ │ ├── StaticLibraryTarget.xcconfig
│ │ └── TestTarget.xcconfig
│ │ ├── Resources
│ │ └── Info.plist
│ │ ├── Samples
│ │ └── FrameworkSample
│ │ │ ├── Info.plist
│ │ │ ├── WidgetFramework.xcodeproj
│ │ │ └── project.pbxproj
│ │ │ ├── runtests.sh
│ │ │ ├── widget.cc
│ │ │ ├── widget.h
│ │ │ └── widget_test.cc
│ │ ├── Scripts
│ │ ├── runtests.sh
│ │ └── versiongenerate.py
│ │ └── gtest.xcodeproj
│ │ └── project.pbxproj
└── main.cpp
├── LICENSE
├── README.MD
└── SubHey
├── .gitignore
├── .idea
├── libraries
│ └── asm_5_2.xml
├── misc.xml
├── modules.xml
├── uiDesigner.xml
├── vcs.xml
└── workspace.xml
├── SubHey.iml
└── src
├── com
└── heng
│ └── subhey
│ ├── MainActivity.java
│ ├── annotation
│ ├── CheckOut.java
│ ├── CheckOutTool.java
│ ├── Chou.java
│ ├── Liming.java
│ ├── MaSaGei.java
│ ├── NoUse.java
│ └── Person.java
│ ├── consumer
│ ├── Chef.java
│ ├── ConsumerPerson.java
│ ├── Meal.java
│ └── Restaurant.java
│ ├── nio
│ ├── FileIOUtils.java
│ └── FileUtils.java
│ ├── proxy
│ ├── Animal.java
│ ├── CgLibProxyFactory.java
│ ├── IUserDao.java
│ ├── PlaceForSell.java
│ ├── ProxyFactory.java
│ ├── Restaurant.java
│ ├── SauerkrautRest.java
│ ├── UserDao.java
│ └── UserDaoProxy.java
│ └── sigleton
│ ├── Singleton.java
│ └── StaticInnerSingleton.java
└── libs
├── asm-5.2.jar
└── cglib-3.2.5.jar
/AndCode/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/AndCode/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/AndCode/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
--------------------------------------------------------------------------------
/AndCode/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndCode/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AndCode/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AndCode/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/AndCode/app/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | add_library( # Sets the name of the library.
14 | native-lib
15 |
16 | # Sets the library as a shared library.
17 | SHARED
18 |
19 | # Provides a relative path to your source file(s).
20 | src/main/cpp/native-lib.cpp )
21 |
22 | # Searches for a specified prebuilt library and stores the path as a
23 | # variable. Because CMake includes system libraries in the search path by
24 | # default, you only need to specify the name of the public NDK library
25 | # you want to add. CMake verifies that the library exists before
26 | # completing its build.
27 |
28 | find_library( # Sets the name of the path variable.
29 | log-lib
30 |
31 | # Specifies the name of the NDK library that
32 | # you want CMake to locate.
33 | log )
34 |
35 | # Specifies libraries CMake should link to your target library. You
36 | # can link multiple libraries, such as libraries you define in this
37 | # build script, prebuilt third-party libraries, or system libraries.
38 |
39 | target_link_libraries( # Specifies the target library.
40 | native-lib
41 |
42 | # Links the target library to the log library
43 | # included in the NDK.
44 | ${log-lib} )
--------------------------------------------------------------------------------
/AndCode/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 |
--------------------------------------------------------------------------------
/AndCode/app/src/androidTest/java/ming/com/andcode/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("ming.com.andcode", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/cpp/native-lib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | extern "C" JNIEXPORT jstring
5 |
6 | JNICALL
7 | Java_ming_com_andcode_MainActivity_stringFromJNI(JNIEnv *env, jobject /* this */) {
8 | std::string hello = "Hello from C++";
9 | return env->NewStringUTF(hello.c_str());
10 | }
11 |
12 | extern "C"
13 | JNIEXPORT void JNICALL
14 | Java_ming_com_andcode_jni_JNIManage_setNums(JNIEnv *env, jobject instance, jint i) {
15 |
16 | // TODO
17 |
18 | }extern "C"
19 | JNIEXPORT jstring JNICALL
20 | Java_ming_com_andcode_jni_JNIManage_getNums(JNIEnv *env, jobject instance) {
21 |
22 | // TODO
23 | std::string returnValue = "this is jnimanage text";
24 |
25 | return env->NewStringUTF(returnValue.c_str());
26 | }
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/AndApplication.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode;
2 |
3 | import android.app.Application;
4 |
5 | import com.alibaba.android.arouter.launcher.ARouter;
6 |
7 | import ming.com.andcode.dagger2.component.DaggerFlowerComponent;
8 | import ming.com.andcode.dagger2.component.DaggerPotComponent;
9 | import ming.com.andcode.dagger2.component.PotComponent;
10 |
11 | public class AndApplication extends Application {
12 | private PotComponent potComponent;
13 | @Override
14 | public void onCreate() {
15 | super.onCreate();
16 | initializeARouter();
17 | initializePotComponent();
18 | }
19 |
20 | private void initializeARouter() {
21 | if (BuildConfig.DEBUG) { // 这两行必须写在init之前,否则这些配置在init过程中将无效
22 | ARouter.openLog(); // 打印日志
23 | ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险)
24 | }
25 | ARouter.init(AndApplication.this); // 尽可能早,推荐在Application中初始化
26 | }
27 | private void initializePotComponent() {//PotComponent位全局变量,且只有一个
28 | potComponent = DaggerPotComponent.builder()
29 | .flowerComponent(DaggerFlowerComponent.create())
30 | .build();
31 | }
32 |
33 | public PotComponent getPotComponent() {
34 | return potComponent;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/arouter/LoginInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | package ming.com.andcode.arouter;
3 |
4 | import android.content.Context;
5 | import android.util.Log;
6 |
7 | import com.alibaba.android.arouter.facade.Postcard;
8 | import com.alibaba.android.arouter.facade.annotation.Interceptor;
9 | import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
10 | import com.alibaba.android.arouter.facade.template.IInterceptor;
11 |
12 | @Interceptor(priority = 1)
13 | public class LoginInterceptor implements IInterceptor {
14 | private static final String TAG = "LoginInterceptor";
15 |
16 | private Context mContext;
17 |
18 | @Override
19 | public void process(Postcard postcard, InterceptorCallback callback) {
20 |
21 | String name=Thread.currentThread().getName();
22 | Log.i(TAG, "LoginInterceptor begain to process"+"thread name is"+name);
23 | if (postcard.getPath().equals("/moduleone/ModulerMainActivity")){
24 | Log.i(TAG, "LoginInterceptor process is interceptor ");
25 | }
26 | }
27 |
28 | @Override
29 | public void init(Context context) {
30 | mContext = context;
31 |
32 | Log.i(TAG, "LoginInterceptor init");
33 |
34 | }
35 | }
36 | */
37 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/arouter/SaidInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | package ming.com.andcode.arouter;
3 |
4 | import android.content.Context;
5 | import android.util.Log;
6 |
7 | import com.alibaba.android.arouter.facade.Postcard;
8 | import com.alibaba.android.arouter.facade.annotation.Interceptor;
9 | import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
10 | import com.alibaba.android.arouter.facade.template.IInterceptor;
11 |
12 | @Interceptor(priority = 7)
13 | public class SaidInterceptor implements IInterceptor {
14 | private static final String TAG = "LoginInterceptor";
15 |
16 | private Context mContext;
17 |
18 | @Override
19 | public void process(Postcard postcard, InterceptorCallback callback) {
20 | Log.i(TAG, "SaidInterceptor process");
21 | }
22 |
23 | @Override
24 | public void init(Context context) {
25 | mContext = context;
26 |
27 | Log.i(TAG, "SaidInterceptor init");
28 |
29 | }
30 | }
31 | */
32 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/component/DaggerActivityComp.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.component;
2 |
3 | import javax.inject.Singleton;
4 |
5 | import dagger.Component;
6 | import ming.com.andcode.dagger2.DaggerActivity;
7 |
8 | import ming.com.andcode.dagger2.module.DaggeActivityModule;
9 |
10 | import ming.com.andcode.dagger2.module.FlowerModule;
11 | import ming.com.andcode.dagger2.scope.ActivityScope;
12 |
13 |
14 | @ActivityScope
15 | @Component(modules = {DaggeActivityModule.class},dependencies = PotComponent.class)
16 | public interface DaggerActivityComp {
17 | void inject(DaggerActivity daggerActivity);
18 | }
19 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/component/FlowerComponent.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.component;
2 |
3 | import dagger.Component;
4 | import dagger.Module;
5 | import ming.com.andcode.dagger2.delo.Flower;
6 | import ming.com.andcode.dagger2.module.FlowerModule;
7 | import ming.com.andcode.dagger2.qualifier.LilyFlower;
8 | import ming.com.andcode.dagger2.qualifier.RoseFlower;
9 |
10 | @Component(modules = FlowerModule.class)
11 | public interface FlowerComponent {
12 | @RoseFlower
13 | Flower getRoseFlower();
14 |
15 | @LilyFlower
16 | Flower getLilyFlower();
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/component/PotComponent.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.component;
2 |
3 | import javax.inject.Singleton;
4 |
5 | import dagger.Component;
6 | import ming.com.andcode.dagger2.delo.Pot;
7 | import ming.com.andcode.dagger2.module.PotModule;
8 | @Singleton
9 | @Component(modules = PotModule.class, dependencies = FlowerComponent.class)
10 | public interface PotComponent {
11 | Pot getPot();
12 | }
13 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/delo/Flower.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.delo;
2 |
3 | public abstract class Flower {
4 | abstract String whisper();
5 | }
6 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/delo/Lily.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.delo;
2 |
3 |
4 | import javax.inject.Inject;
5 |
6 | public class Lily extends Flower {
7 | @Inject
8 | public Lily() {
9 | }
10 |
11 | @Override
12 | public String whisper() {
13 | return "My lover Lily";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/delo/OkHttpClient.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.delo;
2 |
3 | public class OkHttpClient {
4 | private int timeout;
5 |
6 | public OkHttpClient(int timeout) {
7 | this.timeout = timeout;
8 | }
9 |
10 | public OkHttpClient() {
11 | }
12 |
13 | public int getTimeout() {
14 | return timeout;
15 | }
16 |
17 | public void setTimeout(int timeout) {
18 | this.timeout = timeout;
19 | }
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/delo/Pot.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.delo;
2 |
3 |
4 | import javax.inject.Inject;
5 |
6 | import ming.com.andcode.dagger2.qualifier.RoseFlower;
7 |
8 |
9 | public class Pot {
10 | private Flower flower;
11 |
12 | @Inject
13 | public Pot(@RoseFlower Flower mRose) {
14 | this.flower = mRose;
15 | }
16 |
17 | public String show() {
18 | return flower.whisper();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/delo/RetrofitManager.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.delo;
2 |
3 | public class RetrofitManager {
4 | private OkHttpClient okHttpClient;
5 |
6 | public RetrofitManager(OkHttpClient okHttpClient) {
7 | this.okHttpClient = okHttpClient;
8 | }
9 |
10 | public OkHttpClient getOkHttpClient() {
11 | return okHttpClient;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/delo/Rose.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.delo;
2 |
3 |
4 | import javax.inject.Inject;
5 |
6 |
7 |
8 | public class Rose extends Flower {
9 | @Inject
10 | public Rose() {
11 | }
12 |
13 | @Override
14 | public String whisper() {
15 | return "My lover Rose";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/module/DaggeActivityModule.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.module;
2 |
3 |
4 |
5 | import dagger.Module;
6 | import dagger.Provides;
7 | import ming.com.andcode.dagger2.delo.OkHttpClient;
8 | import ming.com.andcode.dagger2.delo.RetrofitManager;
9 |
10 | @Module
11 | public class DaggeActivityModule {
12 | private int timeout;
13 |
14 | public DaggeActivityModule(int timeout) {
15 | this.timeout = timeout;
16 | }
17 |
18 | @Provides
19 | OkHttpClient provideOkHttpClient() {
20 | OkHttpClient client = new OkHttpClient();
21 | client.setTimeout(timeout);
22 | return client;
23 | }
24 |
25 | @Provides
26 | RetrofitManager provideretrofitManager(OkHttpClient client) {
27 | return new RetrofitManager(client);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/module/FlowerModule.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.module;
2 |
3 |
4 | import dagger.Module;
5 | import dagger.Provides;
6 | import ming.com.andcode.dagger2.delo.Flower;
7 |
8 | import ming.com.andcode.dagger2.delo.Lily;
9 | import ming.com.andcode.dagger2.delo.Pot;
10 | import ming.com.andcode.dagger2.delo.Rose;
11 | import ming.com.andcode.dagger2.qualifier.LilyFlower;
12 | import ming.com.andcode.dagger2.qualifier.RoseFlower;
13 |
14 |
15 | @Module
16 | public class FlowerModule {
17 |
18 | @Provides
19 | @RoseFlower
20 | Flower provideRose() {
21 | return new Rose();
22 | }
23 |
24 | @Provides
25 | @LilyFlower
26 | Flower provideLily() {
27 | return new Lily();
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/module/PotModule.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.module;
2 |
3 | import javax.inject.Singleton;
4 |
5 | import dagger.Module;
6 | import dagger.Provides;
7 | import ming.com.andcode.dagger2.delo.Flower;
8 | import ming.com.andcode.dagger2.delo.Pot;
9 | import ming.com.andcode.dagger2.qualifier.LilyFlower;
10 |
11 | @Module
12 | public class PotModule {
13 |
14 | @Provides
15 | @Singleton
16 | Pot providePot(@LilyFlower Flower flower) {
17 | return new Pot(flower);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/qualifier/LilyFlower.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.qualifier;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | import javax.inject.Qualifier;
7 |
8 | @Qualifier
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface LilyFlower {
11 | }
12 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/qualifier/RoseFlower.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.qualifier;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | import javax.inject.Qualifier;
7 |
8 | @Qualifier
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface RoseFlower {
11 | }
12 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dagger2/scope/ActivityScope.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.dagger2.scope;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 |
6 | import javax.inject.Scope;
7 |
8 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
9 |
10 | /**
11 | * Identifies a type that the injector only instantiates once. Not inherited.
12 | *
13 | * @see javax.inject.Scope @Scope
14 | */
15 | @Scope
16 | @Documented
17 | @Retention(RUNTIME)
18 | public @interface ActivityScope {}
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dbbase/BasicEntity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.hengtong.henchat.dbbase;
3 |
4 | public interface BasicEntity {
5 |
6 | /**
7 | * Gets the object id.
8 | *
9 | * @return {@link Long}.
10 | */
11 | long getId();
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dbbase/BasicSQLHelper.java:
--------------------------------------------------------------------------------
1 |
2 | package com.hengtong.henchat.dbbase;
3 |
4 | import android.content.Context;
5 | import android.database.sqlite.SQLiteDatabase;
6 | import android.database.sqlite.SQLiteOpenHelper;
7 |
8 |
9 | public abstract class BasicSQLHelper extends SQLiteOpenHelper {
10 |
11 | public static final String ID = "_id";
12 |
13 | public static final String ALL = "*";
14 |
15 | public BasicSQLHelper(Context context, String dbName, SQLiteDatabase.CursorFactory cursorFactory, int dbVersion) {
16 | super(context, dbName, cursorFactory, dbVersion);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/dbbase/dbcontact/ContactStore.java:
--------------------------------------------------------------------------------
1 | package com.hengtong.henchat.dbbase.dbcontact;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 |
6 | public interface ContactStore {
7 |
8 | void add(ContactEntity contactEntity);
9 |
10 | List get(String date);
11 |
12 | HashMap> getContacts();
13 |
14 | List queryByAll(String sql);
15 |
16 | List getContactIds(boolean all);
17 |
18 | boolean remove(long contactDetailId);
19 |
20 | boolean removeGroup(String dialerId);
21 |
22 | boolean removeAll();
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/jni/JNIManage.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.jni;
2 |
3 | public class JNIManage {
4 | private static JNIManage instance;
5 |
6 | public static JNIManage getInstance() {
7 | if (instance == null) {
8 | synchronized (JNIManage.class) {
9 | if (instance == null) {
10 | instance = new JNIManage();
11 | }
12 | }
13 | }
14 | return instance;
15 | }
16 |
17 | /**
18 | * A native method that is implemented by the 'native-lib' native library,
19 | * which is packaged with this application.
20 | */
21 | public native void setNums(int i);
22 |
23 | public native String getNums();
24 | }
25 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/ActivityFragmentLifecycle.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | import java.util.Collections;
4 | import java.util.Set;
5 | import java.util.WeakHashMap;
6 |
7 | public class ActivityFragmentLifecycle implements Lifecycle{
8 | private final Set lifecycleListeners =
9 | Collections.newSetFromMap(new WeakHashMap());
10 | private boolean isStarted;
11 | private boolean isDestroyed;
12 |
13 |
14 | @Override
15 | public void addListener(LifecycleListener listener) {
16 | lifecycleListeners.add(listener);
17 |
18 | if (isDestroyed) {
19 | listener.onDestroy();
20 | } else if (isStarted) {
21 | listener.onStart();
22 | } else {
23 | listener.onStop();
24 | }
25 | }
26 |
27 | void onStart() {
28 | isStarted = true;
29 | for (LifecycleListener lifecycleListener : LifeUtil.getSnapshot(lifecycleListeners)) {
30 | lifecycleListener.onStart();
31 | }
32 | }
33 |
34 | void onStop() {
35 | isStarted = false;
36 | for (LifecycleListener lifecycleListener : LifeUtil.getSnapshot(lifecycleListeners)) {
37 | lifecycleListener.onStop();
38 | }
39 | }
40 |
41 | void onDestroy() {
42 | isDestroyed = true;
43 | for (LifecycleListener lifecycleListener : LifeUtil.getSnapshot(lifecycleListeners)) {
44 | lifecycleListener.onDestroy();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/LifeUtil.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 | import java.util.List;
6 |
7 | public class LifeUtil {
8 | public static List getSnapshot(Collection other) {
9 | // toArray creates a new ArrayList internally and this way we can guarantee entries will not
10 | // be null. See #322.
11 | List result = new ArrayList(other.size());
12 | result.addAll(other);
13 | return result;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/Lifecycle.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | public interface Lifecycle {
4 |
5 | void addListener(LifecycleListener listener);
6 | }
7 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/LifecycleDetector.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.os.Build;
6 |
7 | public class LifecycleDetector {
8 |
9 | private static final String FRAGMENT_TAG = "com.bumptech.glide.manager";
10 |
11 | private static volatile LifecycleDetector sInstance;
12 |
13 | public static LifecycleDetector getInstance() {
14 | if (sInstance == null) {
15 | synchronized (LifecycleDetector.class) {
16 | if (sInstance == null) {
17 | sInstance = new LifecycleDetector();
18 | }
19 | }
20 | }
21 |
22 | return sInstance;
23 | }
24 |
25 | public void observer(Activity activity, LifecycleListener lifecycleListener) {
26 | // 获取当前activity的FragmentManager
27 | android.app.FragmentManager fm = activity.getFragmentManager();
28 | // 注册无UI的fragment
29 | LifecycleManagerFragment current = getRequestManagerFragment(fm);
30 |
31 | current.getLifecycle().addListener(lifecycleListener);
32 | }
33 |
34 |
35 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
36 | LifecycleManagerFragment getRequestManagerFragment(final android.app.FragmentManager fm) {
37 | LifecycleManagerFragment current = (LifecycleManagerFragment) fm.findFragmentByTag(FRAGMENT_TAG);
38 | if (current == null) {
39 | current = new LifecycleManagerFragment();
40 | fm.beginTransaction().add(current, FRAGMENT_TAG).commitAllowingStateLoss();
41 | }
42 | return current;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/LifecycleListener.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | public interface LifecycleListener {
4 | /**
5 | * Callback for when {@link android.app.Fragment#onStart()}} or {@link android.app.Activity#onStart()} is called.
6 | */
7 | void onStart();
8 |
9 | /**
10 | * Callback for when {@link android.app.Fragment#onStop()}} or {@link android.app.Activity#onStop()}} is called.
11 | */
12 | void onStop();
13 |
14 | /**
15 | * Callback for when {@link android.app.Fragment#onDestroy()}} or {@link android.app.Activity#onDestroy()} is
16 | * called.
17 | */
18 | void onDestroy();
19 | }
20 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/LifecycleManagerFragment.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Fragment;
5 |
6 | public class LifecycleManagerFragment extends Fragment {
7 | private final ActivityFragmentLifecycle lifecycle;
8 |
9 |
10 | public LifecycleManagerFragment() {
11 | this(new ActivityFragmentLifecycle());
12 | }
13 |
14 | // For testing only.
15 | @SuppressLint("ValidFragment")
16 | LifecycleManagerFragment(ActivityFragmentLifecycle lifecycle) {
17 | this.lifecycle = lifecycle;
18 | }
19 |
20 |
21 | public ActivityFragmentLifecycle getLifecycle() {
22 | return lifecycle;
23 | }
24 |
25 | @Override
26 | public void onStart() {
27 | super.onStart();
28 | lifecycle.onStart();
29 | }
30 |
31 | @Override
32 | public void onStop() {
33 | super.onStop();
34 | lifecycle.onStop();
35 | }
36 |
37 | @Override
38 | public void onDestroy() {
39 | super.onDestroy();
40 | lifecycle.onDestroy();
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/lifebind/TestLife.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.lifebind;
2 |
3 | import android.util.Log;
4 |
5 | public class TestLife implements LifecycleListener {
6 | @Override
7 | public void onStart() {
8 | Log.d("TestLife", "onStart");
9 | }
10 |
11 | @Override
12 | public void onStop() {
13 | Log.d("TestLife", "onStop");
14 |
15 | }
16 |
17 | @Override
18 | public void onDestroy() {
19 | Log.d("TestLife", "onDestroy");
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/base/Api.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.base;
2 |
3 |
4 | import ming.com.andcode.mvp.getdata.bean.ArticleListBean;
5 | import ming.com.andcode.mvp.getdata.bean.BannerBean;
6 | import retrofit2.http.GET;
7 | import retrofit2.http.Path;
8 | import rx.Observable;
9 |
10 | public interface Api {
11 |
12 | /**
13 | * wanandroid 首页文章列表
14 | *
15 | * @param curPage 当前第几页
16 | * @return
17 | */
18 | @GET("article/list/{curPage}/json")
19 | Observable getData(@Path("curPage") int curPage);
20 |
21 | /**
22 | * 获取首页banner数据
23 | *
24 | * @return
25 | */
26 | @GET("banner/json")
27 | Observable getBanner();
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/base/BasePresenter.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.base;
2 |
3 | public class BasePresenter implements IPresenter {
4 | protected T mView;
5 |
6 | @Override
7 | public void attachView(T view) {
8 | mView = view;
9 |
10 | }
11 |
12 | @Override
13 | public void detachView() {
14 | mView = null;
15 | }
16 |
17 | @Override
18 | public boolean isAttached() {
19 | return mView == null;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/base/IModel.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.base;
2 |
3 | public interface IModel {
4 | }
5 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/base/IPresenter.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.base;
2 |
3 | public interface IPresenter {
4 | void attachView(T view);
5 |
6 | void detachView();
7 |
8 | boolean isAttached();
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/base/IView.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.base;
2 |
3 | public interface IView {
4 | }
5 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/callback/CallBack.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.callback;
2 |
3 | public interface CallBack {
4 | void onSuccess(K data);
5 |
6 | void onFailed(V data);
7 | }
8 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/getdata/GetDataContract.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.getdata;
2 |
3 | import ming.com.andcode.mvp.base.IView;
4 | import ming.com.andcode.mvp.getdata.bean.ArticleListBean;
5 | import ming.com.andcode.mvp.getdata.bean.BannerBean;
6 |
7 | public interface GetDataContract {
8 | interface View extends IView {
9 | void showSuccessMsg(T bean);
10 |
11 | void showFaiedMsg(String msg);
12 |
13 | }
14 |
15 | interface Presenter {
16 | void getData(String url, int current);
17 |
18 | void getBanner(String baseUrl);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/getdata/GetDataModel.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.getdata;
2 |
3 | import ming.com.andcode.mvp.base.IModel;
4 | import ming.com.andcode.mvp.callback.CallBack;
5 |
6 | public interface GetDataModel extends IModel {
7 | void getData(String url, int current, final CallBack callBack);
8 | void getBanner(String url,final CallBack callBack);
9 | }
10 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/java/ming/com/andcode/mvp/getdata/GetDataPresenter.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode.mvp.getdata;
2 |
3 | import java.util.Random;
4 |
5 | import ming.com.andcode.mvp.base.BasePresenter;
6 | import ming.com.andcode.mvp.callback.CallBack;
7 | import ming.com.andcode.mvp.getdata.bean.ArticleListBean;
8 | import ming.com.andcode.mvp.getdata.bean.BannerBean;
9 | import ming.com.andcode.mvp.getdata.utils.LogUtil;
10 |
11 | public class GetDataPresenter extends BasePresenter implements GetDataContract.Presenter {
12 | private final GetDataModeli getDataModeli;
13 |
14 | @Override
15 | public void getData(String url, int current) {
16 | getDataModeli.getData(url, current, new CallBack() {
17 | @Override
18 | public void onSuccess(ArticleListBean data) {
19 | LogUtil.d("getData onSuccess data is " + data.toString());
20 | mView.showSuccessMsg(data);
21 |
22 | }
23 |
24 | @Override
25 | public void onFailed(String data) {
26 | LogUtil.w(data);
27 |
28 | }
29 | });
30 |
31 | }
32 |
33 | @Override
34 | public void getBanner(String baseUrl) {
35 | getDataModeli.getBanner(baseUrl, new CallBack() {
36 | @Override
37 | public void onSuccess(BannerBean data) {
38 | mView.showSuccessMsg(data);
39 | }
40 |
41 | @Override
42 | public void onFailed(String data) {
43 | mView.showFaiedMsg(data);
44 |
45 | }
46 | });
47 |
48 | }
49 |
50 | public GetDataPresenter(GetDataModeli getDataModeli) {
51 | this.getDataModeli = getDataModeli;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/layout/activity_dagger.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/layout/activity_mvp.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
18 |
28 |
29 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/values/dimen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 24sp
4 | 50dp
5 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AndCode
3 | Enter MVP
4 | Enter ARouter
5 | Click me check MVP
6 | BaseActivity
7 | Something is wrong
8 | Enter DAGGER
9 |
10 |
11 |
--------------------------------------------------------------------------------
/AndCode/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AndCode/app/src/test/java/ming/com/andcode/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.andcode;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/AndCode/basemodule/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/AndCode/basemodule/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 21
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [AROUTER_MODULE_NAME: project.getName()]
19 | }
20 | }
21 |
22 | }
23 | //关闭检索功能
24 | lintOptions {
25 | disable 'GoogleAppIndexingWarning'
26 | baseline file("lint-baseline.xml")
27 | }
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 |
35 | }
36 |
37 | dependencies {
38 | implementation fileTree(dir: 'libs', include: ['*.jar'])
39 |
40 | implementation 'com.android.support:appcompat-v7:28.0.0'
41 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
42 | testImplementation 'junit:junit:4.12'
43 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
44 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
45 | // 替换成最新版本, 需要注意的是api
46 | // 要与compiler匹配使用,均使用最新版可以保证兼容
47 | implementation('com.alibaba:arouter-api:1.4.1') {
48 | exclude group: 'com.android.support'
49 | }
50 | annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'
51 |
52 | }
--------------------------------------------------------------------------------
/AndCode/basemodule/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 |
--------------------------------------------------------------------------------
/AndCode/basemodule/src/androidTest/java/ming/com/basemodule/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.basemodule;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("ming.com.basemodule.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AndCode/basemodule/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/AndCode/basemodule/src/main/java/ming/com/basemodule/Books.java:
--------------------------------------------------------------------------------
1 | package ming.com.basemodule;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | public class Books implements Parcelable {
7 | private String bookName;
8 | private int bookPrice;
9 | private int bookId;
10 | private String bookPublish;
11 |
12 | protected Books(Parcel in) {
13 | bookName = in.readString();
14 | bookPrice = in.readInt();
15 | bookId = in.readInt();
16 | bookPublish = in.readString();
17 | }
18 |
19 | public Books(String bookName, int bookPrice, int bookId, String bookPublish) {
20 | this.bookName = bookName;
21 | this.bookPrice = bookPrice;
22 | this.bookId = bookId;
23 | this.bookPublish = bookPublish;
24 | }
25 |
26 | public static final Creator CREATOR = new Creator() {
27 | @Override
28 | public Books createFromParcel(Parcel in) {
29 | return new Books(in);
30 | }
31 |
32 | @Override
33 | public Books[] newArray(int size) {
34 | return new Books[size];
35 | }
36 | };
37 |
38 | @Override
39 | public int describeContents() {
40 | return 0;
41 | }
42 |
43 | @Override
44 | public void writeToParcel(Parcel parcel, int i) {
45 | parcel.writeString(bookName);
46 | parcel.writeInt(bookPrice);
47 | parcel.writeInt(bookId);
48 | parcel.writeString(bookPublish);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/AndCode/basemodule/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BaseModule
3 |
4 |
--------------------------------------------------------------------------------
/AndCode/basemodule/src/test/java/ming/com/basemodule/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.basemodule;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/AndCode/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.1'
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 | maven {
23 | url "https://jitpack.io"
24 | }
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/AndCode/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 |
--------------------------------------------------------------------------------
/AndCode/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/AndCode/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Dec 25 14:59:54 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/AndCode/modulerone/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/AndCode/modulerone/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 21
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [AROUTER_MODULE_NAME: project.getName()]
19 | }
20 | }
21 |
22 | }
23 | //关闭检索功能
24 | lintOptions {
25 | disable 'GoogleAppIndexingWarning'
26 | baseline file("lint-baseline.xml")
27 | }
28 |
29 | buildTypes {
30 | release {
31 | minifyEnabled false
32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33 | }
34 | }
35 |
36 | }
37 |
38 | dependencies {
39 | implementation fileTree(include: ['*.jar'], dir: 'libs')
40 | implementation 'com.android.support:appcompat-v7:28.0.0'
41 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
42 | testImplementation 'junit:junit:4.12'
43 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
44 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
45 | // 替换成最新版本, 需要注意的是api
46 | // 要与compiler匹配使用,均使用最新版可以保证兼容
47 | implementation('com.alibaba:arouter-api:1.4.1') {
48 | exclude group: 'com.android.support'
49 | }
50 | annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'
51 | implementation project(':basemodule')
52 | }
53 |
--------------------------------------------------------------------------------
/AndCode/modulerone/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 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/androidTest/java/ming/com/modulerone/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.modulerone;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("ming.com.modulerone", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/java/ming/com/modulerone/ModulerMainActivity.java:
--------------------------------------------------------------------------------
1 | package ming.com.modulerone;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.widget.TextView;
6 |
7 | import com.alibaba.android.arouter.facade.annotation.Autowired;
8 | import com.alibaba.android.arouter.facade.annotation.Route;
9 | import com.alibaba.android.arouter.launcher.ARouter;
10 |
11 | import ming.com.basemodule.Books;
12 |
13 | @Route(path = "/moduleone/ModulerMainActivity", group = "module")
14 | public class ModulerMainActivity extends AppCompatActivity {
15 | private TextView mShowMsg;
16 |
17 | @Autowired
18 | String name;
19 | @Autowired
20 | int age;
21 | @Autowired(name = "book")
22 | Books books;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_moduler_main);
28 | mShowMsg = findViewById(R.id.tv_module_two_show);
29 | // ARouter会自动对字段进行赋值,无需主动获取
30 | ARouter.getInstance().inject(this);
31 | printMsg();
32 | setResult(1314);
33 | }
34 |
35 | private void printMsg() {
36 | mShowMsg.setText("name " + name + " age " + age + " book is " + books.toString());
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/layout/activity_moduler_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulerone/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | modulerone
3 |
4 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AndCode/modulerone/src/test/java/ming/com/modulerone/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.modulerone;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/AndCode/modulertwo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 |
7 |
8 | defaultConfig {
9 | minSdkVersion 21
10 | targetSdkVersion 28
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [AROUTER_MODULE_NAME: project.getName()]
19 | }
20 | }
21 |
22 | }
23 | //关闭检索功能
24 | lintOptions {
25 | disable 'GoogleAppIndexingWarning'
26 | baseline file("lint-baseline.xml")
27 | }
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 |
35 | }
36 |
37 | dependencies {
38 | implementation fileTree(include: ['*.jar'], dir: 'libs')
39 | implementation 'com.android.support:appcompat-v7:28.0.0'
40 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
41 | testImplementation 'junit:junit:4.12'
42 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
43 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
44 | // 替换成最新版本, 需要注意的是api
45 | // 要与compiler匹配使用,均使用最新版可以保证兼容
46 | implementation('com.alibaba:arouter-api:1.4.1') {
47 | exclude group: 'com.android.support'
48 | }
49 | annotationProcessor 'com.alibaba:arouter-compiler:1.2.2'
50 | implementation project(':basemodule')
51 | }
52 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/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 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/androidTest/java/ming/com/modulertwo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.modulertwo;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("ming.com.modulertwo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/java/ming/com/modulertwo/ModulerTMainActivity.java:
--------------------------------------------------------------------------------
1 | package ming.com.modulertwo;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Route;
7 | import com.alibaba.android.arouter.launcher.ARouter;
8 |
9 | @Route(path = "/moduletwo/ModulerTMainActivity")
10 | public class ModulerTMainActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_moduler_tmain);
16 | ARouter.getInstance().inject(this);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/layout/activity_moduler_tmain.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/AndCode/modulertwo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | modulertwo
3 |
4 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AndCode/modulertwo/src/test/java/ming/com/modulertwo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package ming.com.modulertwo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/AndCode/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':modulerone', ':modulertwo', ':basemodule'
2 |
--------------------------------------------------------------------------------
/CCodes/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /out
11 | /captures
12 | .externalNativeBuild
13 | /cmake-build-debug
14 | /.idea
15 |
--------------------------------------------------------------------------------
/CCodes/.idea/CCodes.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/CCodes/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/CCodes/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CCodes/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CCodes/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CCodes/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # cmake_minimum_required(VERSION )
2 |
3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
4 |
5 | project(CCodes C)
6 |
7 | set(CMAKE_C_STANDARD 99)
8 |
9 | add_executable(CCodes com.ming.code/main.c com.ming.code/blogcode/support.c com.ming.code/blogcode/operatorhead.h com.ming.code/blogcode/blogcodes.c
10 | com.ming.code/tinyhttp/smarthttp.c com.ming.code/tinyhttp/simpleclient.c com.ming.code/libcurl/request/cluster_curl.c com.ming.code/libcurl/request/cluster_curl.h
11 | com.ming.code/libcurl/request/libcurlclient.c com.ming.code/easylogger/port/elog_port.c
12 | com.ming.code/easylogger/src/elog.c com.ming.code/easylogger/src/elog_async.c com.ming.code/easylogger/src/elog_buf.c com.ming.code/easylogger/src/elog_utils.c
13 | com.ming.code/blogcode/method.h com.ming.code/libcurl/socket/externalsocket.c com.ming.code/libcurl/socket/sendrecvheart.c com.ming.code/blogcode/ycodes.c com.ming.code/blogcode/ycodes.h com.ming.code/blogcode/socket_server_tcp.c com.ming.code/blogcode/socket_client_tcp.c com.ming.code/blogcode/socket_server_udp.c com.ming.code/blogcode/socket_client_udp.c)
14 |
15 |
16 |
17 |
18 | set(CURL_LIBRARY "-lcurl")
19 | find_package(CURL REQUIRED)
20 | include_directories(${CURL_INCLUDE_DIR})
21 | target_link_libraries(CCodes ${CURL_LIBRARIES})
22 |
23 | include_directories(com.ming.code/easylogger/inc)
24 |
25 | find_package(Threads)
26 |
27 | target_link_libraries(CCodes ${CMAKE_THREAD_LIBS_INIT})
28 |
29 | set(CJSON_LIBRARY "-cJSON")
30 | find_package(cJSON REQUIRED)
31 | include_directories(${cJSON_INCLUDE_DIR})
32 | target_link_libraries(CCodes ${CJSON_LIBRARIES})
--------------------------------------------------------------------------------
/CCodes/com.ming.code/blogcode/operatorhead.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Lenovo on 2018/12/14.
3 | //
4 |
5 | #ifndef CCODES_OPERATORHEAD_H
6 | #define CCODES_OPERATORHEAD_H
7 |
8 | #endif //CCODES_OPERATORHEAD_H
9 |
10 | void hello(void) {
11 | printf("hello world\n");
12 | }
--------------------------------------------------------------------------------
/CCodes/com.ming.code/blogcode/socket_client_tcp.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-8-9.
3 | //
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | #define PORT 3040 //目标地址端口号
14 | #define ADDR "10.6.191.177" //目标地址IP,ifconfig查看自己主机ip
15 |
16 | int main2() //若想编译运行,请将名称改为main
17 | {
18 | int iSocketFD = 0; //socket句柄
19 | unsigned int iRemoteAddr = 0;
20 | struct sockaddr_in stRemoteAddr = {0}; //对端,即目标地址信息
21 | socklen_t socklen = 0;
22 | char buf[4096] = {0}; //存储接收到的数据
23 |
24 | iSocketFD = socket(AF_INET, SOCK_STREAM, 0); //建立socket
25 | if (0 > iSocketFD) {
26 | printf("创建socket失败!\n");
27 | return 0;
28 | }
29 |
30 | stRemoteAddr.sin_family = AF_INET;
31 | stRemoteAddr.sin_port = htons(PORT);
32 | inet_pton(AF_INET, ADDR, &iRemoteAddr);
33 | stRemoteAddr.sin_addr.s_addr = iRemoteAddr;
34 |
35 | //连接方法: 传入句柄,目标地址,和大小
36 | if (0 > connect(iSocketFD, (void *) &stRemoteAddr, sizeof(stRemoteAddr))) {
37 | printf("连接失败!\n");
38 | //printf("connect failed:%d",errno);//失败时也可打印errno
39 | } else {
40 | printf("连接成功!\n");
41 | recv(iSocketFD, buf, sizeof(buf), 0); ////将接收数据打入buf,参数分别是句柄,储存处,最大长度,其他信息(设为0即可)。
42 | printf("Received:%s\n", buf);
43 | }
44 |
45 | close(iSocketFD);//关闭socket
46 | return 0;
47 | }
48 |
--------------------------------------------------------------------------------
/CCodes/com.ming.code/blogcode/socket_client_udp.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-8-9.
3 | //
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | int main4(void)//若想编译运行,请将名称改为main
14 | {
15 | int iRecvLen = 0;
16 | int iSocketFD = 0;
17 | int iRemotAddr = 0;
18 | char acBuf[4096] = {0};
19 | struct sockaddr_in stLocalAddr = {0};
20 |
21 | struct sockaddr_in stRemoteAddr = {0};
22 | socklen_t iRemoteAddrLen = 0;
23 |
24 | /* 创建socket */
25 | iSocketFD = socket(AF_INET, SOCK_DGRAM, 0);
26 | if(iSocketFD < 0)
27 | {
28 | printf("创建socket失败!\n");
29 | return 0;
30 | }
31 |
32 | /* 填写服务端地址 */
33 | stLocalAddr.sin_family = AF_INET;
34 | stLocalAddr.sin_port = htons(12345);
35 | inet_pton(AF_INET, "10.6.191.177", (void *)&iRemotAddr);
36 | stLocalAddr.sin_addr.s_addr = iRemotAddr;
37 | iRecvLen = sendto(iSocketFD, "这是一个测试字符串", strlen("这是一个测试字符串"), 0, (void *)&stLocalAddr, sizeof(stLocalAddr));
38 |
39 | close(iSocketFD);
40 | return 0;
41 | }
42 |
--------------------------------------------------------------------------------
/CCodes/com.ming.code/blogcode/socket_server_udp.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-8-9.
3 | //
4 |
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | void * test(void *pvData)
14 | {
15 | while(1)
16 | {
17 | sleep(10);
18 | printf("################################\n");
19 | }
20 | return NULL;
21 | }
22 |
23 | int main3(void)//若想编译运行,请将名称改为main
24 | {
25 | pthread_t stPid = 0;
26 | int iRecvLen = 0;
27 | int iSocketFD = 0;
28 | char acBuf[4096] = {0};
29 | struct sockaddr_in stLocalAddr = {0};
30 |
31 | struct sockaddr_in stRemoteAddr = {0};
32 | socklen_t iRemoteAddrLen = 0;
33 |
34 | /* 创建socket */
35 | iSocketFD = socket(AF_INET, SOCK_DGRAM, 0);
36 | if(iSocketFD < 0)
37 | {
38 | printf("创建socket失败!\n");
39 | return 0;
40 | }
41 |
42 | /* 填写地址 */
43 | stLocalAddr.sin_family = AF_INET;
44 | stLocalAddr.sin_port = htons(12345);
45 | stLocalAddr.sin_addr.s_addr = 0;
46 |
47 | /* 绑定地址 */
48 | if(0 > bind(iSocketFD, (void *)&stLocalAddr, sizeof(stLocalAddr)))
49 | {
50 | printf("绑定地址失败!\n");
51 | close(iSocketFD);
52 | return 0;
53 | }
54 | pthread_create(&stPid, NULL, test, NULL); //实现了多线程
55 |
56 | while(1) //实现了循环监听
57 | {
58 | iRecvLen = recvfrom(iSocketFD, acBuf, sizeof(acBuf), 0, (void *)&stRemoteAddr, &iRemoteAddrLen);
59 | printf("iRecvLen: %d\n", iRecvLen);
60 | printf("acBuf:%s\n", acBuf);
61 | }
62 | close(iSocketFD);
63 |
64 | return 0;
65 | }
66 |
--------------------------------------------------------------------------------
/CCodes/com.ming.code/blogcode/ycodes.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-3-11.
3 | //
4 |
5 | #include "ycodes.h"
6 |
7 |
8 | #include
9 | #include
10 |
11 |
12 | void open(char *str){
13 |
14 | }
--------------------------------------------------------------------------------
/CCodes/com.ming.code/blogcode/ycodes.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-3-11.
3 | //
4 |
5 | #ifndef CCODES_YCODES_H
6 | #define CCODES_YCODES_H
7 |
8 | #endif //CCODES_YCODES_H
9 |
--------------------------------------------------------------------------------
/CCodes/com.ming.code/tinyhttp/simpleclient.c:
--------------------------------------------------------------------------------
1 | /*
2 | //
3 | // Created by shanlovana on 18-12-20.
4 | //
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include "smarthttp.c"
12 |
13 | //服务器main函数
14 | int main() {
15 | int server_sock = 1;
16 | u_short port = 4000;
17 | int client_sock = -1;
18 | struct sockaddr_in client_name;
19 | socklen_t client_name_len = sizeof(client_name);
20 | pthread_t new_thread;
21 |
22 | //建立监听套接字,在对应的端口建立http服务
23 | server_sock = startup(&port);
24 | printf("http running on port %d\n", port);
25 | // 进入循环,服务器通过调用accept等待客户端的连接,Accept会以阻塞的方式运行,直到
26 | // 有客户端连接才会返回。连接成功后,服务器启动一个新的线程来处理客户端的请求,处理
27 | // 完成后,重新等待新的客户端请求。
28 | int a;
29 | while (a) {
30 | // 返回一个已连接套接字,套接字收到客户端连接请求
31 | client_sock = accept(server_sock, (struct sockaddr *) &client_name, &client_name_len);
32 | if (client_sock == -1) {
33 | error_die("accept");
34 | }
35 | // 派生线程用accept_request函数处理新请求。
36 | */
37 | /* accept_request(client_sock); *//*
38 |
39 | if (pthread_create(&new_thread, NULL, (void *) accept_request, (void *) &client_sock) != 0) {
40 | perror("pthrea_create");
41 | }
42 | }
43 | //出现意外,关闭socket
44 | close(server_sock);
45 |
46 | return 0;
47 |
48 | }*/
49 |
--------------------------------------------------------------------------------
/CMakeDemo/.idea/CMakeDemo.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/CMakeDemo/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/CMakeDemo/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CMakeDemo/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CMakeDemo/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CMakeDemo/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
2 |
3 | project(CMakeDemo C)
4 |
5 | set(CMAKE_C_STANDARD 99)
6 |
7 | set(VERSIONCODEMAJOR 1)
8 | set(VERSIONCODEMINOR 0)
9 |
10 |
11 |
12 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
13 |
14 |
15 | # 检查系统是否支持 pow 函数
16 | include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
17 | check_function_exists(pow HAVE_POW)
18 |
19 |
20 | # 加入一个配置头文件,用于处理 CMake 对源码的设置
21 | configure_file(
22 | "${PROJECT_SOURCE_DIR}/config.h.in"
23 | "${PROJECT_BINARY_DIR}/config.h"
24 | )
25 |
26 | # 是否使用自己的 MathUtils 库
27 | option(USE_MATH_LIB
28 | "Use provided math implementation" ON)#ON 与 OFF 切换
29 |
30 | # 是否加入 MathUtils 库
31 | if (USE_MATH_LIB)
32 | include_directories("${PROJECT_SOURCE_DIR}/math")
33 | add_subdirectory(math)
34 | set(EXTRA_LIBS ${EXTRA_LIBS} MathUtils)
35 | endif (USE_MATH_LIB)
36 |
37 |
38 | # 查找当前目录下的所有源文件
39 | # 并将名称保存到 DIR_SRCS 变量
40 | aux_source_directory(. DIR_SRCS)
41 | # 指定生成目标
42 | add_executable(CMakeDemo ${DIR_SRCS})
43 |
44 | target_link_libraries(CMakeDemo ${EXTRA_LIBS})
45 |
46 | #导入cJSON
47 | set(CJSON_LIBRARY "-cJSON")
48 | find_package(cJSON REQUIRED)
49 | include_directories(${cJSON_INCLUDE_DIR})
50 | target_link_libraries(CMakeDemo ${CJSON_LIBRARIES})
51 |
52 |
53 | # 指定安装路径
54 | install(TARGETS CMakeDemo DESTINATION bin)
55 | install(FILES "${PROJECT_BINARY_DIR}/config.h"
56 | DESTINATION include)
57 |
58 |
59 |
60 | # 构建一个 CPack 安装包
61 | include (InstallRequiredSystemLibraries)
62 | SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
63 | SET(CPACK_GENERATOR "STGZ;TGZ;TZ")
64 |
65 | set (CPACK_RESOURCE_FILE_LICENSE
66 | "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
67 |
68 | SET(CPACK_PACKAGE_NAME "CMakeDemo")
69 | SET(CPACK_PACKAGE_VENDOR "Kitware")
70 | SET(CPACK_PACKAGE_VERSION "2.5.0")
71 | SET(CPACK_PACKAGE_VERSION_MAJOR "2")
72 | SET(CPACK_PACKAGE_VERSION_MINOR "5")
73 | SET(CPACK_PACKAGE_VERSION_PATCH "0")
74 |
75 | SET(CPACK_SYSTEM_NAME "Linux-i686")
76 | SET(CPACK_TOPLEVEL_TAG "Linux-i686")
77 |
78 | include (CPack)
--------------------------------------------------------------------------------
/CMakeDemo/License.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Wistle Shan(https://www.jianshu.com/u/22473c43624f)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/CMakeDemo/config.h.in:
--------------------------------------------------------------------------------
1 | #cmakedefine USE_MATH_LIB
2 | #cmakedefine HAVE_POW
3 | // the configured options and settings for Tutorial
4 | #define VERSIONCODEMAJOR @VERSIONCODEMAJOR@
5 | #define VERSIONCODEMINOR @VERSIONCODEMINOR@
6 |
--------------------------------------------------------------------------------
/CMakeDemo/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #ifdef USE_MATH_LIB
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #else
11 | #include
12 | #endif
13 |
14 | int main(int argc, char *argv[]) {
15 |
16 |
17 | #ifdef USE_MATH_LIB
18 | printf("Now we use our own Math library. \n");
19 | hello(argc);
20 | #else
21 | printf("Now we use the standard library. \n");
22 | printf("Hello, World !\n");
23 | #endif
24 | printf("Hello, World Ending!\n");
25 |
26 |
27 | #ifdef HAVE_POW
28 | double result = power(7, 8);
29 | printf("Now we use our own Math library. Result is %f\n", result);
30 | #else
31 | double result = power(6, 9);
32 | printf("Now we use our own Math library. Result is %f\n", result);
33 |
34 | #endif
35 | printf("%s Version %d.%d \n",argv[0],VERSIONCODEMAJOR,VERSIONCODEMINOR);
36 |
37 |
38 | char *post_str = NULL;
39 | cJSON *root = cJSON_CreateObject();
40 |
41 | cJSON_AddStringToObject(root, "user", "为所欲为");
42 | cJSON_AddStringToObject(root, "pwd", "hkcw3cjbc");
43 | post_str = cJSON_Print(root);
44 | cJSON_Delete(root);
45 | root = NULL;
46 | printf("post_str is %s \n",post_str);
47 |
48 | return 0;
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/CMakeDemo/math/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # 查找当前目录下的所有源文件
2 | # 并将名称保存到 DIR_LIB_SRCS 变量
3 | aux_source_directory(. DIR_LIB_SRCS)
4 | # 指定生成 MathUtils 链接库
5 | add_library (MathUtils ${DIR_LIB_SRCS})
6 |
7 | # 指定 MathFunctions 库的安装路径
8 | install (TARGETS MathUtils DESTINATION bin)
9 | install (FILES MathUtils.h DESTINATION include)
10 |
--------------------------------------------------------------------------------
/CMakeDemo/math/MathUtils.c:
--------------------------------------------------------------------------------
1 | //
2 | // Created by shanlovana on 19-1-21.
3 | //
4 |
5 | #include
6 | #include "MathUtils.h"
7 |
8 |
9 | int hello(int num) {
10 | printf("Hello World From MathUtils! Result is %d\n",num * 2);
11 | return num * 2;
12 | }
13 |
14 | double power(double base, int exponent)
15 | {
16 | int result = base;
17 | int i;
18 |
19 | if (exponent == 0) {
20 | return 1;
21 | }
22 |
23 | for(i = 1; i < exponent; ++i){
24 | result = result * base;
25 | }
26 |
27 | return result;
28 | }
--------------------------------------------------------------------------------
/CMakeDemo/math/MathUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by shanlovana on 19-1-21.
3 | //
4 |
5 | #ifndef CMAKEDEMO_MATHUTILS_H
6 | #define CMAKEDEMO_MATHUTILS_H
7 |
8 | #endif //CMAKEDEMO_MATHUTILS_H
9 |
10 | extern int hello(int num);
11 |
12 | extern double power(double base, int exponent);
--------------------------------------------------------------------------------
/CppCodes/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /out
11 | /captures
12 | .externalNativeBuild
13 | /cmake-build-debug
14 | /.idea
15 |
--------------------------------------------------------------------------------
/CppCodes/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CppCodes/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
2 | project(CppCodes)
3 |
4 | message("------------ Options -------------")
5 |
6 | set(CMAKE_CXX_STANDARD 14)
7 | add_subdirectory(./googletest)
8 | include_directories(./googletest/include ./googletest)
9 | link_directories(./googletest)
10 | set(LIBRARIES
11 | gtest
12 | pthread)
13 |
14 | add_executable(CppCodes main.cpp com.ming.codes/blogcodes/Cppblogcode.cpp com.ming.codes/blogcodes/Cppblogcode.h
15 | com.ming.codes/codinginterview/FindDuplicate.cpp com.ming.codes/blogcodes/googletest.cpp com.ming.codes/codinginterview/ReplaceSpace.cpp com.ming.codes/codinginterview/PrintListInReOrder.cpp com.ming.codes/codinginterview/ConstructBinaryTree.cpp com.ming.codes/codinginterview/NextNodeInBinaryTree.cpp com.ming.codes/codinginterview/QueueInTwoStack.cpp com.ming.codes/codinginterview/MinNumberInRotatedArray.cpp com.ming.codes/codinginterview/ReverseLinkedList.cpp com.ming.codes/codinginterview/CopyComplexList.cpp)
16 | target_link_libraries(CppCodes ${LIBRARIES})
--------------------------------------------------------------------------------
/CppCodes/com.ming.codes/blogcodes/googletest.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-8-7.
3 | //
4 |
5 | #include
6 | #include
7 |
8 | int add(int a, int b) {
9 | return a + b;
10 | }
11 |
12 | TEST(test, c1) {
13 | EXPECT_EQ(3, add(1, 2));
14 | }
15 |
16 |
17 |
--------------------------------------------------------------------------------
/CppCodes/com.ming.codes/codinginterview/FindDuplicate.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-8-7.
3 | //
4 | /*题目:
5 | * 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。
6 | * 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
7 | *1 2 8 9
8 | *2 4 9 12
9 | *4 7 10 13
10 | *6 8 11 15
11 | *
12 | * 首先选取数组中右上角的数字。如果该数字等于要查找的数字,查找过程结束;如果该数字大于要查找的数组,
13 | * 剔除这个数字所在的列;如果该数字小于要查找的数字,剔除这个数字所在的行。也就是说如果要查找的数字不在数组的右上角,
14 | * 则每一次都在数组的查找范围中剔除一行或者一列,这样每一步都可以缩小查找的范围,直到找到要查找的数字,或者查找范围为空。
15 | * 运行时间:1 test from find (0 ms total)
16 | * */
17 | #include
18 | #include
19 | #include
20 | using namespace std;
21 |
22 | class Solution {
23 | public:
24 | bool Find(int target, vector > array) {
25 |
26 | int rows = array.size();
27 | int columns = array[0].size();
28 | if (!array.empty() && rows > 0 && columns > 0) {
29 | int row = 0;
30 | int col = columns - 1;
31 | while (row < rows && col >= 0) {
32 | if (array[row][col] == target) {
33 | return true;
34 | } else if (array[row][col] > target) {
35 | col--;
36 | } else {
37 | row++;
38 | }
39 |
40 | }
41 | return false;
42 |
43 | } else {
44 | return false;
45 | }
46 | }
47 |
48 | };
49 |
50 | TEST(find,c2){
51 | int target = 13;//13,99分别测试
52 | vector >num =
53 | {{1,5,10,12,15},{2,8,12,15,17},{4,9,13,16,21},{9,14,18,20,24},{10,18,25,23,30} };
54 |
55 | EXPECT_TRUE((new Solution)->Find(target,num));
56 | }
--------------------------------------------------------------------------------
/CppCodes/com.ming.codes/codinginterview/QueueInTwoStack.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by android on 19-8-14.
3 | //
4 | /*题目:
5 | * 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。
6 | * 队列是先进先出,栈是先进后出,如何用两个栈来实现这种先进先出呢?
7 | * 其实很简单,我们假设用stack1专门来装元素,那么直接stack1.pop肯定是不行的,这个时候stack2就要发挥作用了。
8 | * 我们的规则是:只要stack2中有元素就pop,如果stack2为空,则将stack1中所有元素倒进satck2中,就是说,新元素只进stack1,元素出来只从stack2出来。
9 | * 直到stack2的为空,stack1再将值倒入stack2中
10 | * 这样子,就能保证每次从stack2中pop出来的元素就是最老的元素了。
11 | * */
12 | #include
13 | #include
14 |
15 | using namespace std;
16 |
17 | class Solution {
18 | private:
19 | stack stackOne;
20 | stack stackTwo;
21 | public:
22 | void push(int node) {
23 | stackOne.push(node);
24 | }
25 |
26 | int pop() {
27 | if (stackTwo.empty()) {
28 | while (stackOne.size() > 0) {
29 | int data = stackOne.top();
30 | stackOne.pop();
31 | stackTwo.push(data);
32 | }
33 | }
34 | int pop_ele = stackTwo.top();
35 | stackTwo.pop();
36 | return pop_ele;
37 | }
38 | };
39 |
40 | TEST(queue, pop) {
41 | Solution solution;
42 | solution.push(1);
43 | solution.push(2);
44 | solution.push(3);
45 | solution.push(4);
46 | solution.push(5);
47 |
48 | cout<
31 |
32 | using namespace std;
33 |
34 | class Solution {
35 | public:
36 | int replaceSpace(char *str, int length) {
37 | if (str == NULL || length < 0) {
38 | return -1;
39 | }
40 | int spaceNum = 0;
41 | for (int i = 0; i < length; i++) {
42 | if (str[i] == ' ') {
43 | spaceNum++;
44 | }
45 | }
46 | for (int j = length - 1; j >= 0; j--) {
47 | if (str[j] != ' ') {
48 | str[j + 2 * spaceNum] = str[j];
49 | } else {
50 | spaceNum--;//此处先减除,否则结果错误
51 | str[j + 2 * spaceNum] = '%';
52 | str[j + 2 * spaceNum + 1] = '2';
53 | str[j + 2 * spaceNum + 2] = '0';
54 |
55 | }
56 | }
57 | cout << "repalced str is :" << str << endl;
58 | return spaceNum;
59 | }
60 | };
61 |
62 | TEST(repalce, a1) {
63 | //本题目前提是预先分配了足够的长度,并且支持space进行扩容,否则程序不会运行成功。
64 | char buf[30] = {'w', 'e', ' ', 'a', 'r', 'e', ' ', 'l', 'u', 'c', 'k', 'y', '\0'};
65 | //看打印结果即可
66 | EXPECT_EQ(2, (new Solution)->replaceSpace(buf, 30));
67 |
68 | }
--------------------------------------------------------------------------------
/CppCodes/com.ming.codes/res/IntelGFXCoin.log:
--------------------------------------------------------------------------------
1 | > > > 2 / 2 8 / 2 0 1 9 1 2 : 0 5 : 5 6 : 7 8 3
2 |
3 | G F X C o i n s t a l l e r ( 1 . 3 . 2 5 . 0 ) I
4 |
5 | G e t t i n g p a t h t o e x e c u t i n g D L L . . .
6 |
7 | O S V e r s i o n : 1 0 . 0 . 1 7 7 6 3
8 |
9 |
--------------------------------------------------------------------------------
/CppCodes/googletest/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore CI build directory
2 | build/
3 | xcuserdata
4 | cmake-build-debug/
5 | .idea/
6 | bazel-bin
7 | bazel-genfiles
8 | bazel-googletest
9 | bazel-out
10 | bazel-testlogs
11 | # python
12 | *.pyc
13 |
14 | # Visual Studio files
15 | *.sdf
16 | *.opensdf
17 | *.VC.opendb
18 | *.suo
19 | *.user
20 | _ReSharper.Caches/
21 | Win32-Debug/
22 | Win32-Release/
23 | x64-Debug/
24 | x64-Release/
25 |
26 | # Ignore autoconf / automake files
27 | Makefile.in
28 | aclocal.m4
29 | configure
30 | build-aux/
31 | autom4te.cache/
32 | googletest/m4/libtool.m4
33 | googletest/m4/ltoptions.m4
34 | googletest/m4/ltsugar.m4
35 | googletest/m4/ltversion.m4
36 | googletest/m4/lt~obsolete.m4
37 |
38 | # Ignore generated directories.
39 | googlemock/fused-src/
40 | googletest/fused-src/
41 |
42 | # macOS files
43 | .DS_Store
44 |
45 | # Ignore cmake generated directories and files.
46 | CMakeFiles
47 | CTestTestfile.cmake
48 | Makefile
49 | cmake_install.cmake
50 | googlemock/CMakeFiles
51 | googlemock/CTestTestfile.cmake
52 | googlemock/Makefile
53 | googlemock/cmake_install.cmake
54 | googlemock/gtest
55 |
--------------------------------------------------------------------------------
/CppCodes/googletest/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.8)
2 |
3 | if (POLICY CMP0048)
4 | cmake_policy(SET CMP0048 NEW)
5 | endif (POLICY CMP0048)
6 |
7 | project(googletest-distribution)
8 | set(GOOGLETEST_VERSION 1.9.0)
9 |
10 | enable_testing()
11 |
12 | include(CMakeDependentOption)
13 | include(GNUInstallDirs)
14 |
15 | #Note that googlemock target already builds googletest
16 | option(BUILD_GMOCK "Builds the googlemock subproject" ON)
17 | option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
18 |
19 | if(BUILD_GMOCK)
20 | add_subdirectory( googlemock )
21 | else()
22 | add_subdirectory( googletest )
23 | endif()
24 |
--------------------------------------------------------------------------------
/CppCodes/googletest/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2008, Google Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following disclaimer
12 | in the documentation and/or other materials provided with the
13 | distribution.
14 | * Neither the name of Google Inc. nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/CppCodes/googletest/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ACLOCAL_AMFLAGS = -I m4
3 |
4 | AUTOMAKE_OPTIONS = foreign
5 |
6 | # Build . before src so that our all-local and clean-local hooks kicks in at
7 | # the right time.
8 | SUBDIRS = googletest googlemock
9 |
10 | EXTRA_DIST = \
11 | BUILD.bazel \
12 | CMakeLists.txt \
13 | README.md \
14 | WORKSPACE
15 |
--------------------------------------------------------------------------------
/CppCodes/googletest/WORKSPACE:
--------------------------------------------------------------------------------
1 | workspace(name = "com_google_googletest")
2 |
3 | # Abseil
4 | http_archive(
5 | name = "com_google_absl",
6 | urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
7 | strip_prefix = "abseil-cpp-master",
8 | )
9 |
--------------------------------------------------------------------------------
/CppCodes/googletest/ci/build-linux-autotools.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2017 Google Inc.
3 | # All Rights Reserved.
4 | #
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | set -e
33 |
34 | . ci/get-nprocessors.sh
35 |
36 | # Create the configuration script
37 | autoreconf -i
38 |
39 | # Run in a subdirectory to keep the sources clean
40 | mkdir build || true
41 | cd build
42 | ../configure
43 |
44 | make -j ${NPROCESSORS:-2}
45 |
--------------------------------------------------------------------------------
/CppCodes/googletest/ci/build-linux-bazel.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2017 Google Inc.
3 | # All Rights Reserved.
4 | #
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | set -e
33 |
34 | bazel build --curses=no //...:all
35 | bazel test --curses=no //...:all
36 | bazel test --curses=no //...:all --define absl=1
37 |
--------------------------------------------------------------------------------
/CppCodes/googletest/ci/env-linux.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2017 Google Inc.
3 | # All Rights Reserved.
4 | #
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | #
33 | # This file should be sourced, and not executed as a standalone script.
34 | #
35 |
36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
37 |
38 | if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
39 | if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
40 | if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
41 | fi
42 |
--------------------------------------------------------------------------------
/CppCodes/googletest/ci/env-osx.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2017 Google Inc.
3 | # All Rights Reserved.
4 | #
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | #
33 | # This file should be sourced, and not executed as a standalone script.
34 | #
35 |
36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
37 |
38 | if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
39 | if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
40 | fi
41 |
--------------------------------------------------------------------------------
/CppCodes/googletest/ci/install-osx.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2017 Google Inc.
3 | # All Rights Reserved.
4 | #
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are
8 | # met:
9 | #
10 | # * Redistributions of source code must retain the above copyright
11 | # notice, this list of conditions and the following disclaimer.
12 | # * Redistributions in binary form must reproduce the above
13 | # copyright notice, this list of conditions and the following disclaimer
14 | # in the documentation and/or other materials provided with the
15 | # distribution.
16 | # * Neither the name of Google Inc. nor the names of its
17 | # contributors may be used to endorse or promote products derived from
18 | # this software without specific prior written permission.
19 | #
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 | set -eu
33 |
34 | if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
35 | echo "Not a macOS build; skipping installation"
36 | exit 0
37 | fi
38 |
39 | brew install ccache
40 |
--------------------------------------------------------------------------------
/CppCodes/googletest/ci/travis.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | set -evx
3 |
4 | . ci/get-nprocessors.sh
5 |
6 | # if possible, ask for the precise number of processors,
7 | # otherwise take 2 processors as reasonable default; see
8 | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
9 | if [ -x /usr/bin/getconf ]; then
10 | NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
11 | else
12 | NPROCESSORS=2
13 | fi
14 | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build
15 | # crashes if parallelized too much (maybe memory consumption problem),
16 | # so limit to 4 processors for the time being.
17 | if [ $NPROCESSORS -gt 4 ] ; then
18 | echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
19 | NPROCESSORS=4
20 | fi
21 | # Tell make to use the processors. No preceding '-' required.
22 | MAKEFLAGS="j${NPROCESSORS}"
23 | export MAKEFLAGS
24 |
25 | env | sort
26 |
27 | # Set default values to OFF for these variables if not specified.
28 | : "${NO_EXCEPTION:=OFF}"
29 | : "${NO_RTTI:=OFF}"
30 | : "${COMPILER_IS_GNUCXX:=OFF}"
31 |
32 | mkdir build || true
33 | cd build
34 | cmake -Dgtest_build_samples=ON \
35 | -Dgtest_build_tests=ON \
36 | -Dgmock_build_tests=ON \
37 | -Dcxx_no_exception=$NO_EXCEPTION \
38 | -Dcxx_no_rtti=$NO_RTTI \
39 | -DCMAKE_COMPILER_IS_GNUCXX=$COMPILER_IS_GNUCXX \
40 | -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
41 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
42 | ..
43 | make
44 | CTEST_OUTPUT_ON_FAILURE=1 make test
45 |
--------------------------------------------------------------------------------
/CppCodes/googletest/configure.ac:
--------------------------------------------------------------------------------
1 | AC_INIT([Google C++ Mocking and Testing Frameworks],
2 | [1.8.0],
3 | [googlemock@googlegroups.com],
4 | [googletest])
5 |
6 | # Provide various options to initialize the Autoconf and configure processes.
7 | AC_PREREQ([2.59])
8 | AC_CONFIG_SRCDIR([./README.md])
9 | AC_CONFIG_AUX_DIR([build-aux])
10 | AC_CONFIG_FILES([Makefile])
11 | AC_CONFIG_SUBDIRS([googletest googlemock])
12 |
13 | AM_INIT_AUTOMAKE
14 |
15 | # Output the generated files. No further autoconf macros may be used.
16 | AC_OUTPUT
17 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This file contains a list of people who've made non-trivial
2 | # contribution to the Google C++ Mocking Framework project. People
3 | # who commit code to the project are encouraged to add their names
4 | # here. Please keep the list sorted by first names.
5 |
6 | Benoit Sigoure
7 | Bogdan Piloca
8 | Chandler Carruth
9 | Dave MacLachlan
10 | David Anderson
11 | Dean Sturtevant
12 | Gene Volovich
13 | Hal Burch
14 | Jeffrey Yasskin
15 | Jim Keller
16 | Joe Walnes
17 | Jon Wray
18 | Keir Mierle
19 | Keith Ray
20 | Kostya Serebryany
21 | Lev Makhlis
22 | Manuel Klimek
23 | Mario Tanev
24 | Mark Paskin
25 | Markus Heule
26 | Matthew Simmons
27 | Mike Bland
28 | Neal Norwitz
29 | Nermin Ozkiranartli
30 | Owen Carlsen
31 | Paneendra Ba
32 | Paul Menage
33 | Piotr Kaminski
34 | Russ Rufer
35 | Sverre Sundsdal
36 | Takeshi Yoshino
37 | Vadim Berman
38 | Vlad Losev
39 | Wolfgang Klier
40 | Zhanyong Wan
41 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2008, Google Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following disclaimer
12 | in the documentation and/or other materials provided with the
13 | distribution.
14 | * Neither the name of Google Inc. nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/cmake/gmock.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gmock
5 | Description: GoogleMock (without main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@
9 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
10 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/cmake/gmock_main.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gmock_main
5 | Description: GoogleMock (with main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@
9 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
10 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/docs/Documentation.md:
--------------------------------------------------------------------------------
1 | This page lists all documentation markdown files for Google Mock **(the
2 | current git version)**
3 | -- **if you use a former version of Google Mock, please read the
4 | documentation for that specific version instead (e.g. by checking out
5 | the respective git branch/tag).**
6 |
7 | * [ForDummies](ForDummies.md) -- start here if you are new to Google Mock.
8 | * [CheatSheet](CheatSheet.md) -- a quick reference.
9 | * [CookBook](CookBook.md) -- recipes for doing various tasks using Google Mock.
10 | * [FrequentlyAskedQuestions](FrequentlyAskedQuestions.md) -- check here before asking a question on the mailing list.
11 |
12 | To contribute code to Google Mock, read:
13 |
14 | * [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch.
15 | * [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files.
16 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/docs/KnownIssues.md:
--------------------------------------------------------------------------------
1 | As any non-trivial software system, Google Mock has some known limitations and problems. We are working on improving it, and welcome your help! The follow is a list of issues we know about.
2 |
3 |
4 |
5 | ## README contains outdated information on Google Mock's compatibility with other testing frameworks ##
6 |
7 | The `README` file in release 1.1.0 still says that Google Mock only works with Google Test. Actually, you can configure Google Mock to work with any testing framework you choose.
8 |
9 | ## Tests failing on machines using Power PC CPUs (e.g. some Macs) ##
10 |
11 | `gmock_output_test` and `gmock-printers_test` are known to fail with Power PC CPUs. This is due to portability issues with these tests, and is not an indication of problems in Google Mock itself. You can safely ignore them.
12 |
13 | ## Failed to resolve libgtest.so.0 in tests when built against installed Google Test ##
14 |
15 | This only applies if you manually built and installed Google Test, and then built a Google Mock against it (either explicitly, or because gtest-config was in your path post-install). In this situation, Libtool has a known issue with certain systems' ldconfig setup:
16 |
17 | http://article.gmane.org/gmane.comp.sysutils.automake.general/9025
18 |
19 | This requires a manual run of "sudo ldconfig" after the "sudo make install" for Google Test before any binaries which link against it can be executed. This isn't a bug in our install, but we should at least have documented it or hacked a work-around into our install. We should have one of these solutions in our next release.
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/include/gmock/internal/custom/README.md:
--------------------------------------------------------------------------------
1 | # Customization Points
2 |
3 | The custom directory is an injection point for custom user configurations.
4 |
5 | ## Header `gmock-port.h`
6 |
7 | The following macros can be defined:
8 |
9 | ### Flag related macros:
10 |
11 | * `GMOCK_DECLARE_bool_(name)`
12 | * `GMOCK_DECLARE_int32_(name)`
13 | * `GMOCK_DECLARE_string_(name)`
14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)`
15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)`
16 | * `GMOCK_DEFINE_string_(name, default_val, doc)`
17 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h:
--------------------------------------------------------------------------------
1 | // This file was GENERATED by command:
2 | // pump.py gmock-generated-actions.h.pump
3 | // DO NOT EDIT BY HAND!!!
4 |
5 | // GOOGLETEST_CM0002 DO NOT DELETE
6 |
7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
9 |
10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
11 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $$ This is a Pump source file. Please use Pump to convert
3 | $$ it to callback-actions.h.
4 | $$
5 | $var max_callback_arity = 5
6 | $$}} This meta comment fixes auto-indentation in editors.
7 |
8 | // GOOGLETEST_CM0002 DO NOT DELETE
9 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
10 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
11 |
12 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
13 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Injection point for custom user configurations. See README for details
31 | //
32 | // GOOGLETEST_CM0002 DO NOT DELETE
33 |
34 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
35 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
36 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
37 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/include/gmock/internal/custom/gmock-port.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Injection point for custom user configurations. See README for details
31 | //
32 | // ** Custom implementation starts here **
33 |
34 | // GOOGLETEST_CM0002 DO NOT DELETE
35 |
36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
38 |
39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
40 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/msvc/2005/gmock.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 9.00
3 | # Visual Studio 2005
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}"
5 | EndProject
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Win32 = Debug|Win32
13 | Release|Win32 = Release|Win32
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32
17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32
18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32
19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32
20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32
21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32
22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32
23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32
24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32
25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32
26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32
27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32
28 | EndGlobalSection
29 | GlobalSection(SolutionProperties) = preSolution
30 | HideSolutionNode = FALSE
31 | EndGlobalSection
32 | EndGlobal
33 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/msvc/2005/gmock_config.vsprops:
--------------------------------------------------------------------------------
1 |
2 |
7 |
11 |
15 |
16 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/msvc/2010/gmock_config.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ../../../googletest
5 |
6 |
7 | <_ProjectFileVersion>10.0.30319.1
8 |
9 |
10 |
11 | $(GTestDir)/include;%(AdditionalIncludeDirectories)
12 |
13 |
14 |
15 |
16 | $(GTestDir)
17 |
18 |
19 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/msvc/2015/gmock_config.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ../../../googletest
5 |
6 |
7 | <_ProjectFileVersion>10.0.30319.1
8 |
9 |
10 |
11 | $(GTestDir)/include;%(AdditionalIncludeDirectories)
12 |
13 |
14 |
15 |
16 | $(GTestDir)
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/scripts/generator/README:
--------------------------------------------------------------------------------
1 |
2 | The Google Mock class generator is an application that is part of cppclean.
3 | For more information about cppclean, visit http://code.google.com/p/cppclean/
4 |
5 | The mock generator requires Python 2.3.5 or later. If you don't have Python
6 | installed on your system, you will also need to install it. You can download
7 | Python from: http://www.python.org/download/releases/
8 |
9 | To use the Google Mock class generator, you need to call it
10 | on the command line passing the header file and class for which you want
11 | to generate a Google Mock class.
12 |
13 | Make sure to install the scripts somewhere in your path. Then you can
14 | run the program.
15 |
16 | gmock_gen.py header-file.h [ClassName]...
17 |
18 | If no ClassNames are specified, all classes in the file are emitted.
19 |
20 | To change the indentation from the default of 2, set INDENT in
21 | the environment. For example to use an indent of 4 spaces:
22 |
23 | INDENT=4 gmock_gen.py header-file.h ClassName
24 |
25 | This version was made from SVN revision 281 in the cppclean repository.
26 |
27 | Known Limitations
28 | -----------------
29 | Not all code will be generated properly. For example, when mocking templated
30 | classes, the template information is lost. You will need to add the template
31 | information manually.
32 |
33 | Not all permutations of using multiple pointers/references will be rendered
34 | properly. These will also have to be fixed manually.
35 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/scripts/generator/cpp/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/CppCodes/googletest/googlemock/scripts/generator/cpp/__init__.py
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/scripts/generator/cpp/utils.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2007 Neal Norwitz
4 | # Portions Copyright 2007 Google Inc.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 |
18 | """Generic utilities for C++ parsing."""
19 |
20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)'
21 |
22 |
23 | import sys
24 |
25 |
26 | # Set to True to see the start/end token indices.
27 | DEBUG = True
28 |
29 |
30 | def ReadFile(filename, print_error=True):
31 | """Returns the contents of a file."""
32 | try:
33 | fp = open(filename)
34 | try:
35 | return fp.read()
36 | finally:
37 | fp.close()
38 | except IOError:
39 | if print_error:
40 | print('Error reading %s: %s' % (filename, sys.exc_info()[1]))
41 | return None
42 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/scripts/generator/gmock_gen.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2008 Google Inc. All Rights Reserved.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | """Driver for starting up Google Mock class generator."""
18 |
19 | __author__ = 'nnorwitz@google.com (Neal Norwitz)'
20 |
21 | import os
22 | import sys
23 |
24 | if __name__ == '__main__':
25 | # Add the directory of this script to the path so we can import gmock_class.
26 | sys.path.append(os.path.dirname(__file__))
27 |
28 | from cpp import gmock_class
29 | # Fix the docstring in case they require the usage.
30 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__)
31 | gmock_class.main()
32 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/test/gmock_link2_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 |
31 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This file is for verifying that various Google Mock constructs do not
34 | // produce linker errors when instantiated in different translation units.
35 | // Please see gmock_link_test.h for details.
36 |
37 | #define LinkTest LinkTest2
38 |
39 | #include "test/gmock_link_test.h"
40 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googlemock/test/gmock_link_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 |
31 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This file is for verifying that various Google Mock constructs do not
34 | // produce linker errors when instantiated in different translation units.
35 | // Please see gmock_link_test.h for details.
36 |
37 | #define LinkTest LinkTest1
38 |
39 | #include "test/gmock_link_test.h"
40 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # This file contains a list of people who've made non-trivial
2 | # contribution to the Google C++ Testing Framework project. People
3 | # who commit code to the project are encouraged to add their names
4 | # here. Please keep the list sorted by first names.
5 |
6 | Ajay Joshi
7 | Balázs Dán
8 | Bharat Mediratta
9 | Chandler Carruth
10 | Chris Prince
11 | Chris Taylor
12 | Dan Egnor
13 | Eric Roman
14 | Hady Zalek
15 | Jeffrey Yasskin
16 | Jói Sigurðsson
17 | Keir Mierle
18 | Keith Ray
19 | Kenton Varda
20 | Manuel Klimek
21 | Markus Heule
22 | Mika Raento
23 | Miklós Fazekas
24 | Pasi Valminen
25 | Patrick Hanna
26 | Patrick Riley
27 | Peter Kaminski
28 | Preston Jackson
29 | Rainer Klaffenboeck
30 | Russ Cox
31 | Russ Rufer
32 | Sean Mcafee
33 | Sigurður Ásgeirsson
34 | Tracy Bialik
35 | Vadim Berman
36 | Vlad Losev
37 | Zhanyong Wan
38 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2008, Google Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are
6 | met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following disclaimer
12 | in the documentation and/or other materials provided with the
13 | distribution.
14 | * Neither the name of Google Inc. nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/cmake/Config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 | include(CMakeFindDependencyMacro)
3 | if (@GTEST_HAS_PTHREAD@)
4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@)
5 | find_dependency(Threads)
6 | endif()
7 |
8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
9 | check_required_components("@project_name@")
10 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/cmake/gtest.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gtest
5 | Description: GoogleTest (without main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@
9 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
10 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/cmake/gtest_main.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gtest_main
5 | Description: GoogleTest (with main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Requires: gtest
9 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@
10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
11 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/codegear/gtest_all.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: Josh Kelley (joshkel@gmail.com)
31 | //
32 | // Google C++ Testing Framework (Google Test)
33 | //
34 | // C++Builder's IDE cannot build a static library from files with hyphens
35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 .
36 | // This file serves as a workaround.
37 |
38 | #include "src/gtest-all.cc"
39 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/docs/samples.md:
--------------------------------------------------------------------------------
1 | # Googletest Samples {#samples}
2 |
3 | If you're like us, you'd like to look at [googletest
4 | samples.](https://github.com/google/googletest/tree/master/googletest/samples)
5 | The sample directory has a number of well-commented samples showing how to use a
6 | variety of googletest features.
7 |
8 | * Sample #1 shows the basic steps of using googletest to test C++ functions.
9 | * Sample #2 shows a more complex unit test for a class with multiple member
10 | functions.
11 | * Sample #3 uses a test fixture.
12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to
13 | get the best of both libraries.
14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in
15 | derived fixtures.
16 | * Sample #6 demonstrates type-parameterized tests.
17 | * Sample #7 teaches the basics of value-parameterized tests.
18 | * Sample #8 shows using `Combine()` in value-parameterized tests.
19 | * Sample #9 shows use of the listener API to modify Google Test's console
20 | output and the use of its reflection API to inspect test results.
21 | * Sample #10 shows use of the listener API to implement a primitive memory
22 | leak checker.
23 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/include/gtest/internal/custom/README.md:
--------------------------------------------------------------------------------
1 | # Customization Points
2 |
3 | The custom directory is an injection point for custom user configurations.
4 |
5 | ## Header `gtest.h`
6 |
7 | ### The following macros can be defined:
8 |
9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of
10 | `OsStackTraceGetterInterface`.
11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See
12 | `testing::TempDir` for semantics and signature.
13 |
14 | ## Header `gtest-port.h`
15 |
16 | The following macros can be defined:
17 |
18 | ### Flag related macros:
19 |
20 | * `GTEST_FLAG(flag_name)`
21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its
22 | own flagfile flag parsing.
23 | * `GTEST_DECLARE_bool_(name)`
24 | * `GTEST_DECLARE_int32_(name)`
25 | * `GTEST_DECLARE_string_(name)`
26 | * `GTEST_DEFINE_bool_(name, default_val, doc)`
27 | * `GTEST_DEFINE_int32_(name, default_val, doc)`
28 | * `GTEST_DEFINE_string_(name, default_val, doc)`
29 |
30 | ### Logging:
31 |
32 | * `GTEST_LOG_(severity)`
33 | * `GTEST_CHECK_(condition)`
34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too.
35 |
36 | ### Threading:
37 |
38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided.
39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal`
40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)`
41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)`
42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)`
43 | * `GTEST_LOCK_EXCLUDED_(locks)`
44 |
45 | ### Underlying library support features
46 |
47 | * `GTEST_HAS_CXXABI_H_`
48 |
49 | ### Exporting API symbols:
50 |
51 | * `GTEST_API_` - Specifier for exported symbols.
52 |
53 | ## Header `gtest-printers.h`
54 |
55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a
56 | custom printer.
57 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/include/gtest/internal/custom/gtest-port.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Injection point for custom user configurations. See README for details
31 | //
32 | // ** Custom implementation starts here **
33 |
34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
36 |
37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
38 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/include/gtest/internal/custom/gtest.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Injection point for custom user configurations. See README for details
31 | //
32 | // ** Custom implementation starts here **
33 |
34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
36 |
37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
38 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest-md.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest_main-md.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest_main.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest_prod_test-md.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Header Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest_prod_test.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 | Source Files
19 |
20 |
21 |
22 |
23 | Header Files
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest_unittest-md.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/msvc/2010/gtest_unittest.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/samples/sample1.h:
--------------------------------------------------------------------------------
1 | // Copyright 2005, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | // A sample program demonstrating using Google C++ testing framework.
31 |
32 | #ifndef GTEST_SAMPLES_SAMPLE1_H_
33 | #define GTEST_SAMPLES_SAMPLE1_H_
34 |
35 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1.
36 | int Factorial(int n);
37 |
38 | // Returns true iff n is a prime number.
39 | bool IsPrime(int n);
40 |
41 | #endif // GTEST_SAMPLES_SAMPLE1_H_
42 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/src/gtest_main.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2006, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | #include
31 | #include "gtest/gtest.h"
32 |
33 | GTEST_API_ int main(int argc, char **argv) {
34 | printf("Running main() from %s\n", __FILE__);
35 | testing::InitGoogleTest(&argc, argv);
36 | return RUN_ALL_TESTS();
37 | }
38 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/test/googletest-uninitialized-test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2008, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 |
31 | #include "gtest/gtest.h"
32 |
33 | TEST(DummyTest, Dummy) {
34 | // This test doesn't verify anything. We just need it to create a
35 | // realistic stage for testing the behavior of Google Test when
36 | // RUN_ALL_TESTS() is called without
37 | // testing::InitGoogleTest() being called first.
38 | }
39 |
40 | int main() {
41 | return RUN_ALL_TESTS();
42 | }
43 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/test/gtest_main_unittest.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2006, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 |
31 | #include "gtest/gtest.h"
32 |
33 | // Tests that we don't have to define main() when we link to
34 | // gtest_main instead of gtest.
35 |
36 | namespace {
37 |
38 | TEST(GTestMainTest, ShouldSucceed) {
39 | }
40 |
41 | } // namespace
42 |
43 | // We are using the main() function defined in gtest_main.cc, so we
44 | // don't define it here.
45 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/test/gtest_testbridge_test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2018, Google LLC.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 |
31 | // This program is meant to be run by gtest_test_filter_test.py. Do not run
32 | // it directly.
33 |
34 | #include "gtest/gtest.h"
35 |
36 | // These tests are used to detect if filtering is working. Only
37 | // 'TestThatSucceeds' should ever run.
38 |
39 | TEST(TestFilterTest, TestThatSucceeds) {}
40 |
41 | TEST(TestFilterTest, TestThatFails) {
42 | ASSERT_TRUE(false) << "This test should never be run.";
43 | }
44 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/test/production.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2006, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | //
31 | // This is part of the unit test for gtest_prod.h.
32 |
33 | #include "production.h"
34 |
35 | PrivateCode::PrivateCode() : x_(0) {}
36 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Config/DebugProject.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // DebugProject.xcconfig
3 | //
4 | // These are Debug Configuration project settings for the gtest framework and
5 | // examples. It is set in the "Based On:" dropdown in the "Project" info
6 | // dialog.
7 | // This file is based on the Xcode Configuration files in:
8 | // https://github.com/google/google-toolbox-for-mac
9 | //
10 |
11 | #include "General.xcconfig"
12 |
13 | // No optimization
14 | GCC_OPTIMIZATION_LEVEL = 0
15 |
16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off
17 | DEPLOYMENT_POSTPROCESSING = NO
18 |
19 | // Dead code stripping off
20 | DEAD_CODE_STRIPPING = NO
21 |
22 | // Debug symbols should be on obviously
23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES
24 |
25 | // Define the DEBUG macro in all debug builds
26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1
27 |
28 | // These are turned off to avoid STL incompatibilities with client code
29 | // // Turns on special C++ STL checks to "encourage" good STL use
30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS
31 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Config/FrameworkTarget.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // FrameworkTarget.xcconfig
3 | //
4 | // These are Framework target settings for the gtest framework and examples. It
5 | // is set in the "Based On:" dropdown in the "Target" info dialog.
6 | // This file is based on the Xcode Configuration files in:
7 | // https://github.com/google/google-toolbox-for-mac
8 | //
9 |
10 | // Dynamic libs need to be position independent
11 | GCC_DYNAMIC_NO_PIC = NO
12 |
13 | // Dynamic libs should not have their external symbols stripped.
14 | STRIP_STYLE = non-global
15 |
16 | // Let the user install by specifying the $DSTROOT with xcodebuild
17 | SKIP_INSTALL = NO
18 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Config/General.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // General.xcconfig
3 | //
4 | // These are General configuration settings for the gtest framework and
5 | // examples.
6 | // This file is based on the Xcode Configuration files in:
7 | // https://github.com/google/google-toolbox-for-mac
8 | //
9 |
10 | // Build for PPC and Intel, 32- and 64-bit
11 | ARCHS = i386 x86_64 ppc ppc64
12 |
13 | // Zerolink prevents link warnings so turn it off
14 | ZERO_LINK = NO
15 |
16 | // Prebinding considered unhelpful in 10.3 and later
17 | PREBINDING = NO
18 |
19 | // Strictest warning policy
20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow
21 |
22 | // Work around Xcode bugs by using external strip. See:
23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html
24 | SEPARATE_STRIP = YES
25 |
26 | // Force C99 dialect
27 | GCC_C_LANGUAGE_STANDARD = c99
28 |
29 | // not sure why apple defaults this on, but it's pretty risky
30 | ALWAYS_SEARCH_USER_PATHS = NO
31 |
32 | // Turn on position dependent code for most cases (overridden where appropriate)
33 | GCC_DYNAMIC_NO_PIC = YES
34 |
35 | // Default SDK and minimum OS version is 10.4
36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
37 | MACOSX_DEPLOYMENT_TARGET = 10.4
38 | GCC_VERSION = 4.0
39 |
40 | // VERSIONING BUILD SETTINGS (used in Info.plist)
41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc.
42 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Config/ReleaseProject.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // ReleaseProject.xcconfig
3 | //
4 | // These are Release Configuration project settings for the gtest framework
5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info
6 | // dialog.
7 | // This file is based on the Xcode Configuration files in:
8 | // https://github.com/google/google-toolbox-for-mac
9 | //
10 |
11 | #include "General.xcconfig"
12 |
13 | // subconfig/Release.xcconfig
14 |
15 | // Optimize for space and size (Apple recommendation)
16 | GCC_OPTIMIZATION_LEVEL = s
17 |
18 | // Deploment postprocessing is what triggers Xcode to strip
19 | DEPLOYMENT_POSTPROCESSING = YES
20 |
21 | // No symbols
22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO
23 |
24 | // Dead code strip does not affect ObjC code but can help for C
25 | DEAD_CODE_STRIPPING = YES
26 |
27 | // NDEBUG is used by things like assert.h, so define it for general compat.
28 | // ASSERT going away in release tends to create unused vars.
29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable
30 |
31 | // When we strip we want to strip all symbols in release, but save externals.
32 | STRIP_STYLE = all
33 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Config/StaticLibraryTarget.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // StaticLibraryTarget.xcconfig
3 | //
4 | // These are static library target settings for libgtest.a. It
5 | // is set in the "Based On:" dropdown in the "Target" info dialog.
6 | // This file is based on the Xcode Configuration files in:
7 | // https://github.com/google/google-toolbox-for-mac
8 | //
9 |
10 | // Static libs can be included in bundles so make them position independent
11 | GCC_DYNAMIC_NO_PIC = NO
12 |
13 | // Static libs should not have their internal globals or external symbols
14 | // stripped.
15 | STRIP_STYLE = debugging
16 |
17 | // Let the user install by specifying the $DSTROOT with xcodebuild
18 | SKIP_INSTALL = NO
19 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Config/TestTarget.xcconfig:
--------------------------------------------------------------------------------
1 | //
2 | // TestTarget.xcconfig
3 | //
4 | // These are Test target settings for the gtest framework and examples. It
5 | // is set in the "Based On:" dropdown in the "Target" info dialog.
6 |
7 | PRODUCT_NAME = $(TARGET_NAME)
8 | HEADER_SEARCH_PATHS = ../include
9 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.google.${PRODUCT_NAME}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | GTEST_VERSIONINFO_LONG
21 | CFBundleShortVersionString
22 | GTEST_VERSIONINFO_SHORT
23 | CFBundleGetInfoString
24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT}
25 | NSHumanReadableCopyright
26 | ${GTEST_VERSIONINFO_ABOUT}
27 | CSResourcesFileMapped
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/CppCodes/googletest/googletest/xcode/Samples/FrameworkSample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.google.gtest.${PRODUCT_NAME:identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | CSResourcesFileMapped
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/CppCodes/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "com.ming.codes/blogcodes/Cppblogcode.h"
5 |
6 | //全部单元测试一起运行
7 | GTEST_API_ int main(int argc, char ** argv) {
8 | testing::InitGoogleTest(&argc, argv);
9 | return RUN_ALL_TESTS();
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 单小明同学
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 |
2 | **分享自己经验,同时也不断的进行学习,努力提升自己。**
3 |
4 | [简书博客地址](https://www.jianshu.com/u/22473c43624f)
5 |
6 | **目录说明**
7 | + AndCode为安卓端博客分享代码
8 | + SubHey为Java端博客分享的代码
9 | + CCode为C端博客分享代码
10 | + CMakeDemo为CMake使用教程分享代码
11 | + CppCode为C++端博客分享代码,后期会与CCode合并,做混合开发。
12 |
--------------------------------------------------------------------------------
/SubHey/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /out
11 | /captures
12 | .externalNativeBuild
13 |
--------------------------------------------------------------------------------
/SubHey/.idea/libraries/asm_5_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SubHey/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SubHey/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SubHey/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SubHey/SubHey.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/CheckOut.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.RUNTIME)
7 | public @interface CheckOut {
8 | }
9 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/CheckOutTool.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | import java.lang.reflect.InvocationTargetException;
4 | import java.lang.reflect.Method;
5 |
6 | public class CheckOutTool {
7 | public static void checkAll() {
8 | MaSaGei maSaGei = new MaSaGei();
9 | Class clazz = maSaGei.getClass();
10 | Method[] method = clazz.getDeclaredMethods();
11 | StringBuilder log = new StringBuilder();
12 | // 记录异常的次数
13 | int errornum = 0;
14 | for (Method m : method) {
15 | if (m.isAnnotationPresent(CheckOut.class)) {
16 | m.setAccessible(true);
17 | try {
18 | m.invoke(maSaGei, null);
19 | } catch (IllegalAccessException e) {
20 | e.printStackTrace();
21 | } catch (InvocationTargetException e) {
22 | e.printStackTrace();
23 | errornum++;
24 | log.append(m.getName());
25 | log.append(" ");
26 | log.append("has error ");
27 | log.append("\\n\\r caused by ");
28 | log.append(e.getCause().getClass().getSimpleName());
29 | log.append("\n\r");
30 | log.append(e.getCause().getMessage());
31 | log.append("\n\r");
32 | }
33 | }
34 | }
35 | log.append(clazz.getSimpleName());
36 | log.append(" has ");
37 | log.append(errornum);
38 | log.append(" error."); // 生成测试报告
39 | System.out.println(log.toString());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/Chou.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.RUNTIME)
7 | public @interface Chou {
8 | String value() default "You";
9 | }
10 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/Liming.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | @Person(id = 10758, msg = "hello android")//或者直接默认@Person()
4 | public class Liming {
5 | @Chou("She")
6 | public String beautiful;
7 |
8 | @NoUse
9 | public void say() {
10 | System.out.println(" say is using ");
11 | }
12 |
13 | @Deprecated
14 | public void speak() {
15 | System.out.println(" speak is out of date ");
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/MaSaGei.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | public class MaSaGei {
4 | @CheckOut
5 | public void testOne() {
6 | System.out.println(" 1 + 0 = " + ((1 + 1) / 2));
7 | }
8 |
9 | @CheckOut
10 | public void testTwo() {
11 | System.out.println(" 1 + 1 = " + (8 / 4));
12 | }
13 |
14 | @CheckOut
15 | public void testThree() {
16 | System.out.println(" 1 + 2 = " + (6 / 2));
17 | }
18 |
19 | @CheckOut
20 | public void testFour() {
21 | System.out.println(" 1 / 3 = " + (6 / 0));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/NoUse.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.RUNTIME)
7 | public @interface NoUse {
8 | }
9 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/annotation/Person.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Target(ElementType.TYPE)
9 | @Retention(RetentionPolicy.RUNTIME)
10 | public @interface Person {
11 | int id() default -10998;
12 |
13 | String msg() default "no hello";
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/consumer/Chef.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.consumer;
2 |
3 | import java.util.concurrent.TimeUnit;
4 |
5 | public class Chef implements Runnable{ //product
6 |
7 | private Restaurant restaurant;
8 |
9 | private int count=0;
10 |
11 | public Chef(Restaurant restaurant) {
12 | this.restaurant = restaurant;
13 | }
14 |
15 | @Override
16 | public void run() {
17 |
18 | try {
19 | while (!Thread.interrupted()) {
20 |
21 | synchronized (this) {
22 |
23 | while (restaurant.meal != null) {
24 |
25 | wait();
26 | }
27 | if (++count==10){
28 |
29 | System.out.println("out of food,closing");
30 | restaurant.exec.shutdownNow();
31 | }
32 | System.out.println("Chef product meal"+count);
33 | synchronized (restaurant.consumerPerson){
34 | restaurant.meal= new Meal(count);
35 | restaurant.consumerPerson.notifyAll();
36 | }
37 | TimeUnit.MICROSECONDS.sleep(100);
38 | }
39 |
40 | }
41 |
42 | }catch (InterruptedException e){
43 | System.out.println("Chef interruped");
44 |
45 | }
46 |
47 | }
48 | }
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/consumer/ConsumerPerson.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.consumer;
2 |
3 | public class ConsumerPerson implements Runnable{
4 |
5 | private Restaurant restaurant;
6 |
7 | public ConsumerPerson(Restaurant restaurant) {
8 | this.restaurant = restaurant;
9 | }
10 |
11 |
12 | @Override
13 | public void run() {
14 |
15 | try{
16 | while (!Thread.interrupted()) {
17 | synchronized (this) {
18 | while (restaurant.meal == null) {
19 | wait();
20 | }
21 | System.out.println("consumerPerson got:"+restaurant.meal);
22 | }
23 | synchronized (restaurant.chef){
24 | restaurant.meal=null;
25 | restaurant.chef.notifyAll();
26 | }
27 | }
28 | } catch (InterruptedException e) {
29 | e.printStackTrace();
30 | System.out.println("consumerPerson interrupdate");
31 | }
32 |
33 | }
34 | }
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/consumer/Meal.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.consumer;
2 |
3 | public class Meal {
4 | private int count;
5 |
6 | public Meal(int count) {
7 | this.count = count;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/consumer/Restaurant.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.consumer;
2 |
3 | import java.util.concurrent.ExecutorService;
4 | import java.util.concurrent.Executors;
5 |
6 | public class Restaurant{
7 |
8 | Meal meal;
9 |
10 | ExecutorService exec = Executors.newCachedThreadPool();
11 |
12 | ConsumerPerson consumerPerson =new ConsumerPerson(this);
13 |
14 | Chef chef=new Chef(this);
15 |
16 | public Restaurant(){
17 |
18 | exec.execute(chef);
19 |
20 | exec.execute(consumerPerson);
21 |
22 | }
23 |
24 | public static void main(String[] args){
25 |
26 | new Restaurant();
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/Animal.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | public class Animal {
4 | public void ying() {
5 | System.out.println("this is a animal");
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/CgLibProxyFactory.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | import net.sf.cglib.proxy.Enhancer;
4 | import net.sf.cglib.proxy.MethodInterceptor;
5 | import net.sf.cglib.proxy.MethodProxy;
6 |
7 | import java.lang.reflect.Method;
8 |
9 | public class CgLibProxyFactory implements MethodInterceptor {
10 | private Object target;
11 |
12 | public CgLibProxyFactory(Object target) {
13 | this.target = target;
14 | }
15 |
16 | //给目标对象创建一个代理对象
17 | public Object getProxyInstance() {
18 | //1.工具类
19 | Enhancer en = new Enhancer();
20 | //2.设置父类
21 | en.setSuperclass(target.getClass());
22 | //3.设置回调函数
23 | en.setCallback(this);
24 | //4.创建子类(代理对象)
25 | return en.create();
26 | }
27 |
28 | @Override
29 | public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
30 | System.out.println("开始事务--" + o.getClass().getSimpleName() + "-----");
31 | //执行目标对象方法
32 | Object returnValue = method.invoke(target, objects);
33 | System.out.println("提交事务--" + target.getClass().getSimpleName() + "-----");
34 | return returnValue;
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/IUserDao.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | public interface IUserDao {
4 | void addRecord();
5 | }
6 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/PlaceForSell.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | import java.lang.reflect.InvocationHandler;
4 | import java.lang.reflect.Method;
5 |
6 | public class PlaceForSell implements InvocationHandler {
7 | private Object target;
8 |
9 | public PlaceForSell(Object service) {
10 | this.target = service;
11 | }
12 |
13 | @Override
14 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
15 | System.out.println("this is a place for restaurant ,please coming");
16 | method.invoke(target, args);
17 | System.out.println("please seat down and have fun");
18 | return null;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/ProxyFactory.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | import java.lang.reflect.InvocationHandler;
4 | import java.lang.reflect.Method;
5 | import java.lang.reflect.Proxy;
6 |
7 | public class ProxyFactory {
8 | private Object target;
9 |
10 | public ProxyFactory(Object target) {
11 | this.target = target;
12 | }
13 |
14 | public Object getProxyInstance() {
15 | return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), new InvocationHandler() {
16 | @Override
17 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
18 | System.out.println("开始事务--" + target.getClass().getSimpleName() + "-----");
19 | //执行目标对象方法
20 | Object returnValue = method.invoke(target, args);
21 | System.out.println("提交事务--" + target.getClass().getSimpleName() + "-----");
22 | return returnValue;
23 | }
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/Restaurant.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | public interface Restaurant {
4 | void eatFan();
5 | }
6 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/SauerkrautRest.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | public class SauerkrautRest implements Restaurant {
4 | @Override
5 | public void eatFan() {
6 | System.out.println("来我家吃酸菜鱼啦");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/UserDao.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | public class UserDao implements IUserDao {
4 | @Override
5 | public void addRecord() {
6 | System.out.println("UserDao--为您添加一条新记录");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/proxy/UserDaoProxy.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.proxy;
2 |
3 | public class UserDaoProxy implements IUserDao {
4 | private IUserDao target;
5 |
6 | public UserDaoProxy(IUserDao target) {
7 | this.target = target;
8 | }
9 |
10 | @Override
11 | public void addRecord() {
12 | System.out.println("开始执行任务。。。。");
13 | target.addRecord();
14 | System.out.println("提交执行任务。。。。");
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SubHey/src/com/heng/subhey/sigleton/StaticInnerSingleton.java:
--------------------------------------------------------------------------------
1 | package com.heng.subhey.sigleton;
2 |
3 | public final class StaticInnerSingleton {
4 |
5 | private StaticInnerSingleton() {
6 | if (SingletonHolder.instance != null) {
7 | throw new IllegalStateException();
8 | }
9 | }
10 |
11 | private static class SingletonHolder {
12 | private static StaticInnerSingleton instance = new StaticInnerSingleton();
13 | }
14 |
15 | public static StaticInnerSingleton getInstance() {
16 | return SingletonHolder.instance;
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/SubHey/src/libs/asm-5.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/SubHey/src/libs/asm-5.2.jar
--------------------------------------------------------------------------------
/SubHey/src/libs/cglib-3.2.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shanlovana/DailyCode/c05a60e1e15ed966950386cd547d2879c146f99d/SubHey/src/libs/cglib-3.2.5.jar
--------------------------------------------------------------------------------