├── 3rdparty ├── CMakeLists.txt ├── gtest-1.7.0 │ ├── CMakeLists.txt │ ├── cmake │ │ └── internal_utils.cmake │ ├── 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 │ │ │ ├── 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.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ └── 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 └── onvif │ ├── CMakeLists.txt │ ├── include │ ├── gsoap │ │ ├── duration.h │ │ ├── mecevp.h │ │ ├── smdevp.h │ │ ├── stdsoap2.h │ │ ├── threads.h │ │ ├── wsaapi.h │ │ └── wsseapi.h │ └── onvif │ │ ├── DeviceBinding.nsmap │ │ ├── MediaBinding.nsmap │ │ ├── PTZBinding.nsmap │ │ ├── soapDeviceBindingProxy.h │ │ ├── soapDeviceBindingService.h │ │ ├── soapH.h │ │ ├── soapMediaBindingProxy.h │ │ ├── soapMediaBindingService.h │ │ ├── soapPTZBindingProxy.h │ │ ├── soapPTZBindingService.h │ │ └── soapStub.h │ └── src │ ├── gsoap │ ├── dom.cpp │ ├── duration.c │ ├── mecevp.c │ ├── smdevp.c │ ├── stdsoap2.cpp │ ├── threads.c │ ├── wsaapi.c │ └── wsseapi.cpp │ └── onvif │ ├── soapC.cpp │ ├── soapDeviceBindingProxy.cpp │ ├── soapDeviceBindingService.cpp │ ├── soapMediaBindingProxy.cpp │ ├── soapMediaBindingService.cpp │ ├── soapPTZBindingProxy.cpp │ └── soapPTZBindingService.cpp ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── SSIGOnvifOpenSSLUtil.cmake └── SSIGOnvifUtil.cmake ├── samples ├── CMakeLists.txt └── main.cpp └── ssigonvif ├── CMakeLists.txt ├── include └── ssigonvif │ ├── OnvifClientDevice.hpp │ ├── OnvifClientMedia.hpp │ └── OnvifClientPTZ.hpp └── src ├── OnvifClientDevice.cpp ├── OnvifClientMedia.cpp └── OnvifClientPTZ.cpp /3rdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #root/3rdparty/CMakeLists.txt 2 | 3 | ############################################################################### 4 | # 3RDPARTY SUBDIRECTORIES 5 | ############################################################################### 6 | 7 | #Google Tests 8 | #Include Google Tests if only BUILD_TESTS was checked by user 9 | if(BUILD_TESTS) 10 | add_subdirectory (gtest-1.7.0) 11 | endif() 12 | add_subdirectory (onvif) 13 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # CMake build script for Google Test. 3 | # 4 | # To run the tests for Google Test itself on Linux, use 'make test' or 5 | # ctest. You can select which tests to run using 'ctest -R regex'. 6 | # For more options, run 'ctest --help'. 7 | 8 | # When other libraries are using a shared version of runtime libraries, 9 | # Google Test also has to use one. 10 | set( 11 | gtest_force_shared_crt 12 | OFF) 13 | 14 | set(gtest_disable_pthreads ON) 15 | 16 | # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). 17 | include(cmake/hermetic_build.cmake OPTIONAL) 18 | 19 | if (COMMAND pre_project_set_up_hermetic_build) 20 | pre_project_set_up_hermetic_build() 21 | endif() 22 | 23 | MARK_AS_ADVANCED(gtest_force_shared_crt gtest_disable_pthreads) 24 | 25 | ######################################################################## 26 | # 27 | # Project-wide settings 28 | 29 | # Name of the project. 30 | # 31 | # CMake files in this project can refer to the root source directory 32 | # as ${gtest_SOURCE_DIR} and to the root binary directory as 33 | # ${gtest_BINARY_DIR}. 34 | # Language "C" is required for find_package(Threads). 35 | project(gtest CXX C) 36 | cmake_minimum_required(VERSION 2.6.2) 37 | 38 | if (COMMAND set_up_hermetic_build) 39 | set_up_hermetic_build() 40 | endif() 41 | 42 | # Define helper functions and macros used by Google Test. 43 | include(cmake/internal_utils.cmake) 44 | 45 | config_compiler_and_linker() # Defined in internal_utils.cmake. 46 | 47 | 48 | 49 | # Where Google Test's libraries can be found. 50 | #link_directories(${gtest_BINARY_DIR}/src) 51 | 52 | ######################################################################## 53 | # 54 | # Defines the gtest & gtest_main libraries. User tests should link 55 | # with one of them. 56 | 57 | # Google Test libraries. We build them using more strict warnings than what 58 | # are used for other targets, to ensure that gtest can be compiled by a user 59 | # aggressive about warnings. 60 | cxx_library(gtest "${cxx_strict}" src/gtest-all.cc) 61 | cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) 62 | # Where Google Test's .h files can be found. 63 | target_include_directories(gtest PUBLIC 64 | ${gtest_SOURCE_DIR}/include 65 | ${gtest_SOURCE_DIR}) 66 | 67 | target_include_directories(gtest_main PUBLIC 68 | ${gtest_SOURCE_DIR}/include 69 | ${gtest_SOURCE_DIR}) 70 | 71 | target_link_libraries(gtest_main gtest) 72 | 73 | set_target_properties(gtest PROPERTIES FOLDER 3RDPARTY) 74 | set_target_properties(gtest_main PROPERTIES FOLDER 3RDPARTY) 75 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/cmake/internal_utils.cmake: -------------------------------------------------------------------------------- 1 | # Defines functions and macros useful for building Google Test and 2 | # Google Mock. 3 | # 4 | # Note: 5 | # 6 | # - This file will be run twice when building Google Mock (once via 7 | # Google Test's CMakeLists.txt, and once via Google Mock's). 8 | # Therefore it shouldn't have any side effects other than defining 9 | # the functions and macros. 10 | # 11 | # - The functions/macros defined in this file may depend on Google 12 | # Test and Google Mock's option() definitions, and thus must be 13 | # called *after* the options have been defined. 14 | 15 | # Tweaks CMake's default compiler/linker settings to suit Google Test's needs. 16 | # 17 | # This must be a macro(), as inside a function string() can only 18 | # update variables in the function scope. 19 | macro(fix_default_compiler_settings_) 20 | if (MSVC) 21 | # For MSVC, CMake sets certain flags to defaults we want to override. 22 | # This replacement code is taken from sample in the CMake Wiki at 23 | # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace. 24 | foreach (flag_var 25 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE 26 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) 27 | if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt) 28 | # When Google Test is built as a shared library, it should also use 29 | # shared runtime libraries. Otherwise, it may end up with multiple 30 | # copies of runtime library data in different modules, resulting in 31 | # hard-to-find crashes. When it is built as a static library, it is 32 | # preferable to use CRT as static libraries, as we don't have to rely 33 | # on CRT DLLs being available. CMake always defaults to using shared 34 | # CRT libraries, so we override that default here. 35 | string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}") 36 | endif() 37 | 38 | # We prefer more strict warning checking for building Google Test. 39 | # Replaces /W3 with /W4 in defaults. 40 | string(REPLACE "/W3" "-W4" ${flag_var} "${${flag_var}}") 41 | endforeach() 42 | endif() 43 | endmacro() 44 | 45 | # Defines the compiler/linker flags used to build Google Test and 46 | # Google Mock. You can tweak these definitions to suit your need. A 47 | # variable's value is empty before it's explicitly assigned to. 48 | macro(config_compiler_and_linker) 49 | if (NOT gtest_disable_pthreads) 50 | # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT. 51 | find_package(Threads) 52 | endif() 53 | 54 | fix_default_compiler_settings_() 55 | if (MSVC) 56 | # Newlines inside flags variables break CMake's NMake generator. 57 | # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds. 58 | set(cxx_base_flags "-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi") 59 | if (MSVC_VERSION LESS 1400) 60 | # Suppress spurious warnings MSVC 7.1 sometimes issues. 61 | # Forcing value to bool. 62 | set(cxx_base_flags "${cxx_base_flags} -wd4800") 63 | # Copy constructor and assignment operator could not be generated. 64 | set(cxx_base_flags "${cxx_base_flags} -wd4511 -wd4512") 65 | # Compatibility warnings not applicable to Google Test. 66 | # Resolved overload was found by argument-dependent lookup. 67 | set(cxx_base_flags "${cxx_base_flags} -wd4675") 68 | endif() 69 | set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32") 70 | set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN") 71 | set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1") 72 | set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0") 73 | set(cxx_no_rtti_flags "-GR-") 74 | elseif (CMAKE_COMPILER_IS_GNUCXX) 75 | set(cxx_base_flags "-Wall -Wshadow") 76 | set(cxx_exception_flags "-fexceptions") 77 | set(cxx_no_exception_flags "-fno-exceptions") 78 | # Until version 4.3.2, GCC doesn't define a macro to indicate 79 | # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI 80 | # explicitly. 81 | set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0") 82 | set(cxx_strict_flags 83 | "-Wextra -Wno-unused-parameter -Wno-missing-field-initializers") 84 | elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") 85 | set(cxx_exception_flags "-features=except") 86 | # Sun Pro doesn't provide macros to indicate whether exceptions and 87 | # RTTI are enabled, so we define GTEST_HAS_* explicitly. 88 | set(cxx_no_exception_flags "-features=no%except -DGTEST_HAS_EXCEPTIONS=0") 89 | set(cxx_no_rtti_flags "-features=no%rtti -DGTEST_HAS_RTTI=0") 90 | elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR 91 | CMAKE_CXX_COMPILER_ID STREQUAL "XL") 92 | # CMake 2.8 changes Visual Age's compiler ID to "XL". 93 | set(cxx_exception_flags "-qeh") 94 | set(cxx_no_exception_flags "-qnoeh") 95 | # Until version 9.0, Visual Age doesn't define a macro to indicate 96 | # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI 97 | # explicitly. 98 | set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0") 99 | elseif (CMAKE_CXX_COMPILER_ID STREQUAL "HP") 100 | set(cxx_base_flags "-AA -mt") 101 | set(cxx_exception_flags "-DGTEST_HAS_EXCEPTIONS=1") 102 | set(cxx_no_exception_flags "+noeh -DGTEST_HAS_EXCEPTIONS=0") 103 | # RTTI can not be disabled in HP aCC compiler. 104 | set(cxx_no_rtti_flags "") 105 | endif() 106 | 107 | if (CMAKE_USE_PTHREADS_INIT) # The pthreads library is available and allowed. 108 | set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=1") 109 | else() 110 | set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=0") 111 | endif() 112 | 113 | # For building gtest's own tests and samples. 114 | set(cxx_exception "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_exception_flags}") 115 | set(cxx_no_exception 116 | "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}") 117 | set(cxx_default "${cxx_exception}") 118 | set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}") 119 | set(cxx_use_own_tuple "${cxx_default} -DGTEST_USE_OWN_TR1_TUPLE=1") 120 | 121 | # For building the gtest libraries. 122 | set(cxx_strict "${cxx_default} ${cxx_strict_flags}") 123 | endmacro() 124 | 125 | # Defines the gtest & gtest_main libraries. User tests should link 126 | # with one of them. 127 | function(cxx_library_with_type name type cxx_flags) 128 | # type can be either STATIC or SHARED to denote a static or shared library. 129 | # ARGN refers to additional arguments after 'cxx_flags'. 130 | add_library(${name} ${type} ${ARGN}) 131 | set_target_properties(${name} 132 | PROPERTIES 133 | COMPILE_FLAGS "${cxx_flags}") 134 | #if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED") 135 | # set_target_properties(${name} 136 | # PROPERTIES 137 | # COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1") 138 | #endif() 139 | if (CMAKE_USE_PTHREADS_INIT) 140 | target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT}) 141 | endif() 142 | endfunction() 143 | 144 | ######################################################################## 145 | # 146 | # Helper functions for creating build targets. 147 | 148 | function(cxx_shared_library name cxx_flags) 149 | cxx_library_with_type(${name} SHARED "${cxx_flags}" ${ARGN}) 150 | endfunction() 151 | 152 | function(cxx_library name cxx_flags) 153 | cxx_library_with_type(${name} STATIC "${cxx_flags}" ${ARGN}) 154 | endfunction() 155 | 156 | # cxx_executable_with_flags(name cxx_flags libs srcs...) 157 | # 158 | # creates a named C++ executable that depends on the given libraries and 159 | # is built from the given source files with the given compiler flags. 160 | function(cxx_executable_with_flags name cxx_flags libs) 161 | add_executable(${name} ${ARGN}) 162 | if (cxx_flags) 163 | set_target_properties(${name} 164 | PROPERTIES 165 | COMPILE_FLAGS "${cxx_flags}") 166 | endif() 167 | if (BUILD_SHARED_LIBS) 168 | set_target_properties(${name} 169 | PROPERTIES 170 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") 171 | endif() 172 | # To support mixing linking in static and dynamic libraries, link each 173 | # library in with an extra call to target_link_libraries. 174 | foreach (lib "${libs}") 175 | target_link_libraries(${name} ${lib}) 176 | endforeach() 177 | endfunction() 178 | 179 | # cxx_executable(name dir lib srcs...) 180 | # 181 | # creates a named target that depends on the given libs and is built 182 | # from the given source files. dir/name.cc is implicitly included in 183 | # the source file list. 184 | function(cxx_executable name dir libs) 185 | cxx_executable_with_flags( 186 | ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN}) 187 | endfunction() 188 | 189 | # cxx_test_with_flags(name cxx_flags libs srcs...) 190 | # 191 | # creates a named C++ test that depends on the given libs and is built 192 | # from the given source files with the given compiler flags. 193 | function(cxx_test_with_flags name cxx_flags libs) 194 | cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN}) 195 | add_test(${name} ${name}) 196 | endfunction() 197 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/gtest-death-test.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 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file defines the public API for death tests. It is 35 | // #included by gtest.h so a user doesn't need to include this 36 | // directly. 37 | 38 | #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ 39 | #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ 40 | 41 | #include "gtest/internal/gtest-death-test-internal.h" 42 | 43 | namespace testing { 44 | 45 | // This flag controls the style of death tests. Valid values are "threadsafe", 46 | // meaning that the death test child process will re-execute the test binary 47 | // from the start, running only a single death test, or "fast", 48 | // meaning that the child process will execute the test logic immediately 49 | // after forking. 50 | GTEST_DECLARE_string_(death_test_style); 51 | 52 | #if GTEST_HAS_DEATH_TEST 53 | 54 | namespace internal { 55 | 56 | // Returns a Boolean value indicating whether the caller is currently 57 | // executing in the context of the death test child process. Tools such as 58 | // Valgrind heap checkers may need this to modify their behavior in death 59 | // tests. IMPORTANT: This is an internal utility. Using it may break the 60 | // implementation of death tests. User code MUST NOT use it. 61 | GTEST_API_ bool InDeathTestChild(); 62 | 63 | } // namespace internal 64 | 65 | // The following macros are useful for writing death tests. 66 | 67 | // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is 68 | // executed: 69 | // 70 | // 1. It generates a warning if there is more than one active 71 | // thread. This is because it's safe to fork() or clone() only 72 | // when there is a single thread. 73 | // 74 | // 2. The parent process clone()s a sub-process and runs the death 75 | // test in it; the sub-process exits with code 0 at the end of the 76 | // death test, if it hasn't exited already. 77 | // 78 | // 3. The parent process waits for the sub-process to terminate. 79 | // 80 | // 4. The parent process checks the exit code and error message of 81 | // the sub-process. 82 | // 83 | // Examples: 84 | // 85 | // ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number"); 86 | // for (int i = 0; i < 5; i++) { 87 | // EXPECT_DEATH(server.ProcessRequest(i), 88 | // "Invalid request .* in ProcessRequest()") 89 | // << "Failed to die on request " << i; 90 | // } 91 | // 92 | // ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting"); 93 | // 94 | // bool KilledBySIGHUP(int exit_code) { 95 | // return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP; 96 | // } 97 | // 98 | // ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!"); 99 | // 100 | // On the regular expressions used in death tests: 101 | // 102 | // On POSIX-compliant systems (*nix), we use the library, 103 | // which uses the POSIX extended regex syntax. 104 | // 105 | // On other platforms (e.g. Windows), we only support a simple regex 106 | // syntax implemented as part of Google Test. This limited 107 | // implementation should be enough most of the time when writing 108 | // death tests; though it lacks many features you can find in PCRE 109 | // or POSIX extended regex syntax. For example, we don't support 110 | // union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and 111 | // repetition count ("x{5,7}"), among others. 112 | // 113 | // Below is the syntax that we do support. We chose it to be a 114 | // subset of both PCRE and POSIX extended regex, so it's easy to 115 | // learn wherever you come from. In the following: 'A' denotes a 116 | // literal character, period (.), or a single \\ escape sequence; 117 | // 'x' and 'y' denote regular expressions; 'm' and 'n' are for 118 | // natural numbers. 119 | // 120 | // c matches any literal character c 121 | // \\d matches any decimal digit 122 | // \\D matches any character that's not a decimal digit 123 | // \\f matches \f 124 | // \\n matches \n 125 | // \\r matches \r 126 | // \\s matches any ASCII whitespace, including \n 127 | // \\S matches any character that's not a whitespace 128 | // \\t matches \t 129 | // \\v matches \v 130 | // \\w matches any letter, _, or decimal digit 131 | // \\W matches any character that \\w doesn't match 132 | // \\c matches any literal character c, which must be a punctuation 133 | // . matches any single character except \n 134 | // A? matches 0 or 1 occurrences of A 135 | // A* matches 0 or many occurrences of A 136 | // A+ matches 1 or many occurrences of A 137 | // ^ matches the beginning of a string (not that of each line) 138 | // $ matches the end of a string (not that of each line) 139 | // xy matches x followed by y 140 | // 141 | // If you accidentally use PCRE or POSIX extended regex features 142 | // not implemented by us, you will get a run-time failure. In that 143 | // case, please try to rewrite your regular expression within the 144 | // above syntax. 145 | // 146 | // This implementation is *not* meant to be as highly tuned or robust 147 | // as a compiled regex library, but should perform well enough for a 148 | // death test, which already incurs significant overhead by launching 149 | // a child process. 150 | // 151 | // Known caveats: 152 | // 153 | // A "threadsafe" style death test obtains the path to the test 154 | // program from argv[0] and re-executes it in the sub-process. For 155 | // simplicity, the current implementation doesn't search the PATH 156 | // when launching the sub-process. This means that the user must 157 | // invoke the test program via a path that contains at least one 158 | // path separator (e.g. path/to/foo_test and 159 | // /absolute/path/to/bar_test are fine, but foo_test is not). This 160 | // is rarely a problem as people usually don't put the test binary 161 | // directory in PATH. 162 | // 163 | // TODO(wan@google.com): make thread-safe death tests search the PATH. 164 | 165 | // Asserts that a given statement causes the program to exit, with an 166 | // integer exit status that satisfies predicate, and emitting error output 167 | // that matches regex. 168 | # define ASSERT_EXIT(statement, predicate, regex) \ 169 | GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_) 170 | 171 | // Like ASSERT_EXIT, but continues on to successive tests in the 172 | // test case, if any: 173 | # define EXPECT_EXIT(statement, predicate, regex) \ 174 | GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_) 175 | 176 | // Asserts that a given statement causes the program to exit, either by 177 | // explicitly exiting with a nonzero exit code or being killed by a 178 | // signal, and emitting error output that matches regex. 179 | # define ASSERT_DEATH(statement, regex) \ 180 | ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) 181 | 182 | // Like ASSERT_DEATH, but continues on to successive tests in the 183 | // test case, if any: 184 | # define EXPECT_DEATH(statement, regex) \ 185 | EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) 186 | 187 | // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*: 188 | 189 | // Tests that an exit code describes a normal exit with a given exit code. 190 | class GTEST_API_ ExitedWithCode { 191 | public: 192 | explicit ExitedWithCode(int exit_code); 193 | bool operator()(int exit_status) const; 194 | private: 195 | // No implementation - assignment is unsupported. 196 | void operator=(const ExitedWithCode& other); 197 | 198 | const int exit_code_; 199 | }; 200 | 201 | # if !GTEST_OS_WINDOWS 202 | // Tests that an exit code describes an exit due to termination by a 203 | // given signal. 204 | class GTEST_API_ KilledBySignal { 205 | public: 206 | explicit KilledBySignal(int signum); 207 | bool operator()(int exit_status) const; 208 | private: 209 | const int signum_; 210 | }; 211 | # endif // !GTEST_OS_WINDOWS 212 | 213 | // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode. 214 | // The death testing framework causes this to have interesting semantics, 215 | // since the sideeffects of the call are only visible in opt mode, and not 216 | // in debug mode. 217 | // 218 | // In practice, this can be used to test functions that utilize the 219 | // LOG(DFATAL) macro using the following style: 220 | // 221 | // int DieInDebugOr12(int* sideeffect) { 222 | // if (sideeffect) { 223 | // *sideeffect = 12; 224 | // } 225 | // LOG(DFATAL) << "death"; 226 | // return 12; 227 | // } 228 | // 229 | // TEST(TestCase, TestDieOr12WorksInDgbAndOpt) { 230 | // int sideeffect = 0; 231 | // // Only asserts in dbg. 232 | // EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death"); 233 | // 234 | // #ifdef NDEBUG 235 | // // opt-mode has sideeffect visible. 236 | // EXPECT_EQ(12, sideeffect); 237 | // #else 238 | // // dbg-mode no visible sideeffect. 239 | // EXPECT_EQ(0, sideeffect); 240 | // #endif 241 | // } 242 | // 243 | // This will assert that DieInDebugReturn12InOpt() crashes in debug 244 | // mode, usually due to a DCHECK or LOG(DFATAL), but returns the 245 | // appropriate fallback value (12 in this case) in opt mode. If you 246 | // need to test that a function has appropriate side-effects in opt 247 | // mode, include assertions against the side-effects. A general 248 | // pattern for this is: 249 | // 250 | // EXPECT_DEBUG_DEATH({ 251 | // // Side-effects here will have an effect after this statement in 252 | // // opt mode, but none in debug mode. 253 | // EXPECT_EQ(12, DieInDebugOr12(&sideeffect)); 254 | // }, "death"); 255 | // 256 | # ifdef NDEBUG 257 | 258 | # define EXPECT_DEBUG_DEATH(statement, regex) \ 259 | GTEST_EXECUTE_STATEMENT_(statement, regex) 260 | 261 | # define ASSERT_DEBUG_DEATH(statement, regex) \ 262 | GTEST_EXECUTE_STATEMENT_(statement, regex) 263 | 264 | # else 265 | 266 | # define EXPECT_DEBUG_DEATH(statement, regex) \ 267 | EXPECT_DEATH(statement, regex) 268 | 269 | # define ASSERT_DEBUG_DEATH(statement, regex) \ 270 | ASSERT_DEATH(statement, regex) 271 | 272 | # endif // NDEBUG for EXPECT_DEBUG_DEATH 273 | #endif // GTEST_HAS_DEATH_TEST 274 | 275 | // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and 276 | // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if 277 | // death tests are supported; otherwise they just issue a warning. This is 278 | // useful when you are combining death test assertions with normal test 279 | // assertions in one test. 280 | #if GTEST_HAS_DEATH_TEST 281 | # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ 282 | EXPECT_DEATH(statement, regex) 283 | # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ 284 | ASSERT_DEATH(statement, regex) 285 | #else 286 | # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ 287 | GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, ) 288 | # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ 289 | GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return) 290 | #endif 291 | 292 | } // namespace testing 293 | 294 | #endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ 295 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/gtest-message.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 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file defines the Message class. 35 | // 36 | // IMPORTANT NOTE: Due to limitation of the C++ language, we have to 37 | // leave some internal implementation details in this header file. 38 | // They are clearly marked by comments like this: 39 | // 40 | // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. 41 | // 42 | // Such code is NOT meant to be used by a user directly, and is subject 43 | // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user 44 | // program! 45 | 46 | #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ 47 | #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ 48 | 49 | #include 50 | 51 | #include "gtest/internal/gtest-port.h" 52 | 53 | // Ensures that there is at least one operator<< in the global namespace. 54 | // See Message& operator<<(...) below for why. 55 | void operator<<(const testing::internal::Secret&, int); 56 | 57 | namespace testing { 58 | 59 | // The Message class works like an ostream repeater. 60 | // 61 | // Typical usage: 62 | // 63 | // 1. You stream a bunch of values to a Message object. 64 | // It will remember the text in a stringstream. 65 | // 2. Then you stream the Message object to an ostream. 66 | // This causes the text in the Message to be streamed 67 | // to the ostream. 68 | // 69 | // For example; 70 | // 71 | // testing::Message foo; 72 | // foo << 1 << " != " << 2; 73 | // std::cout << foo; 74 | // 75 | // will print "1 != 2". 76 | // 77 | // Message is not intended to be inherited from. In particular, its 78 | // destructor is not virtual. 79 | // 80 | // Note that stringstream behaves differently in gcc and in MSVC. You 81 | // can stream a NULL char pointer to it in the former, but not in the 82 | // latter (it causes an access violation if you do). The Message 83 | // class hides this difference by treating a NULL char pointer as 84 | // "(null)". 85 | class GTEST_API_ Message { 86 | private: 87 | // The type of basic IO manipulators (endl, ends, and flush) for 88 | // narrow streams. 89 | typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); 90 | 91 | public: 92 | // Constructs an empty Message. 93 | Message(); 94 | 95 | // Copy constructor. 96 | Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT 97 | *ss_ << msg.GetString(); 98 | } 99 | 100 | // Constructs a Message from a C-string. 101 | explicit Message(const char* str) : ss_(new ::std::stringstream) { 102 | *ss_ << str; 103 | } 104 | 105 | #if GTEST_OS_SYMBIAN 106 | // Streams a value (either a pointer or not) to this object. 107 | template 108 | inline Message& operator <<(const T& value) { 109 | StreamHelper(typename internal::is_pointer::type(), value); 110 | return *this; 111 | } 112 | #else 113 | // Streams a non-pointer value to this object. 114 | template 115 | inline Message& operator <<(const T& val) { 116 | // Some libraries overload << for STL containers. These 117 | // overloads are defined in the global namespace instead of ::std. 118 | // 119 | // C++'s symbol lookup rule (i.e. Koenig lookup) says that these 120 | // overloads are visible in either the std namespace or the global 121 | // namespace, but not other namespaces, including the testing 122 | // namespace which Google Test's Message class is in. 123 | // 124 | // To allow STL containers (and other types that has a << operator 125 | // defined in the global namespace) to be used in Google Test 126 | // assertions, testing::Message must access the custom << operator 127 | // from the global namespace. With this using declaration, 128 | // overloads of << defined in the global namespace and those 129 | // visible via Koenig lookup are both exposed in this function. 130 | using ::operator <<; 131 | *ss_ << val; 132 | return *this; 133 | } 134 | 135 | // Streams a pointer value to this object. 136 | // 137 | // This function is an overload of the previous one. When you 138 | // stream a pointer to a Message, this definition will be used as it 139 | // is more specialized. (The C++ Standard, section 140 | // [temp.func.order].) If you stream a non-pointer, then the 141 | // previous definition will be used. 142 | // 143 | // The reason for this overload is that streaming a NULL pointer to 144 | // ostream is undefined behavior. Depending on the compiler, you 145 | // may get "0", "(nil)", "(null)", or an access violation. To 146 | // ensure consistent result across compilers, we always treat NULL 147 | // as "(null)". 148 | template 149 | inline Message& operator <<(T* const& pointer) { // NOLINT 150 | if (pointer == NULL) { 151 | *ss_ << "(null)"; 152 | } else { 153 | *ss_ << pointer; 154 | } 155 | return *this; 156 | } 157 | #endif // GTEST_OS_SYMBIAN 158 | 159 | // Since the basic IO manipulators are overloaded for both narrow 160 | // and wide streams, we have to provide this specialized definition 161 | // of operator <<, even though its body is the same as the 162 | // templatized version above. Without this definition, streaming 163 | // endl or other basic IO manipulators to Message will confuse the 164 | // compiler. 165 | Message& operator <<(BasicNarrowIoManip val) { 166 | *ss_ << val; 167 | return *this; 168 | } 169 | 170 | // Instead of 1/0, we want to see true/false for bool values. 171 | Message& operator <<(bool b) { 172 | return *this << (b ? "true" : "false"); 173 | } 174 | 175 | // These two overloads allow streaming a wide C string to a Message 176 | // using the UTF-8 encoding. 177 | Message& operator <<(const wchar_t* wide_c_str); 178 | Message& operator <<(wchar_t* wide_c_str); 179 | 180 | #if GTEST_HAS_STD_WSTRING 181 | // Converts the given wide string to a narrow string using the UTF-8 182 | // encoding, and streams the result to this Message object. 183 | Message& operator <<(const ::std::wstring& wstr); 184 | #endif // GTEST_HAS_STD_WSTRING 185 | 186 | #if GTEST_HAS_GLOBAL_WSTRING 187 | // Converts the given wide string to a narrow string using the UTF-8 188 | // encoding, and streams the result to this Message object. 189 | Message& operator <<(const ::wstring& wstr); 190 | #endif // GTEST_HAS_GLOBAL_WSTRING 191 | 192 | // Gets the text streamed to this object so far as an std::string. 193 | // Each '\0' character in the buffer is replaced with "\\0". 194 | // 195 | // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. 196 | std::string GetString() const; 197 | 198 | private: 199 | 200 | #if GTEST_OS_SYMBIAN 201 | // These are needed as the Nokia Symbian Compiler cannot decide between 202 | // const T& and const T* in a function template. The Nokia compiler _can_ 203 | // decide between class template specializations for T and T*, so a 204 | // tr1::type_traits-like is_pointer works, and we can overload on that. 205 | template 206 | inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) { 207 | if (pointer == NULL) { 208 | *ss_ << "(null)"; 209 | } else { 210 | *ss_ << pointer; 211 | } 212 | } 213 | template 214 | inline void StreamHelper(internal::false_type /*is_pointer*/, 215 | const T& value) { 216 | // See the comments in Message& operator <<(const T&) above for why 217 | // we need this using statement. 218 | using ::operator <<; 219 | *ss_ << value; 220 | } 221 | #endif // GTEST_OS_SYMBIAN 222 | 223 | // We'll hold the text streamed to this object here. 224 | const internal::scoped_ptr< ::std::stringstream> ss_; 225 | 226 | // We declare (but don't implement) this to prevent the compiler 227 | // from implementing the assignment operator. 228 | void operator=(const Message&); 229 | }; 230 | 231 | // Streams a Message to an ostream. 232 | inline std::ostream& operator <<(std::ostream& os, const Message& sb) { 233 | return os << sb.GetString(); 234 | } 235 | 236 | namespace internal { 237 | 238 | // Converts a streamable value to an std::string. A NULL pointer is 239 | // converted to "(null)". When the input value is a ::string, 240 | // ::std::string, ::wstring, or ::std::wstring object, each NUL 241 | // character in it is replaced with "\\0". 242 | template 243 | std::string StreamableToString(const T& streamable) { 244 | return (Message() << streamable).GetString(); 245 | } 246 | 247 | } // namespace internal 248 | } // namespace testing 249 | 250 | #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ 251 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/gtest-spi.h: -------------------------------------------------------------------------------- 1 | // Copyright 2007, 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: wan@google.com (Zhanyong Wan) 31 | // 32 | // Utilities for testing Google Test itself and code that uses Google Test 33 | // (e.g. frameworks built on top of Google Test). 34 | 35 | #ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_ 36 | #define GTEST_INCLUDE_GTEST_GTEST_SPI_H_ 37 | 38 | #include "gtest/gtest.h" 39 | 40 | namespace testing { 41 | 42 | // This helper class can be used to mock out Google Test failure reporting 43 | // so that we can test Google Test or code that builds on Google Test. 44 | // 45 | // An object of this class appends a TestPartResult object to the 46 | // TestPartResultArray object given in the constructor whenever a Google Test 47 | // failure is reported. It can either intercept only failures that are 48 | // generated in the same thread that created this object or it can intercept 49 | // all generated failures. The scope of this mock object can be controlled with 50 | // the second argument to the two arguments constructor. 51 | class GTEST_API_ ScopedFakeTestPartResultReporter 52 | : public TestPartResultReporterInterface { 53 | public: 54 | // The two possible mocking modes of this object. 55 | enum InterceptMode { 56 | INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures. 57 | INTERCEPT_ALL_THREADS // Intercepts all failures. 58 | }; 59 | 60 | // The c'tor sets this object as the test part result reporter used 61 | // by Google Test. The 'result' parameter specifies where to report the 62 | // results. This reporter will only catch failures generated in the current 63 | // thread. DEPRECATED 64 | explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result); 65 | 66 | // Same as above, but you can choose the interception scope of this object. 67 | ScopedFakeTestPartResultReporter(InterceptMode intercept_mode, 68 | TestPartResultArray* result); 69 | 70 | // The d'tor restores the previous test part result reporter. 71 | virtual ~ScopedFakeTestPartResultReporter(); 72 | 73 | // Appends the TestPartResult object to the TestPartResultArray 74 | // received in the constructor. 75 | // 76 | // This method is from the TestPartResultReporterInterface 77 | // interface. 78 | virtual void ReportTestPartResult(const TestPartResult& result); 79 | private: 80 | void Init(); 81 | 82 | const InterceptMode intercept_mode_; 83 | TestPartResultReporterInterface* old_reporter_; 84 | TestPartResultArray* const result_; 85 | 86 | GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); 87 | }; 88 | 89 | namespace internal { 90 | 91 | // A helper class for implementing EXPECT_FATAL_FAILURE() and 92 | // EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given 93 | // TestPartResultArray contains exactly one failure that has the given 94 | // type and contains the given substring. If that's not the case, a 95 | // non-fatal failure will be generated. 96 | class GTEST_API_ SingleFailureChecker { 97 | public: 98 | // The constructor remembers the arguments. 99 | SingleFailureChecker(const TestPartResultArray* results, 100 | TestPartResult::Type type, 101 | const string& substr); 102 | ~SingleFailureChecker(); 103 | private: 104 | const TestPartResultArray* const results_; 105 | const TestPartResult::Type type_; 106 | const string substr_; 107 | 108 | GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); 109 | }; 110 | 111 | } // namespace internal 112 | 113 | } // namespace testing 114 | 115 | // A set of macros for testing Google Test assertions or code that's expected 116 | // to generate Google Test fatal failures. It verifies that the given 117 | // statement will cause exactly one fatal Google Test failure with 'substr' 118 | // being part of the failure message. 119 | // 120 | // There are two different versions of this macro. EXPECT_FATAL_FAILURE only 121 | // affects and considers failures generated in the current thread and 122 | // EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. 123 | // 124 | // The verification of the assertion is done correctly even when the statement 125 | // throws an exception or aborts the current function. 126 | // 127 | // Known restrictions: 128 | // - 'statement' cannot reference local non-static variables or 129 | // non-static members of the current object. 130 | // - 'statement' cannot return a value. 131 | // - You cannot stream a failure message to this macro. 132 | // 133 | // Note that even though the implementations of the following two 134 | // macros are much alike, we cannot refactor them to use a common 135 | // helper macro, due to some peculiarity in how the preprocessor 136 | // works. The AcceptsMacroThatExpandsToUnprotectedComma test in 137 | // gtest_unittest.cc will fail to compile if we do that. 138 | #define EXPECT_FATAL_FAILURE(statement, substr) \ 139 | do { \ 140 | class GTestExpectFatalFailureHelper {\ 141 | public:\ 142 | static void Execute() { statement; }\ 143 | };\ 144 | ::testing::TestPartResultArray gtest_failures;\ 145 | ::testing::internal::SingleFailureChecker gtest_checker(\ 146 | >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ 147 | {\ 148 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 149 | ::testing::ScopedFakeTestPartResultReporter:: \ 150 | INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ 151 | GTestExpectFatalFailureHelper::Execute();\ 152 | }\ 153 | } while (::testing::internal::AlwaysFalse()) 154 | 155 | #define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ 156 | do { \ 157 | class GTestExpectFatalFailureHelper {\ 158 | public:\ 159 | static void Execute() { statement; }\ 160 | };\ 161 | ::testing::TestPartResultArray gtest_failures;\ 162 | ::testing::internal::SingleFailureChecker gtest_checker(\ 163 | >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ 164 | {\ 165 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 166 | ::testing::ScopedFakeTestPartResultReporter:: \ 167 | INTERCEPT_ALL_THREADS, >est_failures);\ 168 | GTestExpectFatalFailureHelper::Execute();\ 169 | }\ 170 | } while (::testing::internal::AlwaysFalse()) 171 | 172 | // A macro for testing Google Test assertions or code that's expected to 173 | // generate Google Test non-fatal failures. It asserts that the given 174 | // statement will cause exactly one non-fatal Google Test failure with 'substr' 175 | // being part of the failure message. 176 | // 177 | // There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only 178 | // affects and considers failures generated in the current thread and 179 | // EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. 180 | // 181 | // 'statement' is allowed to reference local variables and members of 182 | // the current object. 183 | // 184 | // The verification of the assertion is done correctly even when the statement 185 | // throws an exception or aborts the current function. 186 | // 187 | // Known restrictions: 188 | // - You cannot stream a failure message to this macro. 189 | // 190 | // Note that even though the implementations of the following two 191 | // macros are much alike, we cannot refactor them to use a common 192 | // helper macro, due to some peculiarity in how the preprocessor 193 | // works. If we do that, the code won't compile when the user gives 194 | // EXPECT_NONFATAL_FAILURE() a statement that contains a macro that 195 | // expands to code containing an unprotected comma. The 196 | // AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc 197 | // catches that. 198 | // 199 | // For the same reason, we have to write 200 | // if (::testing::internal::AlwaysTrue()) { statement; } 201 | // instead of 202 | // GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) 203 | // to avoid an MSVC warning on unreachable code. 204 | #define EXPECT_NONFATAL_FAILURE(statement, substr) \ 205 | do {\ 206 | ::testing::TestPartResultArray gtest_failures;\ 207 | ::testing::internal::SingleFailureChecker gtest_checker(\ 208 | >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ 209 | (substr));\ 210 | {\ 211 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 212 | ::testing::ScopedFakeTestPartResultReporter:: \ 213 | INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ 214 | if (::testing::internal::AlwaysTrue()) { statement; }\ 215 | }\ 216 | } while (::testing::internal::AlwaysFalse()) 217 | 218 | #define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ 219 | do {\ 220 | ::testing::TestPartResultArray gtest_failures;\ 221 | ::testing::internal::SingleFailureChecker gtest_checker(\ 222 | >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ 223 | (substr));\ 224 | {\ 225 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ 226 | ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ 227 | >est_failures);\ 228 | if (::testing::internal::AlwaysTrue()) { statement; }\ 229 | }\ 230 | } while (::testing::internal::AlwaysFalse()) 231 | 232 | #endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ 233 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/gtest-test-part.h: -------------------------------------------------------------------------------- 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 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | 33 | #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ 34 | #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ 35 | 36 | #include 37 | #include 38 | #include "gtest/internal/gtest-internal.h" 39 | #include "gtest/internal/gtest-string.h" 40 | 41 | namespace testing { 42 | 43 | // A copyable object representing the result of a test part (i.e. an 44 | // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). 45 | // 46 | // Don't inherit from TestPartResult as its destructor is not virtual. 47 | class GTEST_API_ TestPartResult { 48 | public: 49 | // The possible outcomes of a test part (i.e. an assertion or an 50 | // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). 51 | enum Type { 52 | kSuccess, // Succeeded. 53 | kNonFatalFailure, // Failed but the test can continue. 54 | kFatalFailure // Failed and the test should be terminated. 55 | }; 56 | 57 | // C'tor. TestPartResult does NOT have a default constructor. 58 | // Always use this constructor (with parameters) to create a 59 | // TestPartResult object. 60 | TestPartResult(Type a_type, 61 | const char* a_file_name, 62 | int a_line_number, 63 | const char* a_message) 64 | : type_(a_type), 65 | file_name_(a_file_name == NULL ? "" : a_file_name), 66 | line_number_(a_line_number), 67 | summary_(ExtractSummary(a_message)), 68 | message_(a_message) { 69 | } 70 | 71 | // Gets the outcome of the test part. 72 | Type type() const { return type_; } 73 | 74 | // Gets the name of the source file where the test part took place, or 75 | // NULL if it's unknown. 76 | const char* file_name() const { 77 | return file_name_.empty() ? NULL : file_name_.c_str(); 78 | } 79 | 80 | // Gets the line in the source file where the test part took place, 81 | // or -1 if it's unknown. 82 | int line_number() const { return line_number_; } 83 | 84 | // Gets the summary of the failure message. 85 | const char* summary() const { return summary_.c_str(); } 86 | 87 | // Gets the message associated with the test part. 88 | const char* message() const { return message_.c_str(); } 89 | 90 | // Returns true iff the test part passed. 91 | bool passed() const { return type_ == kSuccess; } 92 | 93 | // Returns true iff the test part failed. 94 | bool failed() const { return type_ != kSuccess; } 95 | 96 | // Returns true iff the test part non-fatally failed. 97 | bool nonfatally_failed() const { return type_ == kNonFatalFailure; } 98 | 99 | // Returns true iff the test part fatally failed. 100 | bool fatally_failed() const { return type_ == kFatalFailure; } 101 | 102 | private: 103 | Type type_; 104 | 105 | // Gets the summary of the failure message by omitting the stack 106 | // trace in it. 107 | static std::string ExtractSummary(const char* message); 108 | 109 | // The name of the source file where the test part took place, or 110 | // "" if the source file is unknown. 111 | std::string file_name_; 112 | // The line in the source file where the test part took place, or -1 113 | // if the line number is unknown. 114 | int line_number_; 115 | std::string summary_; // The test failure summary. 116 | std::string message_; // The test failure message. 117 | }; 118 | 119 | // Prints a TestPartResult object. 120 | std::ostream& operator<<(std::ostream& os, const TestPartResult& result); 121 | 122 | // An array of TestPartResult objects. 123 | // 124 | // Don't inherit from TestPartResultArray as its destructor is not 125 | // virtual. 126 | class GTEST_API_ TestPartResultArray { 127 | public: 128 | TestPartResultArray() {} 129 | 130 | // Appends the given TestPartResult to the array. 131 | void Append(const TestPartResult& result); 132 | 133 | // Returns the TestPartResult at the given index (0-based). 134 | const TestPartResult& GetTestPartResult(int index) const; 135 | 136 | // Returns the number of TestPartResult objects in the array. 137 | int size() const; 138 | 139 | private: 140 | std::vector array_; 141 | 142 | GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); 143 | }; 144 | 145 | // This interface knows how to report a test part result. 146 | class TestPartResultReporterInterface { 147 | public: 148 | virtual ~TestPartResultReporterInterface() {} 149 | 150 | virtual void ReportTestPartResult(const TestPartResult& result) = 0; 151 | }; 152 | 153 | namespace internal { 154 | 155 | // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a 156 | // statement generates new fatal failures. To do so it registers itself as the 157 | // current test part result reporter. Besides checking if fatal failures were 158 | // reported, it only delegates the reporting to the former result reporter. 159 | // The original result reporter is restored in the destructor. 160 | // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. 161 | class GTEST_API_ HasNewFatalFailureHelper 162 | : public TestPartResultReporterInterface { 163 | public: 164 | HasNewFatalFailureHelper(); 165 | virtual ~HasNewFatalFailureHelper(); 166 | virtual void ReportTestPartResult(const TestPartResult& result); 167 | bool has_new_fatal_failure() const { return has_new_fatal_failure_; } 168 | private: 169 | bool has_new_fatal_failure_; 170 | TestPartResultReporterInterface* original_reporter_; 171 | 172 | GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper); 173 | }; 174 | 175 | } // namespace internal 176 | 177 | } // namespace testing 178 | 179 | #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ 180 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/gtest-typed-test.h: -------------------------------------------------------------------------------- 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 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ 33 | #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ 34 | 35 | // This header implements typed tests and type-parameterized tests. 36 | 37 | // Typed (aka type-driven) tests repeat the same test for types in a 38 | // list. You must know which types you want to test with when writing 39 | // typed tests. Here's how you do it: 40 | 41 | #if 0 42 | 43 | // First, define a fixture class template. It should be parameterized 44 | // by a type. Remember to derive it from testing::Test. 45 | template 46 | class FooTest : public testing::Test { 47 | public: 48 | ... 49 | typedef std::list List; 50 | static T shared_; 51 | T value_; 52 | }; 53 | 54 | // Next, associate a list of types with the test case, which will be 55 | // repeated for each type in the list. The typedef is necessary for 56 | // the macro to parse correctly. 57 | typedef testing::Types MyTypes; 58 | TYPED_TEST_CASE(FooTest, MyTypes); 59 | 60 | // If the type list contains only one type, you can write that type 61 | // directly without Types<...>: 62 | // TYPED_TEST_CASE(FooTest, int); 63 | 64 | // Then, use TYPED_TEST() instead of TEST_F() to define as many typed 65 | // tests for this test case as you want. 66 | TYPED_TEST(FooTest, DoesBlah) { 67 | // Inside a test, refer to TypeParam to get the type parameter. 68 | // Since we are inside a derived class template, C++ requires use to 69 | // visit the members of FooTest via 'this'. 70 | TypeParam n = this->value_; 71 | 72 | // To visit static members of the fixture, add the TestFixture:: 73 | // prefix. 74 | n += TestFixture::shared_; 75 | 76 | // To refer to typedefs in the fixture, add the "typename 77 | // TestFixture::" prefix. 78 | typename TestFixture::List values; 79 | values.push_back(n); 80 | ... 81 | } 82 | 83 | TYPED_TEST(FooTest, HasPropertyA) { ... } 84 | 85 | #endif // 0 86 | 87 | // Type-parameterized tests are abstract test patterns parameterized 88 | // by a type. Compared with typed tests, type-parameterized tests 89 | // allow you to define the test pattern without knowing what the type 90 | // parameters are. The defined pattern can be instantiated with 91 | // different types any number of times, in any number of translation 92 | // units. 93 | // 94 | // If you are designing an interface or concept, you can define a 95 | // suite of type-parameterized tests to verify properties that any 96 | // valid implementation of the interface/concept should have. Then, 97 | // each implementation can easily instantiate the test suite to verify 98 | // that it conforms to the requirements, without having to write 99 | // similar tests repeatedly. Here's an example: 100 | 101 | #if 0 102 | 103 | // First, define a fixture class template. It should be parameterized 104 | // by a type. Remember to derive it from testing::Test. 105 | template 106 | class FooTest : public testing::Test { 107 | ... 108 | }; 109 | 110 | // Next, declare that you will define a type-parameterized test case 111 | // (the _P suffix is for "parameterized" or "pattern", whichever you 112 | // prefer): 113 | TYPED_TEST_CASE_P(FooTest); 114 | 115 | // Then, use TYPED_TEST_P() to define as many type-parameterized tests 116 | // for this type-parameterized test case as you want. 117 | TYPED_TEST_P(FooTest, DoesBlah) { 118 | // Inside a test, refer to TypeParam to get the type parameter. 119 | TypeParam n = 0; 120 | ... 121 | } 122 | 123 | TYPED_TEST_P(FooTest, HasPropertyA) { ... } 124 | 125 | // Now the tricky part: you need to register all test patterns before 126 | // you can instantiate them. The first argument of the macro is the 127 | // test case name; the rest are the names of the tests in this test 128 | // case. 129 | REGISTER_TYPED_TEST_CASE_P(FooTest, 130 | DoesBlah, HasPropertyA); 131 | 132 | // Finally, you are free to instantiate the pattern with the types you 133 | // want. If you put the above code in a header file, you can #include 134 | // it in multiple C++ source files and instantiate it multiple times. 135 | // 136 | // To distinguish different instances of the pattern, the first 137 | // argument to the INSTANTIATE_* macro is a prefix that will be added 138 | // to the actual test case name. Remember to pick unique prefixes for 139 | // different instances. 140 | typedef testing::Types MyTypes; 141 | INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes); 142 | 143 | // If the type list contains only one type, you can write that type 144 | // directly without Types<...>: 145 | // INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int); 146 | 147 | #endif // 0 148 | 149 | #include "gtest/internal/gtest-port.h" 150 | #include "gtest/internal/gtest-type-util.h" 151 | 152 | // Implements typed tests. 153 | 154 | #if GTEST_HAS_TYPED_TEST 155 | 156 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. 157 | // 158 | // Expands to the name of the typedef for the type parameters of the 159 | // given test case. 160 | # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_ 161 | 162 | // The 'Types' template argument below must have spaces around it 163 | // since some compilers may choke on '>>' when passing a template 164 | // instance (e.g. Types) 165 | # define TYPED_TEST_CASE(CaseName, Types) \ 166 | typedef ::testing::internal::TypeList< Types >::type \ 167 | GTEST_TYPE_PARAMS_(CaseName) 168 | 169 | # define TYPED_TEST(CaseName, TestName) \ 170 | template \ 171 | class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ 172 | : public CaseName { \ 173 | private: \ 174 | typedef CaseName TestFixture; \ 175 | typedef gtest_TypeParam_ TypeParam; \ 176 | virtual void TestBody(); \ 177 | }; \ 178 | bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \ 179 | ::testing::internal::TypeParameterizedTest< \ 180 | CaseName, \ 181 | ::testing::internal::TemplateSel< \ 182 | GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \ 183 | GTEST_TYPE_PARAMS_(CaseName)>::Register(\ 184 | "", #CaseName, #TestName, 0); \ 185 | template \ 186 | void GTEST_TEST_CLASS_NAME_(CaseName, TestName)::TestBody() 187 | 188 | #endif // GTEST_HAS_TYPED_TEST 189 | 190 | // Implements type-parameterized tests. 191 | 192 | #if GTEST_HAS_TYPED_TEST_P 193 | 194 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. 195 | // 196 | // Expands to the namespace name that the type-parameterized tests for 197 | // the given type-parameterized test case are defined in. The exact 198 | // name of the namespace is subject to change without notice. 199 | # define GTEST_CASE_NAMESPACE_(TestCaseName) \ 200 | gtest_case_##TestCaseName##_ 201 | 202 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. 203 | // 204 | // Expands to the name of the variable used to remember the names of 205 | // the defined tests in the given test case. 206 | # define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \ 207 | gtest_typed_test_case_p_state_##TestCaseName##_ 208 | 209 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY. 210 | // 211 | // Expands to the name of the variable used to remember the names of 212 | // the registered tests in the given test case. 213 | # define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \ 214 | gtest_registered_test_names_##TestCaseName##_ 215 | 216 | // The variables defined in the type-parameterized test macros are 217 | // static as typically these macros are used in a .h file that can be 218 | // #included in multiple translation units linked together. 219 | # define TYPED_TEST_CASE_P(CaseName) \ 220 | static ::testing::internal::TypedTestCasePState \ 221 | GTEST_TYPED_TEST_CASE_P_STATE_(CaseName) 222 | 223 | # define TYPED_TEST_P(CaseName, TestName) \ 224 | namespace GTEST_CASE_NAMESPACE_(CaseName) { \ 225 | template \ 226 | class TestName : public CaseName { \ 227 | private: \ 228 | typedef CaseName TestFixture; \ 229 | typedef gtest_TypeParam_ TypeParam; \ 230 | virtual void TestBody(); \ 231 | }; \ 232 | static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ 233 | GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\ 234 | __FILE__, __LINE__, #CaseName, #TestName); \ 235 | } \ 236 | template \ 237 | void GTEST_CASE_NAMESPACE_(CaseName)::TestName::TestBody() 238 | 239 | # define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \ 240 | namespace GTEST_CASE_NAMESPACE_(CaseName) { \ 241 | typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \ 242 | } \ 243 | static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \ 244 | GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\ 245 | __FILE__, __LINE__, #__VA_ARGS__) 246 | 247 | // The 'Types' template argument below must have spaces around it 248 | // since some compilers may choke on '>>' when passing a template 249 | // instance (e.g. Types) 250 | # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \ 251 | bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \ 252 | ::testing::internal::TypeParameterizedTestCase::type>::Register(\ 255 | #Prefix, #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName)) 256 | 257 | #endif // GTEST_HAS_TYPED_TEST_P 258 | 259 | #endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ 260 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 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 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/internal/gtest-filepath.h: -------------------------------------------------------------------------------- 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 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // Google Test filepath utilities 33 | // 34 | // This header file declares classes and functions used internally by 35 | // Google Test. They are subject to change without notice. 36 | // 37 | // This file is #included in . 38 | // Do not include this header file separately! 39 | 40 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ 41 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ 42 | 43 | #include "gtest/internal/gtest-string.h" 44 | 45 | namespace testing { 46 | namespace internal { 47 | 48 | // FilePath - a class for file and directory pathname manipulation which 49 | // handles platform-specific conventions (like the pathname separator). 50 | // Used for helper functions for naming files in a directory for xml output. 51 | // Except for Set methods, all methods are const or static, which provides an 52 | // "immutable value object" -- useful for peace of mind. 53 | // A FilePath with a value ending in a path separator ("like/this/") represents 54 | // a directory, otherwise it is assumed to represent a file. In either case, 55 | // it may or may not represent an actual file or directory in the file system. 56 | // Names are NOT checked for syntax correctness -- no checking for illegal 57 | // characters, malformed paths, etc. 58 | 59 | class GTEST_API_ FilePath { 60 | public: 61 | FilePath() : pathname_("") { } 62 | FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } 63 | 64 | explicit FilePath(const std::string& pathname) : pathname_(pathname) { 65 | Normalize(); 66 | } 67 | 68 | FilePath& operator=(const FilePath& rhs) { 69 | Set(rhs); 70 | return *this; 71 | } 72 | 73 | void Set(const FilePath& rhs) { 74 | pathname_ = rhs.pathname_; 75 | } 76 | 77 | const std::string& string() const { return pathname_; } 78 | const char* c_str() const { return pathname_.c_str(); } 79 | 80 | // Returns the current working directory, or "" if unsuccessful. 81 | static FilePath GetCurrentDir(); 82 | 83 | // Given directory = "dir", base_name = "test", number = 0, 84 | // extension = "xml", returns "dir/test.xml". If number is greater 85 | // than zero (e.g., 12), returns "dir/test_12.xml". 86 | // On Windows platform, uses \ as the separator rather than /. 87 | static FilePath MakeFileName(const FilePath& directory, 88 | const FilePath& base_name, 89 | int number, 90 | const char* extension); 91 | 92 | // Given directory = "dir", relative_path = "test.xml", 93 | // returns "dir/test.xml". 94 | // On Windows, uses \ as the separator rather than /. 95 | static FilePath ConcatPaths(const FilePath& directory, 96 | const FilePath& relative_path); 97 | 98 | // Returns a pathname for a file that does not currently exist. The pathname 99 | // will be directory/base_name.extension or 100 | // directory/base_name_.extension if directory/base_name.extension 101 | // already exists. The number will be incremented until a pathname is found 102 | // that does not already exist. 103 | // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. 104 | // There could be a race condition if two or more processes are calling this 105 | // function at the same time -- they could both pick the same filename. 106 | static FilePath GenerateUniqueFileName(const FilePath& directory, 107 | const FilePath& base_name, 108 | const char* extension); 109 | 110 | // Returns true iff the path is "". 111 | bool IsEmpty() const { return pathname_.empty(); } 112 | 113 | // If input name has a trailing separator character, removes it and returns 114 | // the name, otherwise return the name string unmodified. 115 | // On Windows platform, uses \ as the separator, other platforms use /. 116 | FilePath RemoveTrailingPathSeparator() const; 117 | 118 | // Returns a copy of the FilePath with the directory part removed. 119 | // Example: FilePath("path/to/file").RemoveDirectoryName() returns 120 | // FilePath("file"). If there is no directory part ("just_a_file"), it returns 121 | // the FilePath unmodified. If there is no file part ("just_a_dir/") it 122 | // returns an empty FilePath (""). 123 | // On Windows platform, '\' is the path separator, otherwise it is '/'. 124 | FilePath RemoveDirectoryName() const; 125 | 126 | // RemoveFileName returns the directory path with the filename removed. 127 | // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". 128 | // If the FilePath is "a_file" or "/a_file", RemoveFileName returns 129 | // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does 130 | // not have a file, like "just/a/dir/", it returns the FilePath unmodified. 131 | // On Windows platform, '\' is the path separator, otherwise it is '/'. 132 | FilePath RemoveFileName() const; 133 | 134 | // Returns a copy of the FilePath with the case-insensitive extension removed. 135 | // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns 136 | // FilePath("dir/file"). If a case-insensitive extension is not 137 | // found, returns a copy of the original FilePath. 138 | FilePath RemoveExtension(const char* extension) const; 139 | 140 | // Creates directories so that path exists. Returns true if successful or if 141 | // the directories already exist; returns false if unable to create 142 | // directories for any reason. Will also return false if the FilePath does 143 | // not represent a directory (that is, it doesn't end with a path separator). 144 | bool CreateDirectoriesRecursively() const; 145 | 146 | // Create the directory so that path exists. Returns true if successful or 147 | // if the directory already exists; returns false if unable to create the 148 | // directory for any reason, including if the parent directory does not 149 | // exist. Not named "CreateDirectory" because that's a macro on Windows. 150 | bool CreateFolder() const; 151 | 152 | // Returns true if FilePath describes something in the file-system, 153 | // either a file, directory, or whatever, and that something exists. 154 | bool FileOrDirectoryExists() const; 155 | 156 | // Returns true if pathname describes a directory in the file-system 157 | // that exists. 158 | bool DirectoryExists() const; 159 | 160 | // Returns true if FilePath ends with a path separator, which indicates that 161 | // it is intended to represent a directory. Returns false otherwise. 162 | // This does NOT check that a directory (or file) actually exists. 163 | bool IsDirectory() const; 164 | 165 | // Returns true if pathname describes a root directory. (Windows has one 166 | // root directory per disk drive.) 167 | bool IsRootDirectory() const; 168 | 169 | // Returns true if pathname describes an absolute path. 170 | bool IsAbsolutePath() const; 171 | 172 | private: 173 | // Replaces multiple consecutive separators with a single separator. 174 | // For example, "bar///foo" becomes "bar/foo". Does not eliminate other 175 | // redundancies that might be in a pathname involving "." or "..". 176 | // 177 | // A pathname with multiple consecutive separators may occur either through 178 | // user error or as a result of some scripts or APIs that generate a pathname 179 | // with a trailing separator. On other platforms the same API or script 180 | // may NOT generate a pathname with a trailing "/". Then elsewhere that 181 | // pathname may have another "/" and pathname components added to it, 182 | // without checking for the separator already being there. 183 | // The script language and operating system may allow paths like "foo//bar" 184 | // but some of the functions in FilePath will not handle that correctly. In 185 | // particular, RemoveTrailingPathSeparator() only removes one separator, and 186 | // it is called in CreateDirectoriesRecursively() assuming that it will change 187 | // a pathname from directory syntax (trailing separator) to filename syntax. 188 | // 189 | // On Windows this method also replaces the alternate path separator '/' with 190 | // the primary path separator '\\', so that for example "bar\\/\\foo" becomes 191 | // "bar\\foo". 192 | 193 | void Normalize(); 194 | 195 | // Returns a pointer to the last occurence of a valid path separator in 196 | // the FilePath. On Windows, for example, both '/' and '\' are valid path 197 | // separators. Returns NULL if no path separator was found. 198 | const char* FindLastPathSeparator() const; 199 | 200 | std::string pathname_; 201 | }; // class FilePath 202 | 203 | } // namespace internal 204 | } // namespace testing 205 | 206 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ 207 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/internal/gtest-linked_ptr.h: -------------------------------------------------------------------------------- 1 | // Copyright 2003 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 | // Authors: Dan Egnor (egnor@google.com) 31 | // 32 | // A "smart" pointer type with reference tracking. Every pointer to a 33 | // particular object is kept on a circular linked list. When the last pointer 34 | // to an object is destroyed or reassigned, the object is deleted. 35 | // 36 | // Used properly, this deletes the object when the last reference goes away. 37 | // There are several caveats: 38 | // - Like all reference counting schemes, cycles lead to leaks. 39 | // - Each smart pointer is actually two pointers (8 bytes instead of 4). 40 | // - Every time a pointer is assigned, the entire list of pointers to that 41 | // object is traversed. This class is therefore NOT SUITABLE when there 42 | // will often be more than two or three pointers to a particular object. 43 | // - References are only tracked as long as linked_ptr<> objects are copied. 44 | // If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS 45 | // will happen (double deletion). 46 | // 47 | // A good use of this class is storing object references in STL containers. 48 | // You can safely put linked_ptr<> in a vector<>. 49 | // Other uses may not be as good. 50 | // 51 | // Note: If you use an incomplete type with linked_ptr<>, the class 52 | // *containing* linked_ptr<> must have a constructor and destructor (even 53 | // if they do nothing!). 54 | // 55 | // Bill Gibbons suggested we use something like this. 56 | // 57 | // Thread Safety: 58 | // Unlike other linked_ptr implementations, in this implementation 59 | // a linked_ptr object is thread-safe in the sense that: 60 | // - it's safe to copy linked_ptr objects concurrently, 61 | // - it's safe to copy *from* a linked_ptr and read its underlying 62 | // raw pointer (e.g. via get()) concurrently, and 63 | // - it's safe to write to two linked_ptrs that point to the same 64 | // shared object concurrently. 65 | // TODO(wan@google.com): rename this to safe_linked_ptr to avoid 66 | // confusion with normal linked_ptr. 67 | 68 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ 69 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ 70 | 71 | #include 72 | #include 73 | 74 | #include "gtest/internal/gtest-port.h" 75 | 76 | namespace testing { 77 | namespace internal { 78 | 79 | // Protects copying of all linked_ptr objects. 80 | GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex); 81 | 82 | // This is used internally by all instances of linked_ptr<>. It needs to be 83 | // a non-template class because different types of linked_ptr<> can refer to 84 | // the same object (linked_ptr(obj) vs linked_ptr(obj)). 85 | // So, it needs to be possible for different types of linked_ptr to participate 86 | // in the same circular linked list, so we need a single class type here. 87 | // 88 | // DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr. 89 | class linked_ptr_internal { 90 | public: 91 | // Create a new circle that includes only this instance. 92 | void join_new() { 93 | next_ = this; 94 | } 95 | 96 | // Many linked_ptr operations may change p.link_ for some linked_ptr 97 | // variable p in the same circle as this object. Therefore we need 98 | // to prevent two such operations from occurring concurrently. 99 | // 100 | // Note that different types of linked_ptr objects can coexist in a 101 | // circle (e.g. linked_ptr, linked_ptr, and 102 | // linked_ptr). Therefore we must use a single mutex to 103 | // protect all linked_ptr objects. This can create serious 104 | // contention in production code, but is acceptable in a testing 105 | // framework. 106 | 107 | // Join an existing circle. 108 | void join(linked_ptr_internal const* ptr) 109 | GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) { 110 | MutexLock lock(&g_linked_ptr_mutex); 111 | 112 | linked_ptr_internal const* p = ptr; 113 | while (p->next_ != ptr) p = p->next_; 114 | p->next_ = this; 115 | next_ = ptr; 116 | } 117 | 118 | // Leave whatever circle we're part of. Returns true if we were the 119 | // last member of the circle. Once this is done, you can join() another. 120 | bool depart() 121 | GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) { 122 | MutexLock lock(&g_linked_ptr_mutex); 123 | 124 | if (next_ == this) return true; 125 | linked_ptr_internal const* p = next_; 126 | while (p->next_ != this) p = p->next_; 127 | p->next_ = next_; 128 | return false; 129 | } 130 | 131 | private: 132 | mutable linked_ptr_internal const* next_; 133 | }; 134 | 135 | template 136 | class linked_ptr { 137 | public: 138 | typedef T element_type; 139 | 140 | // Take over ownership of a raw pointer. This should happen as soon as 141 | // possible after the object is created. 142 | explicit linked_ptr(T* ptr = NULL) { capture(ptr); } 143 | ~linked_ptr() { depart(); } 144 | 145 | // Copy an existing linked_ptr<>, adding ourselves to the list of references. 146 | template linked_ptr(linked_ptr const& ptr) { copy(&ptr); } 147 | linked_ptr(linked_ptr const& ptr) { // NOLINT 148 | assert(&ptr != this); 149 | copy(&ptr); 150 | } 151 | 152 | // Assignment releases the old value and acquires the new. 153 | template linked_ptr& operator=(linked_ptr const& ptr) { 154 | depart(); 155 | copy(&ptr); 156 | return *this; 157 | } 158 | 159 | linked_ptr& operator=(linked_ptr const& ptr) { 160 | if (&ptr != this) { 161 | depart(); 162 | copy(&ptr); 163 | } 164 | return *this; 165 | } 166 | 167 | // Smart pointer members. 168 | void reset(T* ptr = NULL) { 169 | depart(); 170 | capture(ptr); 171 | } 172 | T* get() const { return value_; } 173 | T* operator->() const { return value_; } 174 | T& operator*() const { return *value_; } 175 | 176 | bool operator==(T* p) const { return value_ == p; } 177 | bool operator!=(T* p) const { return value_ != p; } 178 | template 179 | bool operator==(linked_ptr const& ptr) const { 180 | return value_ == ptr.get(); 181 | } 182 | template 183 | bool operator!=(linked_ptr const& ptr) const { 184 | return value_ != ptr.get(); 185 | } 186 | 187 | private: 188 | template 189 | friend class linked_ptr; 190 | 191 | T* value_; 192 | linked_ptr_internal link_; 193 | 194 | void depart() { 195 | if (link_.depart()) delete value_; 196 | } 197 | 198 | void capture(T* ptr) { 199 | value_ = ptr; 200 | link_.join_new(); 201 | } 202 | 203 | template void copy(linked_ptr const* ptr) { 204 | value_ = ptr->get(); 205 | if (value_) 206 | link_.join(&ptr->link_); 207 | else 208 | link_.join_new(); 209 | } 210 | }; 211 | 212 | template inline 213 | bool operator==(T* ptr, const linked_ptr& x) { 214 | return ptr == x.get(); 215 | } 216 | 217 | template inline 218 | bool operator!=(T* ptr, const linked_ptr& x) { 219 | return ptr != x.get(); 220 | } 221 | 222 | // A function to convert T* into linked_ptr 223 | // Doing e.g. make_linked_ptr(new FooBarBaz(arg)) is a shorter notation 224 | // for linked_ptr >(new FooBarBaz(arg)) 225 | template 226 | linked_ptr make_linked_ptr(T* ptr) { 227 | return linked_ptr(ptr); 228 | } 229 | 230 | } // namespace internal 231 | } // namespace testing 232 | 233 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ 234 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/internal/gtest-param-util-generated.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $var n = 50 $$ Maximum length of Values arguments we want to support. 3 | $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. 4 | // Copyright 2008 Google Inc. 5 | // All Rights Reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are 9 | // met: 10 | // 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Google Inc. nor the names of its 18 | // contributors may be used to endorse or promote products derived from 19 | // this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | // Author: vladl@google.com (Vlad Losev) 34 | 35 | // Type and function utilities for implementing parameterized tests. 36 | // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! 37 | // 38 | // Currently Google Test supports at most $n arguments in Values, 39 | // and at most $maxtuple arguments in Combine. Please contact 40 | // googletestframework@googlegroups.com if you need more. 41 | // Please note that the number of arguments to Combine is limited 42 | // by the maximum arity of the implementation of tr1::tuple which is 43 | // currently set at $maxtuple. 44 | 45 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ 46 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ 47 | 48 | // scripts/fuse_gtest.py depends on gtest's own header being #included 49 | // *unconditionally*. Therefore these #includes cannot be moved 50 | // inside #if GTEST_HAS_PARAM_TEST. 51 | #include "gtest/internal/gtest-param-util.h" 52 | #include "gtest/internal/gtest-port.h" 53 | 54 | #if GTEST_HAS_PARAM_TEST 55 | 56 | namespace testing { 57 | 58 | // Forward declarations of ValuesIn(), which is implemented in 59 | // include/gtest/gtest-param-test.h. 60 | template 61 | internal::ParamGenerator< 62 | typename ::testing::internal::IteratorTraits::value_type> 63 | ValuesIn(ForwardIterator begin, ForwardIterator end); 64 | 65 | template 66 | internal::ParamGenerator ValuesIn(const T (&array)[N]); 67 | 68 | template 69 | internal::ParamGenerator ValuesIn( 70 | const Container& container); 71 | 72 | namespace internal { 73 | 74 | // Used in the Values() function to provide polymorphic capabilities. 75 | template 76 | class ValueArray1 { 77 | public: 78 | explicit ValueArray1(T1 v1) : v1_(v1) {} 79 | 80 | template 81 | operator ParamGenerator() const { return ValuesIn(&v1_, &v1_ + 1); } 82 | 83 | private: 84 | // No implementation - assignment is unsupported. 85 | void operator=(const ValueArray1& other); 86 | 87 | const T1 v1_; 88 | }; 89 | 90 | $range i 2..n 91 | $for i [[ 92 | $range j 1..i 93 | 94 | template <$for j, [[typename T$j]]> 95 | class ValueArray$i { 96 | public: 97 | ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {} 98 | 99 | template 100 | operator ParamGenerator() const { 101 | const T array[] = {$for j, [[static_cast(v$(j)_)]]}; 102 | return ValuesIn(array); 103 | } 104 | 105 | private: 106 | // No implementation - assignment is unsupported. 107 | void operator=(const ValueArray$i& other); 108 | 109 | $for j [[ 110 | 111 | const T$j v$(j)_; 112 | ]] 113 | 114 | }; 115 | 116 | ]] 117 | 118 | # if GTEST_HAS_COMBINE 119 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. 120 | // 121 | // Generates values from the Cartesian product of values produced 122 | // by the argument generators. 123 | // 124 | $range i 2..maxtuple 125 | $for i [[ 126 | $range j 1..i 127 | $range k 2..i 128 | 129 | template <$for j, [[typename T$j]]> 130 | class CartesianProductGenerator$i 131 | : public ParamGeneratorInterface< ::std::tr1::tuple<$for j, [[T$j]]> > { 132 | public: 133 | typedef ::std::tr1::tuple<$for j, [[T$j]]> ParamType; 134 | 135 | CartesianProductGenerator$i($for j, [[const ParamGenerator& g$j]]) 136 | : $for j, [[g$(j)_(g$j)]] {} 137 | virtual ~CartesianProductGenerator$i() {} 138 | 139 | virtual ParamIteratorInterface* Begin() const { 140 | return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]); 141 | } 142 | virtual ParamIteratorInterface* End() const { 143 | return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]); 144 | } 145 | 146 | private: 147 | class Iterator : public ParamIteratorInterface { 148 | public: 149 | Iterator(const ParamGeneratorInterface* base, $for j, [[ 150 | 151 | const ParamGenerator& g$j, 152 | const typename ParamGenerator::iterator& current$(j)]]) 153 | : base_(base), 154 | $for j, [[ 155 | 156 | begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j) 157 | ]] { 158 | ComputeCurrentValue(); 159 | } 160 | virtual ~Iterator() {} 161 | 162 | virtual const ParamGeneratorInterface* BaseGenerator() const { 163 | return base_; 164 | } 165 | // Advance should not be called on beyond-of-range iterators 166 | // so no component iterators must be beyond end of range, either. 167 | virtual void Advance() { 168 | assert(!AtEnd()); 169 | ++current$(i)_; 170 | 171 | $for k [[ 172 | if (current$(i+2-k)_ == end$(i+2-k)_) { 173 | current$(i+2-k)_ = begin$(i+2-k)_; 174 | ++current$(i+2-k-1)_; 175 | } 176 | 177 | ]] 178 | ComputeCurrentValue(); 179 | } 180 | virtual ParamIteratorInterface* Clone() const { 181 | return new Iterator(*this); 182 | } 183 | virtual const ParamType* Current() const { return ¤t_value_; } 184 | virtual bool Equals(const ParamIteratorInterface& other) const { 185 | // Having the same base generator guarantees that the other 186 | // iterator is of the same type and we can downcast. 187 | GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) 188 | << "The program attempted to compare iterators " 189 | << "from different generators." << std::endl; 190 | const Iterator* typed_other = 191 | CheckedDowncastToActualType(&other); 192 | // We must report iterators equal if they both point beyond their 193 | // respective ranges. That can happen in a variety of fashions, 194 | // so we have to consult AtEnd(). 195 | return (AtEnd() && typed_other->AtEnd()) || 196 | ($for j && [[ 197 | 198 | current$(j)_ == typed_other->current$(j)_ 199 | ]]); 200 | } 201 | 202 | private: 203 | Iterator(const Iterator& other) 204 | : base_(other.base_), $for j, [[ 205 | 206 | begin$(j)_(other.begin$(j)_), 207 | end$(j)_(other.end$(j)_), 208 | current$(j)_(other.current$(j)_) 209 | ]] { 210 | ComputeCurrentValue(); 211 | } 212 | 213 | void ComputeCurrentValue() { 214 | if (!AtEnd()) 215 | current_value_ = ParamType($for j, [[*current$(j)_]]); 216 | } 217 | bool AtEnd() const { 218 | // We must report iterator past the end of the range when either of the 219 | // component iterators has reached the end of its range. 220 | return 221 | $for j || [[ 222 | 223 | current$(j)_ == end$(j)_ 224 | ]]; 225 | } 226 | 227 | // No implementation - assignment is unsupported. 228 | void operator=(const Iterator& other); 229 | 230 | const ParamGeneratorInterface* const base_; 231 | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. 232 | // current[i]_ is the actual traversing iterator. 233 | $for j [[ 234 | 235 | const typename ParamGenerator::iterator begin$(j)_; 236 | const typename ParamGenerator::iterator end$(j)_; 237 | typename ParamGenerator::iterator current$(j)_; 238 | ]] 239 | 240 | ParamType current_value_; 241 | }; // class CartesianProductGenerator$i::Iterator 242 | 243 | // No implementation - assignment is unsupported. 244 | void operator=(const CartesianProductGenerator$i& other); 245 | 246 | 247 | $for j [[ 248 | const ParamGenerator g$(j)_; 249 | 250 | ]] 251 | }; // class CartesianProductGenerator$i 252 | 253 | 254 | ]] 255 | 256 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. 257 | // 258 | // Helper classes providing Combine() with polymorphic features. They allow 259 | // casting CartesianProductGeneratorN to ParamGenerator if T is 260 | // convertible to U. 261 | // 262 | $range i 2..maxtuple 263 | $for i [[ 264 | $range j 1..i 265 | 266 | template <$for j, [[class Generator$j]]> 267 | class CartesianProductHolder$i { 268 | public: 269 | CartesianProductHolder$i($for j, [[const Generator$j& g$j]]) 270 | : $for j, [[g$(j)_(g$j)]] {} 271 | template <$for j, [[typename T$j]]> 272 | operator ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >() const { 273 | return ParamGenerator< ::std::tr1::tuple<$for j, [[T$j]]> >( 274 | new CartesianProductGenerator$i<$for j, [[T$j]]>( 275 | $for j,[[ 276 | 277 | static_cast >(g$(j)_) 278 | ]])); 279 | } 280 | 281 | private: 282 | // No implementation - assignment is unsupported. 283 | void operator=(const CartesianProductHolder$i& other); 284 | 285 | 286 | $for j [[ 287 | const Generator$j g$(j)_; 288 | 289 | ]] 290 | }; // class CartesianProductHolder$i 291 | 292 | ]] 293 | 294 | # endif // GTEST_HAS_COMBINE 295 | 296 | } // namespace internal 297 | } // namespace testing 298 | 299 | #endif // GTEST_HAS_PARAM_TEST 300 | 301 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ 302 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/internal/gtest-string.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 | // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file declares the String class and functions used internally by 35 | // Google Test. They are subject to change without notice. They should not used 36 | // by code external to Google Test. 37 | // 38 | // This header file is #included by . 39 | // It should not be #included by other files. 40 | 41 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ 42 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ 43 | 44 | #ifdef __BORLANDC__ 45 | // string.h is not guaranteed to provide strcpy on C++ Builder. 46 | # include 47 | #endif 48 | 49 | #include 50 | #include 51 | 52 | #include "gtest/internal/gtest-port.h" 53 | 54 | namespace testing { 55 | namespace internal { 56 | 57 | // String - an abstract class holding static string utilities. 58 | class GTEST_API_ String { 59 | public: 60 | // Static utility methods 61 | 62 | // Clones a 0-terminated C string, allocating memory using new. The 63 | // caller is responsible for deleting the return value using 64 | // delete[]. Returns the cloned string, or NULL if the input is 65 | // NULL. 66 | // 67 | // This is different from strdup() in string.h, which allocates 68 | // memory using malloc(). 69 | static const char* CloneCString(const char* c_str); 70 | 71 | #if GTEST_OS_WINDOWS_MOBILE 72 | // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be 73 | // able to pass strings to Win32 APIs on CE we need to convert them 74 | // to 'Unicode', UTF-16. 75 | 76 | // Creates a UTF-16 wide string from the given ANSI string, allocating 77 | // memory using new. The caller is responsible for deleting the return 78 | // value using delete[]. Returns the wide string, or NULL if the 79 | // input is NULL. 80 | // 81 | // The wide string is created using the ANSI codepage (CP_ACP) to 82 | // match the behaviour of the ANSI versions of Win32 calls and the 83 | // C runtime. 84 | static LPCWSTR AnsiToUtf16(const char* c_str); 85 | 86 | // Creates an ANSI string from the given wide string, allocating 87 | // memory using new. The caller is responsible for deleting the return 88 | // value using delete[]. Returns the ANSI string, or NULL if the 89 | // input is NULL. 90 | // 91 | // The returned string is created using the ANSI codepage (CP_ACP) to 92 | // match the behaviour of the ANSI versions of Win32 calls and the 93 | // C runtime. 94 | static const char* Utf16ToAnsi(LPCWSTR utf16_str); 95 | #endif 96 | 97 | // Compares two C strings. Returns true iff they have the same content. 98 | // 99 | // Unlike strcmp(), this function can handle NULL argument(s). A 100 | // NULL C string is considered different to any non-NULL C string, 101 | // including the empty string. 102 | static bool CStringEquals(const char* lhs, const char* rhs); 103 | 104 | // Converts a wide C string to a String using the UTF-8 encoding. 105 | // NULL will be converted to "(null)". If an error occurred during 106 | // the conversion, "(failed to convert from wide string)" is 107 | // returned. 108 | static std::string ShowWideCString(const wchar_t* wide_c_str); 109 | 110 | // Compares two wide C strings. Returns true iff they have the same 111 | // content. 112 | // 113 | // Unlike wcscmp(), this function can handle NULL argument(s). A 114 | // NULL C string is considered different to any non-NULL C string, 115 | // including the empty string. 116 | static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); 117 | 118 | // Compares two C strings, ignoring case. Returns true iff they 119 | // have the same content. 120 | // 121 | // Unlike strcasecmp(), this function can handle NULL argument(s). 122 | // A NULL C string is considered different to any non-NULL C string, 123 | // including the empty string. 124 | static bool CaseInsensitiveCStringEquals(const char* lhs, 125 | const char* rhs); 126 | 127 | // Compares two wide C strings, ignoring case. Returns true iff they 128 | // have the same content. 129 | // 130 | // Unlike wcscasecmp(), this function can handle NULL argument(s). 131 | // A NULL C string is considered different to any non-NULL wide C string, 132 | // including the empty string. 133 | // NB: The implementations on different platforms slightly differ. 134 | // On windows, this method uses _wcsicmp which compares according to LC_CTYPE 135 | // environment variable. On GNU platform this method uses wcscasecmp 136 | // which compares according to LC_CTYPE category of the current locale. 137 | // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the 138 | // current locale. 139 | static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, 140 | const wchar_t* rhs); 141 | 142 | // Returns true iff the given string ends with the given suffix, ignoring 143 | // case. Any string is considered to end with an empty suffix. 144 | static bool EndsWithCaseInsensitive( 145 | const std::string& str, const std::string& suffix); 146 | 147 | // Formats an int value as "%02d". 148 | static std::string FormatIntWidth2(int value); // "%02d" for width == 2 149 | 150 | // Formats an int value as "%X". 151 | static std::string FormatHexInt(int value); 152 | 153 | // Formats a byte as "%02X". 154 | static std::string FormatByte(unsigned char value); 155 | 156 | private: 157 | String(); // Not meant to be instantiated. 158 | }; // class String 159 | 160 | // Gets the content of the stringstream's buffer as an std::string. Each '\0' 161 | // character in the buffer is replaced with "\\0". 162 | GTEST_API_ std::string StringStreamToString(::std::stringstream* stream); 163 | 164 | } // namespace internal 165 | } // namespace testing 166 | 167 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ 168 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/internal/gtest-tuple.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $var n = 10 $$ Maximum number of tuple fields we want to support. 3 | $$ This meta comment fixes auto-indentation in Emacs. }} 4 | // Copyright 2009 Google Inc. 5 | // All Rights Reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are 9 | // met: 10 | // 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Google Inc. nor the names of its 18 | // contributors may be used to endorse or promote products derived from 19 | // this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | // Author: wan@google.com (Zhanyong Wan) 34 | 35 | // Implements a subset of TR1 tuple needed by Google Test and Google Mock. 36 | 37 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ 38 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ 39 | 40 | #include // For ::std::pair. 41 | 42 | // The compiler used in Symbian has a bug that prevents us from declaring the 43 | // tuple template as a friend (it complains that tuple is redefined). This 44 | // hack bypasses the bug by declaring the members that should otherwise be 45 | // private as public. 46 | // Sun Studio versions < 12 also have the above bug. 47 | #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) 48 | # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: 49 | #else 50 | # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ 51 | template friend class tuple; \ 52 | private: 53 | #endif 54 | 55 | 56 | $range i 0..n-1 57 | $range j 0..n 58 | $range k 1..n 59 | // GTEST_n_TUPLE_(T) is the type of an n-tuple. 60 | #define GTEST_0_TUPLE_(T) tuple<> 61 | 62 | $for k [[ 63 | $range m 0..k-1 64 | $range m2 k..n-1 65 | #define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]> 66 | 67 | ]] 68 | 69 | // GTEST_n_TYPENAMES_(T) declares a list of n typenames. 70 | 71 | $for j [[ 72 | $range m 0..j-1 73 | #define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]] 74 | 75 | 76 | ]] 77 | 78 | // In theory, defining stuff in the ::std namespace is undefined 79 | // behavior. We can do this as we are playing the role of a standard 80 | // library vendor. 81 | namespace std { 82 | namespace tr1 { 83 | 84 | template <$for i, [[typename T$i = void]]> 85 | class tuple; 86 | 87 | // Anything in namespace gtest_internal is Google Test's INTERNAL 88 | // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. 89 | namespace gtest_internal { 90 | 91 | // ByRef::type is T if T is a reference; otherwise it's const T&. 92 | template 93 | struct ByRef { typedef const T& type; }; // NOLINT 94 | template 95 | struct ByRef { typedef T& type; }; // NOLINT 96 | 97 | // A handy wrapper for ByRef. 98 | #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef::type 99 | 100 | // AddRef::type is T if T is a reference; otherwise it's T&. This 101 | // is the same as tr1::add_reference::type. 102 | template 103 | struct AddRef { typedef T& type; }; // NOLINT 104 | template 105 | struct AddRef { typedef T& type; }; // NOLINT 106 | 107 | // A handy wrapper for AddRef. 108 | #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef::type 109 | 110 | // A helper for implementing get(). 111 | template class Get; 112 | 113 | // A helper for implementing tuple_element. kIndexValid is true 114 | // iff k < the number of fields in tuple type T. 115 | template 116 | struct TupleElement; 117 | 118 | 119 | $for i [[ 120 | template 121 | struct TupleElement { 122 | typedef T$i type; 123 | }; 124 | 125 | 126 | ]] 127 | } // namespace gtest_internal 128 | 129 | template <> 130 | class tuple<> { 131 | public: 132 | tuple() {} 133 | tuple(const tuple& /* t */) {} 134 | tuple& operator=(const tuple& /* t */) { return *this; } 135 | }; 136 | 137 | 138 | $for k [[ 139 | $range m 0..k-1 140 | template 141 | class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] { 142 | public: 143 | template friend class gtest_internal::Get; 144 | 145 | tuple() : $for m, [[f$(m)_()]] {} 146 | 147 | explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]] 148 | $for m, [[f$(m)_(f$m)]] {} 149 | 150 | tuple(const tuple& t) : $for m, [[f$(m)_(t.f$(m)_)]] {} 151 | 152 | template 153 | tuple(const GTEST_$(k)_TUPLE_(U)& t) : $for m, [[f$(m)_(t.f$(m)_)]] {} 154 | 155 | $if k == 2 [[ 156 | template 157 | tuple(const ::std::pair& p) : f0_(p.first), f1_(p.second) {} 158 | 159 | ]] 160 | 161 | tuple& operator=(const tuple& t) { return CopyFrom(t); } 162 | 163 | template 164 | tuple& operator=(const GTEST_$(k)_TUPLE_(U)& t) { 165 | return CopyFrom(t); 166 | } 167 | 168 | $if k == 2 [[ 169 | template 170 | tuple& operator=(const ::std::pair& p) { 171 | f0_ = p.first; 172 | f1_ = p.second; 173 | return *this; 174 | } 175 | 176 | ]] 177 | 178 | GTEST_DECLARE_TUPLE_AS_FRIEND_ 179 | 180 | template 181 | tuple& CopyFrom(const GTEST_$(k)_TUPLE_(U)& t) { 182 | 183 | $for m [[ 184 | f$(m)_ = t.f$(m)_; 185 | 186 | ]] 187 | return *this; 188 | } 189 | 190 | 191 | $for m [[ 192 | T$m f$(m)_; 193 | 194 | ]] 195 | }; 196 | 197 | 198 | ]] 199 | // 6.1.3.2 Tuple creation functions. 200 | 201 | // Known limitations: we don't support passing an 202 | // std::tr1::reference_wrapper to make_tuple(). And we don't 203 | // implement tie(). 204 | 205 | inline tuple<> make_tuple() { return tuple<>(); } 206 | 207 | $for k [[ 208 | $range m 0..k-1 209 | 210 | template 211 | inline GTEST_$(k)_TUPLE_(T) make_tuple($for m, [[const T$m& f$m]]) { 212 | return GTEST_$(k)_TUPLE_(T)($for m, [[f$m]]); 213 | } 214 | 215 | ]] 216 | 217 | // 6.1.3.3 Tuple helper classes. 218 | 219 | template struct tuple_size; 220 | 221 | 222 | $for j [[ 223 | template 224 | struct tuple_size { 225 | static const int value = $j; 226 | }; 227 | 228 | 229 | ]] 230 | template 231 | struct tuple_element { 232 | typedef typename gtest_internal::TupleElement< 233 | k < (tuple_size::value), k, Tuple>::type type; 234 | }; 235 | 236 | #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element::type 237 | 238 | // 6.1.3.4 Element access. 239 | 240 | namespace gtest_internal { 241 | 242 | 243 | $for i [[ 244 | template <> 245 | class Get<$i> { 246 | public: 247 | template 248 | static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple)) 249 | Field(Tuple& t) { return t.f$(i)_; } // NOLINT 250 | 251 | template 252 | static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_($i, Tuple)) 253 | ConstField(const Tuple& t) { return t.f$(i)_; } 254 | }; 255 | 256 | 257 | ]] 258 | } // namespace gtest_internal 259 | 260 | template 261 | GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T))) 262 | get(GTEST_$(n)_TUPLE_(T)& t) { 263 | return gtest_internal::Get::Field(t); 264 | } 265 | 266 | template 267 | GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_$(n)_TUPLE_(T))) 268 | get(const GTEST_$(n)_TUPLE_(T)& t) { 269 | return gtest_internal::Get::ConstField(t); 270 | } 271 | 272 | // 6.1.3.5 Relational operators 273 | 274 | // We only implement == and !=, as we don't have a need for the rest yet. 275 | 276 | namespace gtest_internal { 277 | 278 | // SameSizeTuplePrefixComparator::Eq(t1, t2) returns true if the 279 | // first k fields of t1 equals the first k fields of t2. 280 | // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if 281 | // k1 != k2. 282 | template 283 | struct SameSizeTuplePrefixComparator; 284 | 285 | template <> 286 | struct SameSizeTuplePrefixComparator<0, 0> { 287 | template 288 | static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { 289 | return true; 290 | } 291 | }; 292 | 293 | template 294 | struct SameSizeTuplePrefixComparator { 295 | template 296 | static bool Eq(const Tuple1& t1, const Tuple2& t2) { 297 | return SameSizeTuplePrefixComparator::Eq(t1, t2) && 298 | ::std::tr1::get(t1) == ::std::tr1::get(t2); 299 | } 300 | }; 301 | 302 | } // namespace gtest_internal 303 | 304 | template 305 | inline bool operator==(const GTEST_$(n)_TUPLE_(T)& t, 306 | const GTEST_$(n)_TUPLE_(U)& u) { 307 | return gtest_internal::SameSizeTuplePrefixComparator< 308 | tuple_size::value, 309 | tuple_size::value>::Eq(t, u); 310 | } 311 | 312 | template 313 | inline bool operator!=(const GTEST_$(n)_TUPLE_(T)& t, 314 | const GTEST_$(n)_TUPLE_(U)& u) { return !(t == u); } 315 | 316 | // 6.1.4 Pairs. 317 | // Unimplemented. 318 | 319 | } // namespace tr1 320 | } // namespace std 321 | 322 | 323 | $for j [[ 324 | #undef GTEST_$(j)_TUPLE_ 325 | 326 | ]] 327 | 328 | 329 | $for j [[ 330 | #undef GTEST_$(j)_TYPENAMES_ 331 | 332 | ]] 333 | 334 | #undef GTEST_DECLARE_TUPLE_AS_FRIEND_ 335 | #undef GTEST_BY_REF_ 336 | #undef GTEST_ADD_REF_ 337 | #undef GTEST_TUPLE_ELEMENT_ 338 | 339 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ 340 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/include/gtest/internal/gtest-type-util.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $var n = 50 $$ Maximum length of type lists we want to support. 3 | // Copyright 2008 Google Inc. 4 | // All Rights Reserved. 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 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | // Type utilities needed for implementing typed and type-parameterized 35 | // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! 36 | // 37 | // Currently we support at most $n types in a list, and at most $n 38 | // type-parameterized tests in one type-parameterized test case. 39 | // Please contact googletestframework@googlegroups.com if you need 40 | // more. 41 | 42 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ 43 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ 44 | 45 | #include "gtest/internal/gtest-port.h" 46 | 47 | // #ifdef __GNUC__ is too general here. It is possible to use gcc without using 48 | // libstdc++ (which is where cxxabi.h comes from). 49 | # if GTEST_HAS_CXXABI_H_ 50 | # include 51 | # elif defined(__HP_aCC) 52 | # include 53 | # endif // GTEST_HASH_CXXABI_H_ 54 | 55 | namespace testing { 56 | namespace internal { 57 | 58 | // GetTypeName() returns a human-readable name of type T. 59 | // NB: This function is also used in Google Mock, so don't move it inside of 60 | // the typed-test-only section below. 61 | template 62 | std::string GetTypeName() { 63 | # if GTEST_HAS_RTTI 64 | 65 | const char* const name = typeid(T).name(); 66 | # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) 67 | int status = 0; 68 | // gcc's implementation of typeid(T).name() mangles the type name, 69 | // so we have to demangle it. 70 | # if GTEST_HAS_CXXABI_H_ 71 | using abi::__cxa_demangle; 72 | # endif // GTEST_HAS_CXXABI_H_ 73 | char* const readable_name = __cxa_demangle(name, 0, 0, &status); 74 | const std::string name_str(status == 0 ? readable_name : name); 75 | free(readable_name); 76 | return name_str; 77 | # else 78 | return name; 79 | # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC 80 | 81 | # else 82 | 83 | return ""; 84 | 85 | # endif // GTEST_HAS_RTTI 86 | } 87 | 88 | #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P 89 | 90 | // AssertyTypeEq::type is defined iff T1 and T2 are the same 91 | // type. This can be used as a compile-time assertion to ensure that 92 | // two types are equal. 93 | 94 | template 95 | struct AssertTypeEq; 96 | 97 | template 98 | struct AssertTypeEq { 99 | typedef bool type; 100 | }; 101 | 102 | // A unique type used as the default value for the arguments of class 103 | // template Types. This allows us to simulate variadic templates 104 | // (e.g. Types, Type, and etc), which C++ doesn't 105 | // support directly. 106 | struct None {}; 107 | 108 | // The following family of struct and struct templates are used to 109 | // represent type lists. In particular, TypesN 110 | // represents a type list with N types (T1, T2, ..., and TN) in it. 111 | // Except for Types0, every struct in the family has two member types: 112 | // Head for the first type in the list, and Tail for the rest of the 113 | // list. 114 | 115 | // The empty type list. 116 | struct Types0 {}; 117 | 118 | // Type lists of length 1, 2, 3, and so on. 119 | 120 | template 121 | struct Types1 { 122 | typedef T1 Head; 123 | typedef Types0 Tail; 124 | }; 125 | 126 | $range i 2..n 127 | 128 | $for i [[ 129 | $range j 1..i 130 | $range k 2..i 131 | template <$for j, [[typename T$j]]> 132 | struct Types$i { 133 | typedef T1 Head; 134 | typedef Types$(i-1)<$for k, [[T$k]]> Tail; 135 | }; 136 | 137 | 138 | ]] 139 | 140 | } // namespace internal 141 | 142 | // We don't want to require the users to write TypesN<...> directly, 143 | // as that would require them to count the length. Types<...> is much 144 | // easier to write, but generates horrible messages when there is a 145 | // compiler error, as gcc insists on printing out each template 146 | // argument, even if it has the default value (this means Types 147 | // will appear as Types in the compiler 148 | // errors). 149 | // 150 | // Our solution is to combine the best part of the two approaches: a 151 | // user would write Types, and Google Test will translate 152 | // that to TypesN internally to make error messages 153 | // readable. The translation is done by the 'type' member of the 154 | // Types template. 155 | 156 | $range i 1..n 157 | template <$for i, [[typename T$i = internal::None]]> 158 | struct Types { 159 | typedef internal::Types$n<$for i, [[T$i]]> type; 160 | }; 161 | 162 | template <> 163 | struct Types<$for i, [[internal::None]]> { 164 | typedef internal::Types0 type; 165 | }; 166 | 167 | $range i 1..n-1 168 | $for i [[ 169 | $range j 1..i 170 | $range k i+1..n 171 | template <$for j, [[typename T$j]]> 172 | struct Types<$for j, [[T$j]]$for k[[, internal::None]]> { 173 | typedef internal::Types$i<$for j, [[T$j]]> type; 174 | }; 175 | 176 | ]] 177 | 178 | namespace internal { 179 | 180 | # define GTEST_TEMPLATE_ template class 181 | 182 | // The template "selector" struct TemplateSel is used to 183 | // represent Tmpl, which must be a class template with one type 184 | // parameter, as a type. TemplateSel::Bind::type is defined 185 | // as the type Tmpl. This allows us to actually instantiate the 186 | // template "selected" by TemplateSel. 187 | // 188 | // This trick is necessary for simulating typedef for class templates, 189 | // which C++ doesn't support directly. 190 | template 191 | struct TemplateSel { 192 | template 193 | struct Bind { 194 | typedef Tmpl type; 195 | }; 196 | }; 197 | 198 | # define GTEST_BIND_(TmplSel, T) \ 199 | TmplSel::template Bind::type 200 | 201 | // A unique struct template used as the default value for the 202 | // arguments of class template Templates. This allows us to simulate 203 | // variadic templates (e.g. Templates, Templates, 204 | // and etc), which C++ doesn't support directly. 205 | template 206 | struct NoneT {}; 207 | 208 | // The following family of struct and struct templates are used to 209 | // represent template lists. In particular, TemplatesN represents a list of N templates (T1, T2, ..., and TN). Except 211 | // for Templates0, every struct in the family has two member types: 212 | // Head for the selector of the first template in the list, and Tail 213 | // for the rest of the list. 214 | 215 | // The empty template list. 216 | struct Templates0 {}; 217 | 218 | // Template lists of length 1, 2, 3, and so on. 219 | 220 | template 221 | struct Templates1 { 222 | typedef TemplateSel Head; 223 | typedef Templates0 Tail; 224 | }; 225 | 226 | $range i 2..n 227 | 228 | $for i [[ 229 | $range j 1..i 230 | $range k 2..i 231 | template <$for j, [[GTEST_TEMPLATE_ T$j]]> 232 | struct Templates$i { 233 | typedef TemplateSel Head; 234 | typedef Templates$(i-1)<$for k, [[T$k]]> Tail; 235 | }; 236 | 237 | 238 | ]] 239 | 240 | // We don't want to require the users to write TemplatesN<...> directly, 241 | // as that would require them to count the length. Templates<...> is much 242 | // easier to write, but generates horrible messages when there is a 243 | // compiler error, as gcc insists on printing out each template 244 | // argument, even if it has the default value (this means Templates 245 | // will appear as Templates in the compiler 246 | // errors). 247 | // 248 | // Our solution is to combine the best part of the two approaches: a 249 | // user would write Templates, and Google Test will translate 250 | // that to TemplatesN internally to make error messages 251 | // readable. The translation is done by the 'type' member of the 252 | // Templates template. 253 | 254 | $range i 1..n 255 | template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]> 256 | struct Templates { 257 | typedef Templates$n<$for i, [[T$i]]> type; 258 | }; 259 | 260 | template <> 261 | struct Templates<$for i, [[NoneT]]> { 262 | typedef Templates0 type; 263 | }; 264 | 265 | $range i 1..n-1 266 | $for i [[ 267 | $range j 1..i 268 | $range k i+1..n 269 | template <$for j, [[GTEST_TEMPLATE_ T$j]]> 270 | struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> { 271 | typedef Templates$i<$for j, [[T$j]]> type; 272 | }; 273 | 274 | ]] 275 | 276 | // The TypeList template makes it possible to use either a single type 277 | // or a Types<...> list in TYPED_TEST_CASE() and 278 | // INSTANTIATE_TYPED_TEST_CASE_P(). 279 | 280 | template 281 | struct TypeList { 282 | typedef Types1 type; 283 | }; 284 | 285 | 286 | $range i 1..n 287 | template <$for i, [[typename T$i]]> 288 | struct TypeList > { 289 | typedef typename Types<$for i, [[T$i]]>::type type; 290 | }; 291 | 292 | #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P 293 | 294 | } // namespace internal 295 | } // namespace testing 296 | 297 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ 298 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/src/gtest-all.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 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "src/gtest.cc" 43 | #include "src/gtest-death-test.cc" 44 | #include "src/gtest-filepath.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/src/gtest-test-part.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 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | 34 | #include "gtest/gtest-test-part.h" 35 | 36 | // Indicates that this translation unit is part of Google Test's 37 | // implementation. It must come before gtest-internal-inl.h is 38 | // included, or there will be a compiler error. This trick is to 39 | // prevent a user from accidentally including gtest-internal-inl.h in 40 | // his code. 41 | #define GTEST_IMPLEMENTATION_ 1 42 | #include "src/gtest-internal-inl.h" 43 | #undef GTEST_IMPLEMENTATION_ 44 | 45 | namespace testing { 46 | 47 | using internal::GetUnitTestImpl; 48 | 49 | // Gets the summary of the failure message by omitting the stack trace 50 | // in it. 51 | std::string TestPartResult::ExtractSummary(const char* message) { 52 | const char* const stack_trace = strstr(message, internal::kStackTraceMarker); 53 | return stack_trace == NULL ? message : 54 | std::string(message, stack_trace); 55 | } 56 | 57 | // Prints a TestPartResult object. 58 | std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { 59 | return os 60 | << result.file_name() << ":" << result.line_number() << ": " 61 | << (result.type() == TestPartResult::kSuccess ? "Success" : 62 | result.type() == TestPartResult::kFatalFailure ? "Fatal failure" : 63 | "Non-fatal failure") << ":\n" 64 | << result.message() << std::endl; 65 | } 66 | 67 | // Appends a TestPartResult to the array. 68 | void TestPartResultArray::Append(const TestPartResult& result) { 69 | array_.push_back(result); 70 | } 71 | 72 | // Returns the TestPartResult at the given index (0-based). 73 | const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const { 74 | if (index < 0 || index >= size()) { 75 | printf("\nInvalid index (%d) into TestPartResultArray.\n", index); 76 | internal::posix::Abort(); 77 | } 78 | 79 | return array_[index]; 80 | } 81 | 82 | // Returns the number of TestPartResult objects in the array. 83 | int TestPartResultArray::size() const { 84 | return static_cast(array_.size()); 85 | } 86 | 87 | namespace internal { 88 | 89 | HasNewFatalFailureHelper::HasNewFatalFailureHelper() 90 | : has_new_fatal_failure_(false), 91 | original_reporter_(GetUnitTestImpl()-> 92 | GetTestPartResultReporterForCurrentThread()) { 93 | GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this); 94 | } 95 | 96 | HasNewFatalFailureHelper::~HasNewFatalFailureHelper() { 97 | GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread( 98 | original_reporter_); 99 | } 100 | 101 | void HasNewFatalFailureHelper::ReportTestPartResult( 102 | const TestPartResult& result) { 103 | if (result.fatally_failed()) 104 | has_new_fatal_failure_ = true; 105 | original_reporter_->ReportTestPartResult(result); 106 | } 107 | 108 | } // namespace internal 109 | 110 | } // namespace testing 111 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/src/gtest-typed-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 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest-typed-test.h" 33 | #include "gtest/gtest.h" 34 | 35 | namespace testing { 36 | namespace internal { 37 | 38 | #if GTEST_HAS_TYPED_TEST_P 39 | 40 | // Skips to the first non-space char in str. Returns an empty string if str 41 | // contains only whitespace characters. 42 | static const char* SkipSpaces(const char* str) { 43 | while (IsSpace(*str)) 44 | str++; 45 | return str; 46 | } 47 | 48 | // Verifies that registered_tests match the test names in 49 | // defined_test_names_; returns registered_tests if successful, or 50 | // aborts the program otherwise. 51 | const char* TypedTestCasePState::VerifyRegisteredTestNames( 52 | const char* file, int line, const char* registered_tests) { 53 | typedef ::std::set::const_iterator DefinedTestIter; 54 | registered_ = true; 55 | 56 | // Skip initial whitespace in registered_tests since some 57 | // preprocessors prefix stringizied literals with whitespace. 58 | registered_tests = SkipSpaces(registered_tests); 59 | 60 | Message errors; 61 | ::std::set tests; 62 | for (const char* names = registered_tests; names != NULL; 63 | names = SkipComma(names)) { 64 | const std::string name = GetPrefixUntilComma(names); 65 | if (tests.count(name) != 0) { 66 | errors << "Test " << name << " is listed more than once.\n"; 67 | continue; 68 | } 69 | 70 | bool found = false; 71 | for (DefinedTestIter it = defined_test_names_.begin(); 72 | it != defined_test_names_.end(); 73 | ++it) { 74 | if (name == *it) { 75 | found = true; 76 | break; 77 | } 78 | } 79 | 80 | if (found) { 81 | tests.insert(name); 82 | } else { 83 | errors << "No test named " << name 84 | << " can be found in this test case.\n"; 85 | } 86 | } 87 | 88 | for (DefinedTestIter it = defined_test_names_.begin(); 89 | it != defined_test_names_.end(); 90 | ++it) { 91 | if (tests.count(*it) == 0) { 92 | errors << "You forgot to list test " << *it << ".\n"; 93 | } 94 | } 95 | 96 | const std::string& errors_str = errors.GetString(); 97 | if (errors_str != "") { 98 | fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), 99 | errors_str.c_str()); 100 | fflush(stderr); 101 | posix::Abort(); 102 | } 103 | 104 | return registered_tests; 105 | } 106 | 107 | #endif // GTEST_HAS_TYPED_TEST_P 108 | 109 | } // namespace internal 110 | } // namespace testing 111 | -------------------------------------------------------------------------------- /3rdparty/gtest-1.7.0/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 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /3rdparty/onvif/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(ONVIF_NAME "onvif") 2 | set(ONVIF_PATH "${PROJECT_SOURCE_DIR}/3rdparty/onvif") 3 | 4 | # files glob 5 | file(GLOB ONVIF_INCLUDE_FILES "${ONVIF_PATH}/include/onvif/*.h") 6 | file(GLOB GSOAP_INCLUDE_FILES "${ONVIF_PATH}/include/gsoap/*.h") 7 | file(GLOB ONVIF_SOURCE_FILES "${ONVIF_PATH}/src/onvif/*.cpp") 8 | file(GLOB GSOAP_SOURCE_FILES "${ONVIF_PATH}/src/gsoap/*.c*") 9 | 10 | # add library 11 | add_library(${ONVIF_NAME} STATIC ${ONVIF_SOURCE_FILES} ${GSOAP_SOURCE_FILES} ${ONVIF_INCLUDE_FILES} ${GSOAP_INCLUDE_FILES}) 12 | target_include_directories(${ONVIF_NAME} PUBLIC 13 | ${ONVIF_PATH}/include/ 14 | ${ONVIF_PATH}/include/onvif 15 | ${ONVIF_PATH}/include/gsoap) 16 | 17 | set_target_properties(${ONVIF_NAME} PROPERTIES FOLDER 3RDPARTY) 18 | 19 | target_compile_definitions(${ONVIF_NAME} PUBLIC WITH_DOM) 20 | target_compile_definitions(${ONVIF_NAME} PUBLIC WITH_OPENSSL) 21 | target_compile_definitions(${ONVIF_NAME} PUBLIC WITH_PURE_VIRTUAL) 22 | 23 | if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) 24 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register -Wno-format")# 25 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 26 | target_compile_options(${ONVIF_NAME} PRIVATE /bigobj) 27 | # Disable Warning C4267: conversion from 'size_t' to 'int', possible loss of data 28 | ADD_DEFINITIONS("/wd4267") 29 | endif() 30 | 31 | 32 | 33 | SET_SOURCE_FILES_PROPERTIES("${ONVIF_PATH}/src/gsoap/duration.c" PROPERTIES LANGUAGE CXX) 34 | SET_SOURCE_FILES_PROPERTIES("${ONVIF_PATH}/src/gsoap/mecevp.c" PROPERTIES LANGUAGE CXX) 35 | SET_SOURCE_FILES_PROPERTIES("${ONVIF_PATH}/src/gsoap/smdevp.c" PROPERTIES LANGUAGE CXX) 36 | SET_SOURCE_FILES_PROPERTIES("${ONVIF_PATH}/src/gsoap/threads.c" PROPERTIES LANGUAGE CXX) 37 | SET_SOURCE_FILES_PROPERTIES("${ONVIF_PATH}/src/gsoap/wsaapi.c" PROPERTIES LANGUAGE CXX) 38 | 39 | ssigonvif_link_openssl(${ONVIF_NAME}) -------------------------------------------------------------------------------- /3rdparty/onvif/include/gsoap/duration.h: -------------------------------------------------------------------------------- 1 | /* 2 | duration.h 3 | 4 | Custom serializer for xsd:duration stored in a LONG64 with ms precision 5 | - a LONG64 int can represent 106751991167 days forward and backward 6 | - LONG64 is long long int under Unix/Linux 7 | - millisecond resolution (1/1000 sec) means 1 second = 1000 8 | - when adding to a time_t value, conversion may be needed since time_t 9 | may (or may) not have seconds resolution 10 | - durations longer than a month are always output in days, rather than 11 | months to avoid days-per-month conversion inacurracies 12 | - durations expressed in years and months are not well defined, since 13 | there is no reference starting time; the decoder assumes 30 days per 14 | month and conversion of P4M gives 120 days and therefore the duration 15 | P4M and P120D are assumed identical, while they should give different 16 | results depending on the reference starting time 17 | 18 | #import this file into your gSOAP .h file 19 | 20 | To automate the wsdl2h-mapping of xsd:dateTime to struct tm, add this 21 | line to the typemap.dat file: 22 | 23 | xsd__duration = #import "custom/duration.h" | xsd__duration 24 | 25 | The typemap.dat file is used by wsdl2h to map types (wsdl2h option -t). 26 | 27 | Compile and link your code with custom/duration.c 28 | 29 | gSOAP XML Web services tools 30 | Copyright (C) 2000-2009, Robert van Engelen, Genivia Inc., All Rights Reserved. 31 | This part of the software is released under ONE of the following licenses: 32 | GPL, the gSOAP public license, OR Genivia's license for commercial use. 33 | -------------------------------------------------------------------------------- 34 | gSOAP public license. 35 | 36 | The contents of this file are subject to the gSOAP Public License Version 1.3 37 | (the "License"); you may not use this file except in compliance with the 38 | License. You may obtain a copy of the License at 39 | http://www.cs.fsu.edu/~engelen/soaplicense.html 40 | Software distributed under the License is distributed on an "AS IS" basis, 41 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 42 | for the specific language governing rights and limitations under the License. 43 | 44 | The Initial Developer of the Original Code is Robert A. van Engelen. 45 | Copyright (C) 2000-2009, Robert van Engelen, Genivia, Inc., All Rights Reserved. 46 | -------------------------------------------------------------------------------- 47 | GPL license. 48 | 49 | This program is free software; you can redistribute it and/or modify it under 50 | the terms of the GNU General Public License as published by the Free Software 51 | Foundation; either version 2 of the License, or (at your option) any later 52 | version. 53 | 54 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 55 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 56 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 57 | 58 | You should have received a copy of the GNU General Public License along with 59 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 60 | Place, Suite 330, Boston, MA 02111-1307 USA 61 | 62 | Author contact information: 63 | engelen@genivia.com / engelen@acm.org 64 | 65 | This program is released under the GPL with the additional exemption that 66 | compiling, linking, and/or using OpenSSL is allowed. 67 | -------------------------------------------------------------------------------- 68 | A commercial use license is available from Genivia, Inc., contact@genivia.com 69 | -------------------------------------------------------------------------------- 70 | */ 71 | 72 | extern typedef long long xsd__duration; /* duration in ms (1/1000 sec) */ 73 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/gsoap/mecevp.h: -------------------------------------------------------------------------------- 1 | /* 2 | mecevp.h 3 | 4 | gSOAP interface for streaming message encryption and decryption 5 | 6 | gSOAP XML Web services tools 7 | Copyright (C) 2000-2010, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 | This part of the software is released under one of the following licenses: 9 | GPL, the gSOAP public license, or Genivia's license for commercial use. 10 | -------------------------------------------------------------------------------- 11 | gSOAP public license. 12 | 13 | The contents of this file are subject to the gSOAP Public License Version 1.3 14 | (the "License"); you may not use this file except in compliance with the 15 | License. You may obtain a copy of the License at 16 | http://www.cs.fsu.edu/~engelen/soaplicense.html 17 | Software distributed under the License is distributed on an "AS IS" basis, 18 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 19 | for the specific language governing rights and limitations under the License. 20 | 21 | The Initial Developer of the Original Code is Robert A. van Engelen. 22 | Copyright (C) 2000-2010, Robert van Engelen, Genivia, Inc., All Rights Reserved. 23 | -------------------------------------------------------------------------------- 24 | GPL license. 25 | 26 | This program is free software; you can redistribute it and/or modify it under 27 | the terms of the GNU General Public License as published by the Free Software 28 | Foundation; either version 2 of the License, or (at your option) any later 29 | version. 30 | 31 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 32 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 33 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along with 36 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 37 | Place, Suite 330, Boston, MA 02111-1307 USA 38 | 39 | Author contact information: 40 | engelen@genivia.com / engelen@acm.org 41 | 42 | This program is released under the GPL with the additional exemption that 43 | compiling, linking, and/or using OpenSSL is allowed. 44 | -------------------------------------------------------------------------------- 45 | A commercial use license is available from Genivia, Inc., contact@genivia.com 46 | -------------------------------------------------------------------------------- 47 | */ 48 | 49 | #ifndef MECEVP_H 50 | #define MECEVP_H 51 | 52 | #include "stdsoap2.h" 53 | 54 | #ifdef WITH_OPENSSL 55 | #include 56 | #endif 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | /** Expose EVP_PKEY in a portable representation */ 63 | #define SOAP_MEC_KEY_TYPE EVP_PKEY 64 | 65 | /******************************************************************************\ 66 | * 67 | * Supported algorithms 68 | * 69 | \******************************************************************************/ 70 | 71 | /** Engine off */ 72 | #define SOAP_MEC_NONE (0) 73 | 74 | /** Cipher type (triple DES CBC) */ 75 | #define SOAP_MEC_DES_CBC (0x0010) 76 | 77 | /** Cipher type (AES128 CBC) */ 78 | #define SOAP_MEC_AES128_CBC (0x0020) 79 | 80 | /** Cipher type (AES192 CBC) */ 81 | #define SOAP_MEC_AES192_CBC (0x0040) 82 | 83 | /** Cipher type (AES256 CBC) */ 84 | #define SOAP_MEC_AES256_CBC (0x0080) 85 | 86 | /** Cipher type (AES512 CBC) */ 87 | #define SOAP_MEC_AES512_CBC (0x0100) 88 | 89 | /** Encode mode */ 90 | #define SOAP_MEC_ENC (0x1000) 91 | 92 | /** Envelope mode */ 93 | #define SOAP_MEC_ENV (0x2000) 94 | 95 | /** Mask */ 96 | #define SOAP_MEC_MASK (0xFFFF) 97 | 98 | /** Enable store (in buffer) instead of streaming mode */ 99 | #define SOAP_MEC_STORE (0x010000) 100 | 101 | /** RSA-OAEP padding */ 102 | #define SOAP_MEC_OAEP (0x020000) 103 | 104 | /* Encode and decode types */ 105 | 106 | /** Symmetric secret key encryption */ 107 | #define SOAP_MEC_ENC_DES_CBC (SOAP_MEC_DES_CBC | SOAP_MEC_ENC) 108 | #define SOAP_MEC_ENC_AES128_CBC (SOAP_MEC_AES128_CBC | SOAP_MEC_ENC) 109 | #define SOAP_MEC_ENC_AES192_CBC (SOAP_MEC_AES192_CBC | SOAP_MEC_ENC) 110 | #define SOAP_MEC_ENC_AES256_CBC (SOAP_MEC_AES256_CBC | SOAP_MEC_ENC) 111 | #define SOAP_MEC_ENC_AES512_CBC (SOAP_MEC_AES512_CBC | SOAP_MEC_ENC) 112 | /** Symmetric secret key decryption */ 113 | #define SOAP_MEC_DEC_DES_CBC (SOAP_MEC_DES_CBC) 114 | #define SOAP_MEC_DEC_AES128_CBC (SOAP_MEC_AES128_CBC) 115 | #define SOAP_MEC_DEC_AES192_CBC (SOAP_MEC_AES192_CBC) 116 | #define SOAP_MEC_DEC_AES256_CBC (SOAP_MEC_AES256_CBC) 117 | #define SOAP_MEC_DEC_AES512_CBC (SOAP_MEC_AES512_CBC) 118 | 119 | /* Envelope types */ 120 | 121 | /** Envelope (using RSA public key) encryption */ 122 | #define SOAP_MEC_ENV_ENC_DES_CBC (SOAP_MEC_ENC_DES_CBC | SOAP_MEC_ENV) 123 | #define SOAP_MEC_ENV_ENC_AES128_CBC (SOAP_MEC_ENC_AES128_CBC | SOAP_MEC_ENV) 124 | #define SOAP_MEC_ENV_ENC_AES192_CBC (SOAP_MEC_ENC_AES192_CBC | SOAP_MEC_ENV) 125 | #define SOAP_MEC_ENV_ENC_AES256_CBC (SOAP_MEC_ENC_AES256_CBC | SOAP_MEC_ENV) 126 | #define SOAP_MEC_ENV_ENC_AES512_CBC (SOAP_MEC_ENC_AES512_CBC | SOAP_MEC_ENV) 127 | /** Envelope (using RSA private key) decryption */ 128 | #define SOAP_MEC_ENV_DEC_DES_CBC (SOAP_MEC_DEC_DES_CBC | SOAP_MEC_ENV) 129 | #define SOAP_MEC_ENV_DEC_AES128_CBC (SOAP_MEC_DEC_AES128_CBC | SOAP_MEC_ENV) 130 | #define SOAP_MEC_ENV_DEC_AES192_CBC (SOAP_MEC_DEC_AES192_CBC | SOAP_MEC_ENV) 131 | #define SOAP_MEC_ENV_DEC_AES256_CBC (SOAP_MEC_DEC_AES256_CBC | SOAP_MEC_ENV) 132 | #define SOAP_MEC_ENV_DEC_AES512_CBC (SOAP_MEC_DEC_AES512_CBC | SOAP_MEC_ENV) 133 | 134 | /** Decryption engine states */ 135 | enum SOAP_MEC_STATE { SOAP_MEC_STATE_NONE, SOAP_MEC_STATE_INIT, SOAP_MEC_STATE_IV, SOAP_MEC_STATE_DECRYPT, SOAP_MEC_STATE_FINAL, SOAP_MEC_STATE_FLUSH }; 136 | 137 | /** 138 | @struct soap_mec_data 139 | @brief The mecevp engine context data 140 | */ 141 | struct soap_mec_data 142 | { int alg; /**< The algorithm used */ 143 | enum SOAP_MEC_STATE state; /**< Decryption state */ 144 | EVP_CIPHER_CTX *ctx; /**< EVP_CIPHER_CTX context */ 145 | const EVP_CIPHER *type; /**< type for OpenInit/DecryptInit */ 146 | const EVP_PKEY *pkey; /**< private key for OpenInit */ 147 | unsigned char ekey[EVP_MAX_KEY_LENGTH];/**< ephemeral key */ 148 | const unsigned char *key; /**< secret key */ 149 | int keylen; /**< secret key length */ 150 | char *buf; /**< iv and stream buffer */ 151 | size_t bufidx; /**< current buffer index */ 152 | size_t buflen; /**< buffer max length */ 153 | char *rest; /**< non-encryption "flush" buffer */ 154 | size_t restlen; /**< non-encryption "flush" buffer length */ 155 | int i; /**< base64 conversion */ 156 | unsigned long m; /**< base64 conversion */ 157 | soap_mode mode; 158 | int (*ffiltersend)(struct soap*, const char**, size_t*); 159 | int (*ffilterrecv)(struct soap*, char*, size_t*, size_t); 160 | }; 161 | 162 | /******************************************************************************\ 163 | * 164 | * soap_mec API functions 165 | * 166 | \******************************************************************************/ 167 | 168 | int soap_mec_begin(struct soap *soap, struct soap_mec_data *data, int alg, SOAP_MEC_KEY_TYPE *pkey, unsigned char *key, int *keylen); 169 | int soap_mec_start_alg(struct soap *soap, int alg, const unsigned char *key); 170 | int soap_mec_start(struct soap *soap, const unsigned char *key); 171 | int soap_mec_stop(struct soap *soap); 172 | int soap_mec_end(struct soap *soap, struct soap_mec_data *data); 173 | 174 | size_t soap_mec_size(int alg, SOAP_MEC_KEY_TYPE *pkey); 175 | 176 | int soap_mec_init(struct soap *soap, struct soap_mec_data *data, int alg, SOAP_MEC_KEY_TYPE *pkey, unsigned char *key, int *keylen); 177 | int soap_mec_update(struct soap *soap, struct soap_mec_data *data, const char **s, size_t *n); 178 | int soap_mec_final(struct soap *soap, struct soap_mec_data *data, const char **s, size_t *n); 179 | void soap_mec_cleanup(struct soap *soap, struct soap_mec_data *data); 180 | 181 | #ifdef __cplusplus 182 | } 183 | #endif 184 | 185 | #endif 186 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/gsoap/smdevp.h: -------------------------------------------------------------------------------- 1 | /* 2 | smdevp.h 3 | 4 | gSOAP interface for (signed) message digest 5 | 6 | gSOAP XML Web services tools 7 | Copyright (C) 2000-2010, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 | This part of the software is released under one of the following licenses: 9 | GPL, the gSOAP public license, or Genivia's license for commercial use. 10 | -------------------------------------------------------------------------------- 11 | gSOAP public license. 12 | 13 | The contents of this file are subject to the gSOAP Public License Version 1.3 14 | (the "License"); you may not use this file except in compliance with the 15 | License. You may obtain a copy of the License at 16 | http://www.cs.fsu.edu/~engelen/soaplicense.html 17 | Software distributed under the License is distributed on an "AS IS" basis, 18 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 19 | for the specific language governing rights and limitations under the License. 20 | 21 | The Initial Developer of the Original Code is Robert A. van Engelen. 22 | Copyright (C) 2000-2010, Robert van Engelen, Genivia, Inc., All Rights Reserved. 23 | -------------------------------------------------------------------------------- 24 | GPL license. 25 | 26 | This program is free software; you can redistribute it and/or modify it under 27 | the terms of the GNU General Public License as published by the Free Software 28 | Foundation; either version 2 of the License, or (at your option) any later 29 | version. 30 | 31 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 32 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 33 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along with 36 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 37 | Place, Suite 330, Boston, MA 02111-1307 USA 38 | 39 | Author contact information: 40 | engelen@genivia.com / engelen@acm.org 41 | 42 | This program is released under the GPL with the additional exemption that 43 | compiling, linking, and/or using OpenSSL is allowed. 44 | -------------------------------------------------------------------------------- 45 | A commercial use license is available from Genivia, Inc., contact@genivia.com 46 | -------------------------------------------------------------------------------- 47 | */ 48 | 49 | #ifndef SMDEVP_H 50 | #define SMDEVP_H 51 | 52 | #include "stdsoap2.h" 53 | 54 | #ifdef WITH_OPENSSL 55 | #include 56 | #include 57 | #endif 58 | 59 | #ifdef __cplusplus 60 | extern "C" { 61 | #endif 62 | 63 | /** Expose EVP_PKEY in a portable representation */ 64 | #define SOAP_SMD_KEY_TYPE EVP_PKEY 65 | 66 | /** Expose EVP_MAX_MD_SIZE in a portable representation */ 67 | #define SOAP_SMD_MAX_SIZE EVP_MAX_MD_SIZE 68 | 69 | /** MD5 digest size in octets */ 70 | #define SOAP_SMD_MD5_SIZE (16) 71 | 72 | /** SHA1 digest size in octets */ 73 | #define SOAP_SMD_SHA1_SIZE (20) 74 | 75 | /** SHA256 digest size in octets */ 76 | #define SOAP_SMD_SHA256_SIZE (32) 77 | 78 | /** SHA512 digest size in octets */ 79 | #define SOAP_SMD_SHA512_SIZE (64) 80 | 81 | /******************************************************************************\ 82 | * 83 | * Supported algorithms 84 | * 85 | \******************************************************************************/ 86 | 87 | #define SOAP_SMD_NONE (0x0000) 88 | #define SOAP_SMD_HASH (0x0003) 89 | #define SOAP_SMD_ALGO (0x000C) 90 | #define SOAP_SMD_MASK (0x01FF) 91 | 92 | /** MD5 hash */ 93 | #define SOAP_SMD_MD5 (0x00) 94 | /** SHA1 hash */ 95 | #define SOAP_SMD_SHA1 (0x01) 96 | /** SHA256 hash */ 97 | #define SOAP_SMD_SHA256 (0x02) 98 | /** SHA512 hash */ 99 | #define SOAP_SMD_SHA512 (0x03) 100 | 101 | /** HMAC */ 102 | #define SOAP_SMD_HMAC (0x00) 103 | /** Digest */ 104 | #define SOAP_SMD_DGST (0x04) 105 | /** Sign */ 106 | #define SOAP_SMD_SIGN (0x08) 107 | /** Verify */ 108 | #define SOAP_SMD_VRFY (0x0C) 109 | 110 | /** DSA (RSA) signature */ 111 | #define SOAP_SMD_DSA (0x10) 112 | 113 | /** HMAC-MD5 shared key signature algorithm */ 114 | #define SOAP_SMD_HMAC_MD5 (SOAP_SMD_HMAC | SOAP_SMD_MD5) 115 | /** HMAC-SHA1 shared key signature algorithm */ 116 | #define SOAP_SMD_HMAC_SHA1 (SOAP_SMD_HMAC | SOAP_SMD_SHA1) 117 | /** HMAC-SHA256 shared key signature algorithm */ 118 | #define SOAP_SMD_HMAC_SHA256 (SOAP_SMD_HMAC | SOAP_SMD_SHA256) 119 | /** HMAC-SHA512 shared key signature algorithm */ 120 | #define SOAP_SMD_HMAC_SHA512 (SOAP_SMD_HMAC | SOAP_SMD_SHA512) 121 | 122 | /** DGST-MD5 digest algorithm */ 123 | #define SOAP_SMD_DGST_MD5 (SOAP_SMD_DGST | SOAP_SMD_MD5) 124 | /** DGST-SHA1 digest algorithm */ 125 | #define SOAP_SMD_DGST_SHA1 (SOAP_SMD_DGST | SOAP_SMD_SHA1) 126 | /** DGST-SHA256 digest algorithm */ 127 | #define SOAP_SMD_DGST_SHA256 (SOAP_SMD_DGST | SOAP_SMD_SHA256) 128 | /** DGST-SHA512 digest algorithm */ 129 | #define SOAP_SMD_DGST_SHA512 (SOAP_SMD_DGST | SOAP_SMD_SHA512) 130 | 131 | /** DSA-MD5 digest algorithm */ 132 | #define SOAP_SMD_DGST_MD5 (SOAP_SMD_DGST | SOAP_SMD_MD5) 133 | /** DGST-SHA1 digest algorithm */ 134 | #define SOAP_SMD_DGST_SHA1 (SOAP_SMD_DGST | SOAP_SMD_SHA1) 135 | /** DGST-SHA256 digest algorithm */ 136 | #define SOAP_SMD_DGST_SHA256 (SOAP_SMD_DGST | SOAP_SMD_SHA256) 137 | /** DGST-SHA512 digest algorithm */ 138 | #define SOAP_SMD_DGST_SHA512 (SOAP_SMD_DGST | SOAP_SMD_SHA512) 139 | 140 | /** RSA-MD5 secret key signature algorithm */ 141 | #define SOAP_SMD_SIGN_RSA_MD5 (SOAP_SMD_SIGN | SOAP_SMD_MD5) 142 | /** RSA-SHA1 secret key signature algorithm */ 143 | #define SOAP_SMD_SIGN_RSA_SHA1 (SOAP_SMD_SIGN | SOAP_SMD_SHA1) 144 | /** RSA-SHA256 secret key signature algorithm */ 145 | #define SOAP_SMD_SIGN_RSA_SHA256 (SOAP_SMD_SIGN | SOAP_SMD_SHA256) 146 | /** RSA-SHA512 secret key signature algorithm */ 147 | #define SOAP_SMD_SIGN_RSA_SHA512 (SOAP_SMD_SIGN | SOAP_SMD_SHA512) 148 | 149 | /** DSA-MD5 secret key signature algorithm */ 150 | #define SOAP_SMD_SIGN_DSA_MD5 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_MD5) 151 | /** DSA-SHA1 secret key signature algorithm */ 152 | #define SOAP_SMD_SIGN_DSA_SHA1 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA1) 153 | /** DSA-SHA256 secret key signature algorithm */ 154 | #define SOAP_SMD_SIGN_DSA_SHA256 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA256) 155 | /** DSA-SHA512 secret key signature algorithm */ 156 | #define SOAP_SMD_SIGN_DSA_SHA512 (SOAP_SMD_SIGN | SOAP_SMD_DSA | SOAP_SMD_SHA512) 157 | 158 | /** RSA-MD5 secret key signature verification algorithm */ 159 | #define SOAP_SMD_VRFY_RSA_MD5 (SOAP_SMD_VRFY | SOAP_SMD_MD5) 160 | /** RSA-SHA1 secret key signature verification algorithm */ 161 | #define SOAP_SMD_VRFY_RSA_SHA1 (SOAP_SMD_VRFY | SOAP_SMD_SHA1) 162 | /** RSA-SHA256 secret key signature verification algorithm */ 163 | #define SOAP_SMD_VRFY_RSA_SHA256 (SOAP_SMD_VRFY | SOAP_SMD_SHA256) 164 | /** RSA-SHA512 secret key signature verification algorithm */ 165 | #define SOAP_SMD_VRFY_RSA_SHA512 (SOAP_SMD_VRFY | SOAP_SMD_SHA512) 166 | 167 | /** DSA-MD5 secret key signature verification algorithm */ 168 | #define SOAP_SMD_VRFY_DSA_MD5 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_MD5) 169 | /** DSA-SHA1 secret key signature verification algorithm */ 170 | #define SOAP_SMD_VRFY_DSA_SHA1 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA1) 171 | /** DSA-SHA256 secret key signature verification algorithm */ 172 | #define SOAP_SMD_VRFY_DSA_SHA256 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA256) 173 | /** DSA-SHA512 secret key signature verification algorithm */ 174 | #define SOAP_SMD_VRFY_DSA_SHA512 (SOAP_SMD_VRFY | SOAP_SMD_DSA | SOAP_SMD_SHA512) 175 | 176 | /** Additional flag: msg sends will pass through digest/signature algorithm */ 177 | #define SOAP_SMD_PASSTHRU (0x100) 178 | 179 | /** 180 | @struct soap_smd_data 181 | @brief The smdevp engine context data, which is hooked up to soap->data[0] 182 | */ 183 | struct soap_smd_data 184 | { int alg; /**< The digest or signature algorithm used */ 185 | void *ctx; /**< EVP_MD_CTX or HMAC_CTX */ 186 | const void *key; /**< EVP_PKEY */ 187 | int (*fsend)(struct soap*, const char*, size_t); 188 | size_t (*frecv)(struct soap*, char*, size_t); 189 | soap_mode mode; /**< to preserve soap->mode value */ 190 | }; 191 | 192 | /******************************************************************************\ 193 | * 194 | * soap_smd API functions 195 | * 196 | \******************************************************************************/ 197 | 198 | size_t soap_smd_size(int alg, const void *key); 199 | 200 | int soap_smd_begin(struct soap *soap, int alg, const void *key, int keylen); 201 | int soap_smd_end(struct soap *soap, char *buf, int *len); 202 | 203 | int soap_smd_init(struct soap *soap, struct soap_smd_data *data, int alg, const void *key, int keylen); 204 | int soap_smd_update(struct soap *soap, struct soap_smd_data *data, const char *buf, size_t len); 205 | int soap_smd_final(struct soap *soap, struct soap_smd_data *data, char *buf, int *len); 206 | 207 | #ifdef __cplusplus 208 | } 209 | #endif 210 | 211 | #endif 212 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/gsoap/threads.h: -------------------------------------------------------------------------------- 1 | /* 2 | threads.h 3 | 4 | Portable threads and locks API 5 | 6 | gSOAP XML Web services tools 7 | Copyright (C) 2000-2010, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 | This part of the software is released under one of the following licenses: 9 | GPL, the gSOAP public license, or Genivia's license for commercial use. 10 | -------------------------------------------------------------------------------- 11 | gSOAP public license. 12 | 13 | The contents of this file are subject to the gSOAP Public License Version 1.3 14 | (the "License"); you may not use this file except in compliance with the 15 | License. You may obtain a copy of the License at 16 | http://www.cs.fsu.edu/~engelen/soaplicense.html 17 | Software distributed under the License is distributed on an "AS IS" basis, 18 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 19 | for the specific language governing rights and limitations under the License. 20 | 21 | The Initial Developer of the Original Code is Robert A. van Engelen. 22 | Copyright (C) 2000-2010, Robert van Engelen, Genivia Inc., All Rights Reserved. 23 | -------------------------------------------------------------------------------- 24 | GPL license. 25 | 26 | This program is free software; you can redistribute it and/or modify it under 27 | the terms of the GNU General Public License as published by the Free Software 28 | Foundation; either version 2 of the License, or (at your option) any later 29 | version. 30 | 31 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 32 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 33 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along with 36 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 37 | Place, Suite 330, Boston, MA 02111-1307 USA 38 | 39 | Author contact information: 40 | engelen@genivia.com / engelen@acm.org 41 | 42 | This program is released under the GPL with the additional exemption that 43 | compiling, linking, and/or using OpenSSL is allowed. 44 | -------------------------------------------------------------------------------- 45 | A commercial use license is available from Genivia, Inc., contact@genivia.com 46 | -------------------------------------------------------------------------------- 47 | */ 48 | 49 | /** 50 | 51 | @page threads Portable threads and locking support 52 | 53 | The threads.h and threads.c code define the following portable API: 54 | 55 | - THREAD_TYPE portable thread type 56 | - THREAD_ID returns current thread ID of type THREAD_TYPE* 57 | - THREAD_CREATE(t,f,a) start a thread (THREAD_TYPE*)t that calls f(a) 58 | - THREAD_DETACH(t) detach thread (THREAD_TYPE*)t 59 | - THREAD_JOIN(t) wait to join (THREAD_TYPE*)t 60 | - THREAD_EXIT exit the current thread 61 | - THREAD_CANCEL(t) kill a thread, dangerous, use only in extreme cases! 62 | 63 | - MUTEX_TYPE portable mutex type 64 | - MUTEX_INITIALIZER global initializer value for static locks 65 | - MUTEX_SETUP(m) setup lock (MUTEX_TYPE*)m 66 | - MUTEX_CLEANUP(m) cleanup lock (MUTEX_TYPE*)m 67 | - MUTEX_LOCK(m) acquire lock (MUTEX_TYPE*)m 68 | - MUTEX_UNLOCK(m) release lock (MUTEX_TYPE*)m 69 | 70 | - COND_TYPE portable condition variable type 71 | - COND_SETUP(c) setup condition variable (COND_TYPE*)c 72 | - COND_CLEANUP(c) cleanup condition variable (COND_TYPE*)c 73 | - COND_SIGNAL(c) signal condition variable (COND_TYPE*)c 74 | - COND_WAIT(c,m) wait on variable (COND_TYPE*)c in mutex (MUTEX_TYPE*)m 75 | 76 | */ 77 | 78 | #ifndef THREADS_H 79 | #define THREADS_H 80 | 81 | #ifndef WIN32 82 | # include /* defines _POSIX_THREADS if pthreads are available */ 83 | #else 84 | # define ssize_t int 85 | # include 86 | # include 87 | # include 88 | # include 89 | #endif 90 | 91 | #if defined(_POSIX_THREADS) || defined(_SC_THREADS) 92 | # include 93 | #endif 94 | 95 | /******************************************************************************\ 96 | * 97 | * Threads 98 | * 99 | \******************************************************************************/ 100 | 101 | #if defined(WIN32) 102 | # define THREAD_TYPE HANDLE 103 | # define THREAD_ID GetCurrentThreadId() 104 | # define THREAD_CREATE(x,y,z) *(x) = (HANDLE)_beginthread((y), 8*4096, (z)) 105 | # define THREAD_DETACH(x) 106 | # define THREAD_JOIN(x) WaitForSingleObject((x), INFINITE) 107 | # define THREAD_EXIT _endthread() 108 | # define THREAD_CANCEL(x) TerminateThread(x, 0) 109 | # define MUTEX_TYPE HANDLE 110 | # define MUTEX_INITIALIZER NULL 111 | # define MUTEX_SETUP(x) (x) = CreateMutex(NULL, FALSE, NULL) 112 | # define MUTEX_CLEANUP(x) (CloseHandle(x) == 0) 113 | # define MUTEX_LOCK(x) emulate_pthread_mutex_lock(&(x)) 114 | # define MUTEX_UNLOCK(x) (ReleaseMutex(x) == 0) 115 | # define COND_SETUP(x) emulate_pthread_cond_init(&(x)) 116 | # define COND_CLEANUP(x) emulate_pthread_cond_destroy(&(x)) 117 | # define COND_SIGNAL(x) emulate_pthread_cond_signal(&(x)) 118 | # define COND_WAIT(x,y) emulate_pthread_cond_wait(&(x), &(y)) 119 | typedef struct 120 | { UINT waiters_count_; 121 | CRITICAL_SECTION waiters_count_lock_; 122 | HANDLE signal_event_; 123 | } COND_TYPE; 124 | #ifdef __cplusplus 125 | extern "C" { 126 | #endif 127 | int emulate_pthread_mutex_lock(volatile MUTEX_TYPE*); 128 | int emulate_pthread_cond_init(COND_TYPE*); 129 | int emulate_pthread_cond_destroy(COND_TYPE*); 130 | int emulate_pthread_cond_signal(COND_TYPE*); 131 | int emulate_pthread_cond_wait(COND_TYPE*, MUTEX_TYPE*); 132 | #ifdef __cplusplus 133 | } 134 | #endif 135 | #elif defined(_POSIX_THREADS) || defined(_SC_THREADS) 136 | # define THREAD_TYPE pthread_t 137 | # define THREAD_ID pthread_self() 138 | # define THREAD_CREATE(x,y,z) pthread_create((x), NULL, (y), (z)) 139 | # define THREAD_DETACH(x) pthread_detach((x)) 140 | # define THREAD_JOIN(x) pthread_join((x), NULL) 141 | # define THREAD_EXIT pthread_exit(NULL) 142 | # define THREAD_CANCEL(x) pthread_cancel(x) 143 | # define MUTEX_TYPE pthread_mutex_t 144 | # define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER 145 | # define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL) 146 | # define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x)) 147 | #if 0 /* 1: DEBUG MUTEX */ 148 | # define MUTEX_LOCK(x) (fprintf(stderr, "! LOCK %p %s:%d\n", &x, __FILE__, __LINE__), pthread_mutex_lock(&(x))) 149 | # define MUTEX_UNLOCK(x) (fprintf(stderr, "! UNLOCK %p %s:%d\n", &x, __FILE__, __LINE__), pthread_mutex_unlock(&(x))) 150 | #else 151 | # define MUTEX_LOCK(x) pthread_mutex_lock(&(x)) 152 | # define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x)) 153 | #endif 154 | # define COND_TYPE pthread_cond_t 155 | # define COND_SETUP(x) pthread_cond_init(&(x), NULL) 156 | # define COND_CLEANUP(x) pthread_cond_destroy(&(x)) 157 | # define COND_SIGNAL(x) pthread_cond_signal(&(x)) 158 | # define COND_WAIT(x,y) pthread_cond_wait(&(x), &(y)) 159 | #else 160 | # error "No POSIX threads detected: we need thread and mutex operations. See for example OpenSSL /threads/th-lock.c on how to implement mutex on your platform" 161 | #endif 162 | 163 | #endif 164 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/gsoap/wsaapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | wsaapi.h 3 | 4 | WS-Addressing plugin 5 | 6 | gSOAP XML Web services tools 7 | Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 | This part of the software is released under one of the following licenses: 9 | GPL, the gSOAP public license, or Genivia's license for commercial use. 10 | -------------------------------------------------------------------------------- 11 | gSOAP public license. 12 | 13 | The contents of this file are subject to the gSOAP Public License Version 1.3 14 | (the "License"); you may not use this file except in compliance with the 15 | License. You may obtain a copy of the License at 16 | http://www.cs.fsu.edu/~engelen/soaplicense.html 17 | Software distributed under the License is distributed on an "AS IS" basis, 18 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 19 | for the specific language governing rights and limitations under the License. 20 | 21 | The Initial Developer of the Original Code is Robert A. van Engelen. 22 | Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved. 23 | -------------------------------------------------------------------------------- 24 | GPL license. 25 | 26 | This program is free software; you can redistribute it and/or modify it under 27 | the terms of the GNU General Public License as published by the Free Software 28 | Foundation; either version 2 of the License, or (at your option) any later 29 | version. 30 | 31 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 32 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 33 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along with 36 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 37 | Place, Suite 330, Boston, MA 02111-1307 USA 38 | 39 | Author contact information: 40 | engelen@genivia.com / engelen@acm.org 41 | 42 | This program is released under the GPL with the additional exemption that 43 | compiling, linking, and/or using OpenSSL is allowed. 44 | -------------------------------------------------------------------------------- 45 | A commercial use license is available from Genivia, Inc., contact@genivia.com 46 | -------------------------------------------------------------------------------- 47 | */ 48 | 49 | #ifndef WSAAPI_H 50 | #define WSAAPI_H 51 | 52 | #include "soapH.h" /* replace with soapcpp2-generated *H.h file */ 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** plugin identification for plugin registry */ 59 | #define SOAP_WSA_ID "SOAP-WSA-1.3" 60 | 61 | /** plugin identification for plugin registry */ 62 | extern const char soap_wsa_id[]; 63 | 64 | extern const char *soap_wsa_noneURI; 65 | extern const char *soap_wsa_anonymousURI; 66 | extern const char *soap_wsa_faultAction; 67 | 68 | #if defined(SOAP_WSA_2003) 69 | # define SOAP_WSA(member) wsa3__##member 70 | # define SOAP_WSA_(prefix,member) prefix##_wsa3__##member 71 | # define SOAP_WSA__(prefix,member) prefix##wsa3__##member 72 | #elif defined(SOAP_WSA_2004) 73 | # define SOAP_WSA(member) wsa4__##member 74 | # define SOAP_WSA_(prefix,member) prefix##_wsa4__##member 75 | # define SOAP_WSA__(prefix,member) prefix##wsa4__##member 76 | #elif defined(SOAP_WSA_2005) 77 | # define SOAP_WSA(member) wsa5__##member 78 | # define SOAP_WSA_(prefix,member) prefix##_wsa5__##member 79 | # define SOAP_WSA__(prefix,member) prefix##wsa5__##member 80 | #else 81 | # define SOAP_WSA(member) wsa__##member 82 | # define SOAP_WSA_(prefix,member) prefix##_wsa__##member 83 | # define SOAP_WSA__(prefix,member) prefix##wsa__##member 84 | #endif 85 | 86 | /** 87 | @struct soap_wsa_data 88 | @brief plugin data to override callbacks 89 | */ 90 | struct soap_wsa_data 91 | { /** fheader callback is invoked immediately after parsing a SOAP Header */ 92 | int (*fheader)(struct soap*); 93 | /** fseterror callback is used to inspect and change gSOAP error codes */ 94 | void (*fseterror)(struct soap*, const char**, const char**); 95 | /** fresponse callback is used to change a HTTP response into a HTTP POST */ 96 | int (*fresponse)(struct soap*, int, size_t); 97 | /** fdisconnect callback is used to accept HTTP 202 */ 98 | int (*fdisconnect)(struct soap*); 99 | }; 100 | 101 | int soap_wsa(struct soap *soap, struct soap_plugin *p, void *arg); 102 | 103 | const char *soap_wsa_rand_uuid(struct soap *soap); 104 | 105 | int soap_wsa_request(struct soap *soap, const char *id, const char *to, const char *action); 106 | int soap_wsa_add_From(struct soap *soap, const char *endpoint); 107 | int soap_wsa_add_NoReply(struct soap *soap); 108 | int soap_wsa_add_ReplyTo(struct soap *soap, const char *endpoint); 109 | int soap_wsa_add_FaultTo(struct soap *soap, const char *endpoint); 110 | int soap_wsa_add_RelatesTo(struct soap *soap, const char *endpoint); 111 | const char *soap_wsa_From(struct soap *soap); 112 | const char *soap_wsa_ReplyTo(struct soap *soap); 113 | const char *soap_wsa_FaultTo(struct soap *soap); 114 | const char *soap_wsa_RelatesTo(struct soap *soap); 115 | 116 | int soap_wsa_check(struct soap *soap); 117 | int soap_wsa_reply(struct soap *soap, const char *id, const char *action); 118 | int soap_wsa_fault_subcode(struct soap *soap, int flag, const char *faultsubcode, const char *faultstring, const char *faultdetail); 119 | int soap_wsa_fault_subcode_action(struct soap *soap, int flag, const char *faultsubcode, const char *faultstring, const char *faultdetail, const char *action); 120 | int soap_wsa_sender_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail); 121 | int soap_wsa_sender_fault_subcode_action(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail, const char *action); 122 | int soap_wsa_receiver_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail); 123 | int soap_wsa_receiver_fault_subcode_action(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail, const char *action); 124 | int soap_wsa_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetail); 125 | int soap_wsa_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail); 126 | 127 | #if defined(SOAP_WSA_2005) 128 | int soap_wsa_check_fault(struct soap *soap, SOAP_WSA(FaultCodesType) *fault, const char **info); 129 | int soap_wsa_error(struct soap *soap, SOAP_WSA(FaultCodesType) fault, const char *info); 130 | #elif defined(SOAP_WSA_2003) 131 | int soap_wsa_check_fault(struct soap *soap, char **fault); 132 | int soap_wsa_error(struct soap *soap, const char *fault); 133 | #else 134 | int soap_wsa_check_fault(struct soap *soap, SOAP_WSA(FaultSubcodeValues) *fault); 135 | int soap_wsa_error(struct soap *soap, SOAP_WSA(FaultSubcodeValues) fault); 136 | #endif 137 | 138 | #ifdef __cplusplus 139 | } 140 | #endif 141 | 142 | #endif 143 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/onvif/DeviceBinding.nsmap: -------------------------------------------------------------------------------- 1 | 2 | #include "soapH.h" 3 | SOAP_NMAC struct Namespace namespaces[] = 4 | { 5 | {"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope", "http://schemas.xmlsoap.org/soap/envelope/", NULL}, 6 | {"SOAP-ENC", "http://www.w3.org/2003/05/soap-encoding", "http://schemas.xmlsoap.org/soap/encoding/", NULL}, 7 | {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, 8 | {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, 9 | {"chan", "http://schemas.microsoft.com/ws/2005/02/duplex", NULL, NULL}, 10 | {"wsa5", "http://www.w3.org/2005/08/addressing", "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL}, 11 | {"c14n", "http://www.w3.org/2001/10/xml-exc-c14n#", NULL, NULL}, 12 | {"wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", NULL, NULL}, 13 | {"xenc", "http://www.w3.org/2001/04/xmlenc#", NULL, NULL}, 14 | {"wsc", "http://schemas.xmlsoap.org/ws/2005/02/sc", NULL, NULL}, 15 | {"ds", "http://www.w3.org/2000/09/xmldsig#", NULL, NULL}, 16 | {"wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", NULL}, 17 | {"xmime", "http://tempuri.org/xmime.xsd", NULL, NULL}, 18 | {"xop", "http://www.w3.org/2004/08/xop/include", NULL, NULL}, 19 | {"tt", "http://www.onvif.org/ver10/schema", NULL, NULL}, 20 | {"wsnt", "http://docs.oasis-open.org/wsn/b-2", NULL, NULL}, 21 | {"wsrfbf", "http://docs.oasis-open.org/wsrf/bf-2", NULL, NULL}, 22 | {"wstop", "http://docs.oasis-open.org/wsn/t-1", NULL, NULL}, 23 | {"tds", "http://www.onvif.org/ver10/device/wsdl", NULL, NULL}, 24 | {"tptz", "http://www.onvif.org/ver20/ptz/wsdl", NULL, NULL}, 25 | {"trt", "http://www.onvif.org/ver10/media/wsdl", NULL, NULL}, 26 | {NULL, NULL, NULL, NULL} 27 | }; 28 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/onvif/MediaBinding.nsmap: -------------------------------------------------------------------------------- 1 | 2 | #include "soapH.h" 3 | SOAP_NMAC struct Namespace namespaces[] = 4 | { 5 | {"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope", "http://schemas.xmlsoap.org/soap/envelope/", NULL}, 6 | {"SOAP-ENC", "http://www.w3.org/2003/05/soap-encoding", "http://schemas.xmlsoap.org/soap/encoding/", NULL}, 7 | {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, 8 | {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, 9 | {"chan", "http://schemas.microsoft.com/ws/2005/02/duplex", NULL, NULL}, 10 | {"wsa5", "http://www.w3.org/2005/08/addressing", "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL}, 11 | {"c14n", "http://www.w3.org/2001/10/xml-exc-c14n#", NULL, NULL}, 12 | {"wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", NULL, NULL}, 13 | {"xenc", "http://www.w3.org/2001/04/xmlenc#", NULL, NULL}, 14 | {"wsc", "http://schemas.xmlsoap.org/ws/2005/02/sc", NULL, NULL}, 15 | {"ds", "http://www.w3.org/2000/09/xmldsig#", NULL, NULL}, 16 | {"wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", NULL}, 17 | {"xmime", "http://tempuri.org/xmime.xsd", NULL, NULL}, 18 | {"xop", "http://www.w3.org/2004/08/xop/include", NULL, NULL}, 19 | {"tt", "http://www.onvif.org/ver10/schema", NULL, NULL}, 20 | {"wsnt", "http://docs.oasis-open.org/wsn/b-2", NULL, NULL}, 21 | {"wsrfbf", "http://docs.oasis-open.org/wsrf/bf-2", NULL, NULL}, 22 | {"wstop", "http://docs.oasis-open.org/wsn/t-1", NULL, NULL}, 23 | {"tds", "http://www.onvif.org/ver10/device/wsdl", NULL, NULL}, 24 | {"tptz", "http://www.onvif.org/ver20/ptz/wsdl", NULL, NULL}, 25 | {"trt", "http://www.onvif.org/ver10/media/wsdl", NULL, NULL}, 26 | {NULL, NULL, NULL, NULL} 27 | }; 28 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/onvif/PTZBinding.nsmap: -------------------------------------------------------------------------------- 1 | 2 | #include "soapH.h" 3 | SOAP_NMAC struct Namespace namespaces[] = 4 | { 5 | {"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope", "http://schemas.xmlsoap.org/soap/envelope/", NULL}, 6 | {"SOAP-ENC", "http://www.w3.org/2003/05/soap-encoding", "http://schemas.xmlsoap.org/soap/encoding/", NULL}, 7 | {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, 8 | {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, 9 | {"chan", "http://schemas.microsoft.com/ws/2005/02/duplex", NULL, NULL}, 10 | {"wsa5", "http://www.w3.org/2005/08/addressing", "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL}, 11 | {"c14n", "http://www.w3.org/2001/10/xml-exc-c14n#", NULL, NULL}, 12 | {"wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", NULL, NULL}, 13 | {"xenc", "http://www.w3.org/2001/04/xmlenc#", NULL, NULL}, 14 | {"wsc", "http://schemas.xmlsoap.org/ws/2005/02/sc", NULL, NULL}, 15 | {"ds", "http://www.w3.org/2000/09/xmldsig#", NULL, NULL}, 16 | {"wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", NULL}, 17 | {"xmime", "http://tempuri.org/xmime.xsd", NULL, NULL}, 18 | {"xop", "http://www.w3.org/2004/08/xop/include", NULL, NULL}, 19 | {"tt", "http://www.onvif.org/ver10/schema", NULL, NULL}, 20 | {"wsnt", "http://docs.oasis-open.org/wsn/b-2", NULL, NULL}, 21 | {"wsrfbf", "http://docs.oasis-open.org/wsrf/bf-2", NULL, NULL}, 22 | {"wstop", "http://docs.oasis-open.org/wsn/t-1", NULL, NULL}, 23 | {"tds", "http://www.onvif.org/ver10/device/wsdl", NULL, NULL}, 24 | {"tptz", "http://www.onvif.org/ver20/ptz/wsdl", NULL, NULL}, 25 | {"trt", "http://www.onvif.org/ver10/media/wsdl", NULL, NULL}, 26 | {NULL, NULL, NULL, NULL} 27 | }; 28 | -------------------------------------------------------------------------------- /3rdparty/onvif/include/onvif/soapPTZBindingService.h: -------------------------------------------------------------------------------- 1 | /* soapPTZBindingService.h 2 | Generated by gSOAP 2.8.17r from onvif.h 3 | 4 | Copyright(C) 2000-2013, Robert van Engelen, Genivia Inc. All Rights Reserved. 5 | The generated code is released under one of the following licenses: 6 | GPL or Genivia's license for commercial use. 7 | This program is released under the GPL with the additional exemption that 8 | compiling, linking, and/or using OpenSSL is allowed. 9 | */ 10 | 11 | #ifndef soapPTZBindingService_H 12 | #define soapPTZBindingService_H 13 | #include "soapH.h" 14 | class SOAP_CMAC PTZBindingService 15 | { public: 16 | struct soap *soap; 17 | bool own; 18 | /// Constructor 19 | PTZBindingService(); 20 | /// Constructor to use/share an engine state 21 | PTZBindingService(struct soap*); 22 | /// Constructor with engine input+output mode control 23 | PTZBindingService(soap_mode iomode); 24 | /// Constructor with engine input and output mode control 25 | PTZBindingService(soap_mode imode, soap_mode omode); 26 | /// Destructor, also frees all deserialized data 27 | virtual ~PTZBindingService(); 28 | /// Delete all deserialized data (with soap_destroy and soap_end) 29 | virtual void destroy(); 30 | /// Delete all deserialized data and reset to defaults 31 | virtual void reset(); 32 | /// Initializer used by constructor 33 | virtual void PTZBindingService_init(soap_mode imode, soap_mode omode); 34 | /// Create a copy 35 | virtual PTZBindingService *copy() SOAP_PURE_VIRTUAL; 36 | /// Close connection (normally automatic) 37 | virtual int soap_close_socket(); 38 | /// Force close connection (can kill a thread blocked on IO) 39 | virtual int soap_force_close_socket(); 40 | /// Return sender-related fault to sender 41 | virtual int soap_senderfault(const char *string, const char *detailXML); 42 | /// Return sender-related fault with SOAP 1.2 subcode to sender 43 | virtual int soap_senderfault(const char *subcodeQName, const char *string, const char *detailXML); 44 | /// Return receiver-related fault to sender 45 | virtual int soap_receiverfault(const char *string, const char *detailXML); 46 | /// Return receiver-related fault with SOAP 1.2 subcode to sender 47 | virtual int soap_receiverfault(const char *subcodeQName, const char *string, const char *detailXML); 48 | /// Print fault 49 | virtual void soap_print_fault(FILE*); 50 | #ifndef WITH_LEAN 51 | /// Print fault to stream 52 | #ifndef WITH_COMPAT 53 | virtual void soap_stream_fault(std::ostream&); 54 | #endif 55 | /// Put fault into buffer 56 | virtual char *soap_sprint_fault(char *buf, size_t len); 57 | #endif 58 | /// Disables and removes SOAP Header from message 59 | virtual void soap_noheader(); 60 | /// Put SOAP Header in message 61 | virtual void soap_header(char *wsa5__MessageID, struct wsa5__RelatesToType *wsa5__RelatesTo, struct wsa5__EndpointReferenceType *wsa5__From, struct wsa5__EndpointReferenceType *wsa5__ReplyTo, struct wsa5__EndpointReferenceType *wsa5__FaultTo, char *wsa5__To, char *wsa5__Action, struct chan__ChannelInstanceType *chan__ChannelInstance, struct _wsse__Security *wsse__Security); 62 | /// Get SOAP Header structure (NULL when absent) 63 | virtual const SOAP_ENV__Header *soap_header(); 64 | /// Run simple single-thread iterative service on port until a connection error occurs (returns error code or SOAP_OK), use this->bind_flag = SO_REUSEADDR to rebind for a rerun 65 | virtual int run(int port); 66 | /// Bind service to port (returns master socket or SOAP_INVALID_SOCKET) 67 | virtual SOAP_SOCKET bind(const char *host, int port, int backlog); 68 | /// Accept next request (returns socket or SOAP_INVALID_SOCKET) 69 | virtual SOAP_SOCKET accept(); 70 | #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS) 71 | /// Then accept SSL handshake, when SSL is used 72 | virtual int ssl_accept(); 73 | #endif 74 | /// Serve this request (returns error code or SOAP_OK) 75 | virtual int serve(); 76 | /// Used by serve() to dispatch a request (returns error code or SOAP_OK) 77 | virtual int dispatch(); 78 | 79 | /// 80 | /// Service operations (you should define these): 81 | /// Note: compile with -DWITH_PURE_VIRTUAL for pure virtual methods 82 | /// 83 | 84 | /// Web service operation 'GetServiceCapabilities' (returns error code or SOAP_OK) 85 | virtual int GetServiceCapabilities(_tptz__GetServiceCapabilities *tptz__GetServiceCapabilities, _tptz__GetServiceCapabilitiesResponse *tptz__GetServiceCapabilitiesResponse) SOAP_PURE_VIRTUAL; 86 | 87 | /// Web service operation 'GetConfigurations' (returns error code or SOAP_OK) 88 | virtual int GetConfigurations(_tptz__GetConfigurations *tptz__GetConfigurations, _tptz__GetConfigurationsResponse *tptz__GetConfigurationsResponse) SOAP_PURE_VIRTUAL; 89 | 90 | /// Web service operation 'GetPresets' (returns error code or SOAP_OK) 91 | virtual int GetPresets(_tptz__GetPresets *tptz__GetPresets, _tptz__GetPresetsResponse *tptz__GetPresetsResponse) SOAP_PURE_VIRTUAL; 92 | 93 | /// Web service operation 'SetPreset' (returns error code or SOAP_OK) 94 | virtual int SetPreset(_tptz__SetPreset *tptz__SetPreset, _tptz__SetPresetResponse *tptz__SetPresetResponse) SOAP_PURE_VIRTUAL; 95 | 96 | /// Web service operation 'RemovePreset' (returns error code or SOAP_OK) 97 | virtual int RemovePreset(_tptz__RemovePreset *tptz__RemovePreset, _tptz__RemovePresetResponse *tptz__RemovePresetResponse) SOAP_PURE_VIRTUAL; 98 | 99 | /// Web service operation 'GotoPreset' (returns error code or SOAP_OK) 100 | virtual int GotoPreset(_tptz__GotoPreset *tptz__GotoPreset, _tptz__GotoPresetResponse *tptz__GotoPresetResponse) SOAP_PURE_VIRTUAL; 101 | 102 | /// Web service operation 'GetStatus' (returns error code or SOAP_OK) 103 | virtual int GetStatus(_tptz__GetStatus *tptz__GetStatus, _tptz__GetStatusResponse *tptz__GetStatusResponse) SOAP_PURE_VIRTUAL; 104 | 105 | /// Web service operation 'GetConfiguration' (returns error code or SOAP_OK) 106 | virtual int GetConfiguration(_tptz__GetConfiguration *tptz__GetConfiguration, _tptz__GetConfigurationResponse *tptz__GetConfigurationResponse) SOAP_PURE_VIRTUAL; 107 | 108 | /// Web service operation 'GetNodes' (returns error code or SOAP_OK) 109 | virtual int GetNodes(_tptz__GetNodes *tptz__GetNodes, _tptz__GetNodesResponse *tptz__GetNodesResponse) SOAP_PURE_VIRTUAL; 110 | 111 | /// Web service operation 'GetNode' (returns error code or SOAP_OK) 112 | virtual int GetNode(_tptz__GetNode *tptz__GetNode, _tptz__GetNodeResponse *tptz__GetNodeResponse) SOAP_PURE_VIRTUAL; 113 | 114 | /// Web service operation 'SetConfiguration' (returns error code or SOAP_OK) 115 | virtual int SetConfiguration(_tptz__SetConfiguration *tptz__SetConfiguration, _tptz__SetConfigurationResponse *tptz__SetConfigurationResponse) SOAP_PURE_VIRTUAL; 116 | 117 | /// Web service operation 'GetConfigurationOptions' (returns error code or SOAP_OK) 118 | virtual int GetConfigurationOptions(_tptz__GetConfigurationOptions *tptz__GetConfigurationOptions, _tptz__GetConfigurationOptionsResponse *tptz__GetConfigurationOptionsResponse) SOAP_PURE_VIRTUAL; 119 | 120 | /// Web service operation 'GotoHomePosition' (returns error code or SOAP_OK) 121 | virtual int GotoHomePosition(_tptz__GotoHomePosition *tptz__GotoHomePosition, _tptz__GotoHomePositionResponse *tptz__GotoHomePositionResponse) SOAP_PURE_VIRTUAL; 122 | 123 | /// Web service operation 'SetHomePosition' (returns error code or SOAP_OK) 124 | virtual int SetHomePosition(_tptz__SetHomePosition *tptz__SetHomePosition, _tptz__SetHomePositionResponse *tptz__SetHomePositionResponse) SOAP_PURE_VIRTUAL; 125 | 126 | /// Web service operation 'ContinuousMove' (returns error code or SOAP_OK) 127 | virtual int ContinuousMove(_tptz__ContinuousMove *tptz__ContinuousMove, _tptz__ContinuousMoveResponse *tptz__ContinuousMoveResponse) SOAP_PURE_VIRTUAL; 128 | 129 | /// Web service operation 'RelativeMove' (returns error code or SOAP_OK) 130 | virtual int RelativeMove(_tptz__RelativeMove *tptz__RelativeMove, _tptz__RelativeMoveResponse *tptz__RelativeMoveResponse) SOAP_PURE_VIRTUAL; 131 | 132 | /// Web service operation 'SendAuxiliaryCommand' (returns error code or SOAP_OK) 133 | virtual int SendAuxiliaryCommand(_tptz__SendAuxiliaryCommand *tptz__SendAuxiliaryCommand, _tptz__SendAuxiliaryCommandResponse *tptz__SendAuxiliaryCommandResponse) SOAP_PURE_VIRTUAL; 134 | 135 | /// Web service operation 'AbsoluteMove' (returns error code or SOAP_OK) 136 | virtual int AbsoluteMove(_tptz__AbsoluteMove *tptz__AbsoluteMove, _tptz__AbsoluteMoveResponse *tptz__AbsoluteMoveResponse) SOAP_PURE_VIRTUAL; 137 | 138 | /// Web service operation 'Stop' (returns error code or SOAP_OK) 139 | virtual int Stop(_tptz__Stop *tptz__Stop, _tptz__StopResponse *tptz__StopResponse) SOAP_PURE_VIRTUAL; 140 | 141 | /// Web service operation 'GetPresetTours' (returns error code or SOAP_OK) 142 | virtual int GetPresetTours(_tptz__GetPresetTours *tptz__GetPresetTours, _tptz__GetPresetToursResponse *tptz__GetPresetToursResponse) SOAP_PURE_VIRTUAL; 143 | 144 | /// Web service operation 'GetPresetTour' (returns error code or SOAP_OK) 145 | virtual int GetPresetTour(_tptz__GetPresetTour *tptz__GetPresetTour, _tptz__GetPresetTourResponse *tptz__GetPresetTourResponse) SOAP_PURE_VIRTUAL; 146 | 147 | /// Web service operation 'GetPresetTourOptions' (returns error code or SOAP_OK) 148 | virtual int GetPresetTourOptions(_tptz__GetPresetTourOptions *tptz__GetPresetTourOptions, _tptz__GetPresetTourOptionsResponse *tptz__GetPresetTourOptionsResponse) SOAP_PURE_VIRTUAL; 149 | 150 | /// Web service operation 'CreatePresetTour' (returns error code or SOAP_OK) 151 | virtual int CreatePresetTour(_tptz__CreatePresetTour *tptz__CreatePresetTour, _tptz__CreatePresetTourResponse *tptz__CreatePresetTourResponse) SOAP_PURE_VIRTUAL; 152 | 153 | /// Web service operation 'ModifyPresetTour' (returns error code or SOAP_OK) 154 | virtual int ModifyPresetTour(_tptz__ModifyPresetTour *tptz__ModifyPresetTour, _tptz__ModifyPresetTourResponse *tptz__ModifyPresetTourResponse) SOAP_PURE_VIRTUAL; 155 | 156 | /// Web service operation 'OperatePresetTour' (returns error code or SOAP_OK) 157 | virtual int OperatePresetTour(_tptz__OperatePresetTour *tptz__OperatePresetTour, _tptz__OperatePresetTourResponse *tptz__OperatePresetTourResponse) SOAP_PURE_VIRTUAL; 158 | 159 | /// Web service operation 'RemovePresetTour' (returns error code or SOAP_OK) 160 | virtual int RemovePresetTour(_tptz__RemovePresetTour *tptz__RemovePresetTour, _tptz__RemovePresetTourResponse *tptz__RemovePresetTourResponse) SOAP_PURE_VIRTUAL; 161 | 162 | /// Web service operation 'GetCompatibleConfigurations' (returns error code or SOAP_OK) 163 | virtual int GetCompatibleConfigurations(_tptz__GetCompatibleConfigurations *tptz__GetCompatibleConfigurations, _tptz__GetCompatibleConfigurationsResponse *tptz__GetCompatibleConfigurationsResponse) SOAP_PURE_VIRTUAL; 164 | }; 165 | #endif 166 | -------------------------------------------------------------------------------- /3rdparty/onvif/src/gsoap/duration.c: -------------------------------------------------------------------------------- 1 | /* 2 | duration.c 3 | 4 | Custom serializer for xsd:duration stored in a LONG64 with ms precision 5 | - the LONG64 int can represent 106751991167 days forward and backward 6 | - LONG64 is long long int under Unix/Linux 7 | - millisecond resolution (1/1000 sec) means 1 second = 1000 8 | - when adding to a time_t value, conversion may be needed since time_t 9 | may (or may) not have seconds resolution 10 | - durations longer than a month are always output in days, rather than 11 | months to avoid days-per-month conversion 12 | - durations expressed in years and months are not well defined, since 13 | there is no reference starting time; the decoder assumes 30 days per 14 | month and conversion of P4M gives 120 days and therefore the duration 15 | P4M and P120D are assumed identical, while they may yield different 16 | result depending on the reference starting time 17 | 18 | Compile this file and link it with your code. 19 | 20 | gSOAP XML Web services tools 21 | Copyright (C) 2000-2009, Robert van Engelen, Genivia Inc., All Rights Reserved. 22 | This part of the software is released under ONE of the following licenses: 23 | GPL, the gSOAP public license, OR Genivia's license for commercial use. 24 | -------------------------------------------------------------------------------- 25 | gSOAP public license. 26 | 27 | The contents of this file are subject to the gSOAP Public License Version 1.3 28 | (the "License"); you may not use this file except in compliance with the 29 | License. You may obtain a copy of the License at 30 | http://www.cs.fsu.edu/~engelen/soaplicense.html 31 | Software distributed under the License is distributed on an "AS IS" basis, 32 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 33 | for the specific language governing rights and limitations under the License. 34 | 35 | The Initial Developer of the Original Code is Robert A. van Engelen. 36 | Copyright (C) 2000-2009, Robert van Engelen, Genivia, Inc., All Rights Reserved. 37 | -------------------------------------------------------------------------------- 38 | GPL license. 39 | 40 | This program is free software; you can redistribute it and/or modify it under 41 | the terms of the GNU General Public License as published by the Free Software 42 | Foundation; either version 2 of the License, or (at your option) any later 43 | version. 44 | 45 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 46 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 47 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 48 | 49 | You should have received a copy of the GNU General Public License along with 50 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 51 | Place, Suite 330, Boston, MA 02111-1307 USA 52 | 53 | Author contact information: 54 | engelen@genivia.com / engelen@acm.org 55 | 56 | This program is released under the GPL with the additional exemption that 57 | compiling, linking, and/or using OpenSSL is allowed. 58 | -------------------------------------------------------------------------------- 59 | A commercial use license is available from Genivia, Inc., contact@genivia.com 60 | -------------------------------------------------------------------------------- 61 | */ 62 | 63 | /* soapH.h generated by soapcpp2 from .h file containing #import "duration.h":*/ 64 | #include "soapH.h" 65 | 66 | void soap_default_xsd__duration(struct soap *soap, LONG64 *a) 67 | { (void)soap; /* appease -Wall -Werror */ 68 | *a = 0; 69 | } 70 | 71 | const char *soap_xsd__duration2s(struct soap *soap, LONG64 a) 72 | { LONG64 d; 73 | int k, h, m, s, f; 74 | if (a < 0) 75 | { strcpy(soap->tmpbuf, "-P"); 76 | k = 2; 77 | a = -a; 78 | } 79 | else 80 | { strcpy(soap->tmpbuf, "P"); 81 | k = 1; 82 | } 83 | f = a % 1000; 84 | a /= 1000; 85 | s = a % 60; 86 | a /= 60; 87 | m = a % 60; 88 | a /= 60; 89 | h = a % 24; 90 | d = a / 24; 91 | if (d) 92 | sprintf(soap->tmpbuf + k, SOAP_LONG_FORMAT "D", d); 93 | if (h || m || s || f) 94 | { if (d) 95 | k = strlen(soap->tmpbuf); 96 | if (f) 97 | sprintf(soap->tmpbuf + k, "T%dH%dM%d.%03dS", h, m, s, f); 98 | else 99 | sprintf(soap->tmpbuf + k, "T%dH%dM%dS", h, m, s); 100 | } 101 | else if (!d) 102 | strcpy(soap->tmpbuf + k, "T0S"); 103 | return soap->tmpbuf; 104 | } 105 | 106 | int soap_out_xsd__duration(struct soap *soap, const char *tag, int id, const LONG64 *a, const char *type) 107 | { if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_xsd__duration), type) 108 | || soap_string_out(soap, soap_xsd__duration2s(soap, *a), 0)) 109 | return soap->error; 110 | return soap_element_end_out(soap, tag); 111 | } 112 | 113 | int soap_s2xsd__duration(struct soap *soap, const char *s, LONG64 *a) 114 | { LONG64 sign = 1, Y = 0, M = 0, D = 0, H = 0, N = 0, S = 0; 115 | float f = 0; 116 | *a = 0; 117 | if (s) 118 | { if (*s == '-') 119 | { sign = -1; 120 | s++; 121 | } 122 | if (*s++ != 'P') 123 | return soap->error = SOAP_TYPE; 124 | /* date part */ 125 | while (s && *s) 126 | { LONG64 n; 127 | char k; 128 | if (*s == 'T') 129 | { s++; 130 | break; 131 | } 132 | if (sscanf(s, SOAP_LONG_FORMAT "%c", &n, &k) != 2) 133 | return soap->error = SOAP_TYPE; 134 | s = strchr(s, k); 135 | if (!s) 136 | return soap->error = SOAP_TYPE; 137 | switch (k) 138 | { case 'Y': 139 | Y = n; 140 | break; 141 | case 'M': 142 | M = n; 143 | break; 144 | case 'D': 145 | D = n; 146 | break; 147 | default: 148 | return soap->error = SOAP_TYPE; 149 | } 150 | s++; 151 | } 152 | /* time part */ 153 | while (s && *s) 154 | { LONG64 n; 155 | char k; 156 | if (sscanf(s, SOAP_LONG_FORMAT "%c", &n, &k) != 2) 157 | return soap->error = SOAP_TYPE; 158 | s = strchr(s, k); 159 | if (!s) 160 | return soap->error = SOAP_TYPE; 161 | switch (k) 162 | { case 'H': 163 | H = n; 164 | break; 165 | case 'M': 166 | N = n; 167 | break; 168 | case '.': 169 | S = n; 170 | if (sscanf(s, "%g", &f) != 1) 171 | return soap->error = SOAP_TYPE; 172 | s = NULL; 173 | continue; 174 | case 'S': 175 | S = n; 176 | break; 177 | default: 178 | return soap->error = SOAP_TYPE; 179 | } 180 | s++; 181 | } 182 | /* convert Y-M-D H:N:S.f to signed long long int */ 183 | *a = sign * ((((((((((((Y * 12) + M) * 30) + D) * 24) + H) * 60) + N) * 60) + S) * 1000) + (long)(1000.0 * f)); 184 | } 185 | return soap->error; 186 | } 187 | 188 | LONG64 *soap_in_xsd__duration(struct soap *soap, const char *tag, LONG64 *a, const char *type) 189 | { if (soap_element_begin_in(soap, tag, 0, NULL)) 190 | return NULL; 191 | if (*soap->type 192 | && soap_match_tag(soap, soap->type, type) 193 | && soap_match_tag(soap, soap->type, ":duration")) 194 | { soap->error = SOAP_TYPE; 195 | soap_revert(soap); 196 | return NULL; 197 | } 198 | a = (LONG64*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__duration, sizeof(LONG64), 0, NULL, NULL, NULL); 199 | if (*soap->href) 200 | a = (LONG64*)soap_id_forward(soap, soap->href, a, 0, SOAP_TYPE_xsd__duration, 0, sizeof(LONG64), 0, NULL); 201 | else if (a) 202 | { if (soap_s2xsd__duration(soap, soap_value(soap), a)) 203 | return NULL; 204 | } 205 | if (soap->body && soap_element_end_in(soap, tag)) 206 | return NULL; 207 | return a; 208 | } 209 | -------------------------------------------------------------------------------- /3rdparty/onvif/src/gsoap/threads.c: -------------------------------------------------------------------------------- 1 | /* 2 | threads.c 3 | 4 | Portable threads and locks API implementation 5 | 6 | gSOAP XML Web services tools 7 | Copyright (C) 2000-2010, Robert van Engelen, Genivia Inc., All Rights Reserved. 8 | This part of the software is released under one of the following licenses: 9 | GPL, the gSOAP public license, or Genivia's license for commercial use. 10 | -------------------------------------------------------------------------------- 11 | gSOAP public license. 12 | 13 | The contents of this file are subject to the gSOAP Public License Version 1.3 14 | (the "License"); you may not use this file except in compliance with the 15 | License. You may obtain a copy of the License at 16 | http://www.cs.fsu.edu/~engelen/soaplicense.html 17 | Software distributed under the License is distributed on an "AS IS" basis, 18 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 19 | for the specific language governing rights and limitations under the License. 20 | 21 | The Initial Developer of the Original Code is Robert A. van Engelen. 22 | Copyright (C) 2000-2010, Robert van Engelen, Genivia Inc., All Rights Reserved. 23 | -------------------------------------------------------------------------------- 24 | GPL license. 25 | 26 | This program is free software; you can redistribute it and/or modify it under 27 | the terms of the GNU General Public License as published by the Free Software 28 | Foundation; either version 2 of the License, or (at your option) any later 29 | version. 30 | 31 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 32 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 33 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 34 | 35 | You should have received a copy of the GNU General Public License along with 36 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 37 | Place, Suite 330, Boston, MA 02111-1307 USA 38 | 39 | Author contact information: 40 | engelen@genivia.com / engelen@acm.org 41 | 42 | This program is released under the GPL with the additional exemption that 43 | compiling, linking, and/or using OpenSSL is allowed. 44 | -------------------------------------------------------------------------------- 45 | A commercial use license is available from Genivia, Inc., contact@genivia.com 46 | -------------------------------------------------------------------------------- 47 | */ 48 | 49 | #include "threads.h" 50 | 51 | #ifdef WIN32 52 | 53 | /******************************************************************************\ 54 | * 55 | * Emulation of POSIX condition variables for WIN32 56 | * 57 | \******************************************************************************/ 58 | 59 | #ifdef __cplusplus 60 | extern "C" { 61 | #endif 62 | 63 | int emulate_pthread_mutex_lock(volatile MUTEX_TYPE *mx) 64 | { 65 | if (*mx == NULL) /* static initializer? */ 66 | { 67 | HANDLE p = CreateMutex(NULL, FALSE, NULL); 68 | 69 | if (InterlockedCompareExchangePointer((PVOID*)mx, (PVOID)p, NULL) != NULL) 70 | CloseHandle(p); 71 | } 72 | 73 | return WaitForSingleObject(*mx, INFINITE) == WAIT_FAILED; 74 | } 75 | 76 | int emulate_pthread_cond_init(COND_TYPE *cv) 77 | { 78 | cv->waiters_count_ = 0; 79 | cv->signal_event_ = CreateEvent(NULL, FALSE, FALSE, NULL); 80 | InitializeCriticalSection(&cv->waiters_count_lock_); 81 | 82 | return 0; 83 | } 84 | 85 | int emulate_pthread_cond_destroy(COND_TYPE *cv) 86 | { 87 | CloseHandle(cv->signal_event_); 88 | DeleteCriticalSection(&cv->waiters_count_lock_); 89 | 90 | return 0; 91 | } 92 | 93 | int emulate_pthread_cond_signal(COND_TYPE *cv) 94 | { 95 | int have_waiters; 96 | 97 | EnterCriticalSection(&cv->waiters_count_lock_); 98 | have_waiters = cv->waiters_count_ > 0; 99 | LeaveCriticalSection(&cv->waiters_count_lock_); 100 | 101 | if (have_waiters) 102 | return SetEvent(cv->signal_event_) == 0; 103 | 104 | return 0; 105 | } 106 | 107 | int emulate_pthread_cond_wait(COND_TYPE *cv, MUTEX_TYPE *cs) 108 | { 109 | int result; 110 | 111 | EnterCriticalSection(&cv->waiters_count_lock_); 112 | cv->waiters_count_++; 113 | LeaveCriticalSection(&cv->waiters_count_lock_); 114 | 115 | ReleaseMutex(*cs); 116 | 117 | result = (WaitForSingleObject(cv->signal_event_, INFINITE) == WAIT_FAILED); 118 | 119 | if (!result) 120 | { 121 | EnterCriticalSection(&cv->waiters_count_lock_); 122 | cv->waiters_count_--; 123 | LeaveCriticalSection(&cv->waiters_count_lock_); 124 | 125 | result = (WaitForSingleObject(*cs, INFINITE) == WAIT_FAILED); 126 | } 127 | 128 | return result; 129 | } 130 | 131 | #ifdef __cplusplus 132 | } 133 | #endif 134 | 135 | #endif 136 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #root/CMakeLists.txt 2 | 3 | #CMake Version Minimum Required 4 | cmake_minimum_required (VERSION 2.8.11) 5 | 6 | ############################################################################### 7 | # DEFINITION 8 | ############################################################################### 9 | 10 | set(PROJECT_ACRONYM_STR "SSIG-ONVIF") 11 | set(PROJECT_NAME_STR "SSIG ONVIF Library") 12 | project(${PROJECT_ACRONYM_STR} CXX) 13 | 14 | ############################################################################### 15 | # USER OPTIONS 16 | ############################################################################### 17 | 18 | set(VERSION_MAJOR 0 CACHE STRING "Project major version number.") 19 | set(VERSION_MINOR 0 CACHE STRING "Project minor version number.") 20 | set(VERSION_PATCH 1 CACHE STRING "Project patch version number.") 21 | 22 | #Option to check if 'test' will be available 23 | option(BUILD_TESTS "Build tests" ON) 24 | 25 | #Option to check if 'app' will be available 26 | option(BUILD_APPS "Build APP's" ON) 27 | 28 | # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to 29 | # make it prominent in the GUI. 30 | option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." ON) 31 | 32 | #Option to check if 'docs' will be build 33 | # option(BUILD_DOCS "Create and install the HTML based API documentation (requires Doxygen)" OFF) 34 | 35 | #Option to check if 'docs' will be build 36 | option(BUILD_SAMPLES "Build onvif samples" ON) 37 | 38 | # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to 39 | # make it prominent in the GUI. 40 | # option(ENABLE_COVERAGE "Enable coverage collection with GCov." OFF) 41 | 42 | mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH ENABLE_COVERAGE) 43 | mark_as_advanced(CMAKE_CONFIGURATION_TYPES CMAKE_INSTALL_PREFIX) 44 | mark_as_advanced(SSL_EAY_DEBUG SSL_EAY_RELEASE LIB_EAY_DEBUG LIB_EAY_RELEASE) 45 | 46 | ############################################################################### 47 | # CMake OPTIONS 48 | ############################################################################### 49 | 50 | #Remove Warning CMP0054 from gtest cmake build 51 | if(POLICY CMP0054) 52 | cmake_policy(SET CMP0054 OLD) 53 | endif() 54 | 55 | if(POLICY CMP0042) 56 | cmake_policy(SET CMP0042 OLD) 57 | endif() 58 | 59 | #Check compilers version 60 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 61 | execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE TEMP_COMPILER_VERSION) 62 | if(TEMP_COMPILER_VERSION VERSION_LESS 4.7) 63 | message(FATAL_ERROR "${PROJECT_NAME_STR} requires g++ 4.7 or greater. Installed version: ${CMAKE_CXX_COMPILER_VERSION}") 64 | endif() 65 | elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 66 | execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE TEMP_COMPILER_VERSION) 67 | if (TEMP_COMPILER_VERSION VERSION_LESS 3.4) 68 | message(FATAL_ERROR "${PROJECT_NAME_STR} requires Clang 3.4 or greater. Installed version: ${CMAKE_CXX_COMPILER_VERSION}") 69 | endif() 70 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 71 | if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) 72 | message(FATAL_ERROR "${PROJECT_NAME_STR} requires MSVC 1700 (MSVC 2012) or greater. Installed version: ${CMAKE_CXX_COMPILER_VERSION}") 73 | endif() 74 | else() 75 | message(WARNING "You are using an unsupported compiler! ${PROJECT_NAME_STR} has only been tested with Clang, GCC and MSVC.") 76 | endif() 77 | 78 | 79 | #Definitions 80 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 81 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") 82 | set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}") 83 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") 84 | set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") 85 | 86 | if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) 87 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -std=gnu++11")# 88 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g") 89 | set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG") 90 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O4 -DNDEBUG") 91 | set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g") 92 | #Solve plugin problem for some linux versions 93 | set (CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl") 94 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 95 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 96 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") 97 | set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}") 98 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") 99 | set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") 100 | endif() 101 | 102 | #Disable C4996 103 | if(MSVC) 104 | add_definitions(/D_SCL_SECURE_NO_WARNINGS=1) 105 | add_definitions(/D_CRT_SECURE_NO_WARNINGS=1) 106 | endif() 107 | 108 | #Allows the solution folder utilization (for MSVC) 109 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 110 | 111 | # If install location is default, set new default to "build/install" 112 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 113 | set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE ) 114 | endif() 115 | 116 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 117 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 118 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 119 | 120 | #Enable tests if BUILD_TEST was checked by user 121 | if(BUILD_TESTS) 122 | enable_testing() 123 | endif() 124 | 125 | # if(ENABLE_COVERAGE) 126 | # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage") 127 | # endif() 128 | 129 | ############################################################################### 130 | # CMake Auxiliary Files 131 | ############################################################################### 132 | include(cmake/SSIGOnvifOpenSSLUtil.cmake) 133 | include(cmake/SSIGOnvifUtil.cmake) 134 | 135 | ############################################################################### 136 | # SUBDIRECTORIES 137 | ############################################################################### 138 | 139 | #Add 3rdparty 140 | add_subdirectory(3rdparty) 141 | 142 | # Add modules 143 | add_subdirectory(ssigonvif) 144 | 145 | # Add documentation 146 | add_subdirectory(samples) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Smart Surveillance Interest Group - SSIG 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 met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of ssig-onvif 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 "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ssig-onvif 2 | Onvif Library 3 | -------------------------------------------------------------------------------- /cmake/SSIGOnvifOpenSSLUtil.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeParseArguments) 2 | 3 | macro(ssigonvif_find_openssl) 4 | set(ssigonvif_options REQUIRED QUIET) 5 | set(ssigonvif_multiValueArgs COMPONENTS) 6 | cmake_parse_arguments(SSIGONVIF_FIND_OPEN_SSL "${ssf_options}" "${ssf_oneValueArgs}" "${ssf_multiValueArgs}" ${ARGN} ) 7 | 8 | set(ssigonvif_options "") 9 | if(${SSF_FIND_OPEN_SSL_REQUIRED}) 10 | set(ssigonvif_options "REQUIRED") 11 | endif() 12 | 13 | if(${SSF_FIND_OPEN_SSL_QUIET}) 14 | set(ssigonvif_options "QUIET") 15 | endif() 16 | 17 | find_package(OpenSSL ${ssf_options}) 18 | 19 | endmacro() 20 | 21 | macro(ssigonvif_link_openssl TARGET) 22 | 23 | ssigonvif_find_openssl(COMPONENTS ${ARGN} REQUIRED) 24 | target_compile_definitions(${TARGET} PUBLIC WITH_OPENSSL) 25 | target_include_directories(${TARGET} PUBLIC ${OPENSSL_INCLUDE_DIR}) 26 | target_link_libraries(${TARGET} ${OPENSSL_LIBRARIES}) 27 | 28 | endmacro() -------------------------------------------------------------------------------- /cmake/SSIGOnvifUtil.cmake: -------------------------------------------------------------------------------- 1 | macro(ssigonvif_append_target_property target property str) 2 | get_target_property(current_property ${target} ${property}) 3 | if(NOT current_property) # property non-existent or empty 4 | set_target_properties(${target} PROPERTIES ${property} ${str}) 5 | else() 6 | set_target_properties(${target} PROPERTIES ${property} "${current_property} ${str}") 7 | endif() 8 | endmacro() -------------------------------------------------------------------------------- /samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #root/components/cameras/app/CMakeLists.txt 2 | 3 | if(BUILD_SAMPLES) 4 | 5 | #Create set of cameras tests files 6 | file(GLOB SAMPLE_FILES "${PROJECT_SOURCE_DIR}/samples/*.cpp" "${PROJECT_SOURCE_DIR}/samples/*.hpp") 7 | 8 | add_executable(ssigonvif-samples ${SAMPLE_FILES}) 9 | 10 | find_package(Curses REQUIRED) 11 | 12 | # Extra linking for the project. 13 | target_link_libraries(ssigonvif-samples ssigonvif) 14 | target_link_libraries(ssigonvif-samples ${CURSES_LIBRARIES}) 15 | 16 | target_include_directories(ssigonvif-samples PUBLIC ${PROJECT_SOURCE_DIR}/ssigonvif/include) 17 | target_include_directories(ssigonvif-samples PUBLIC ${CURSES_INCLUDE_DIR}) 18 | 19 | #Configure folder to cameras library 20 | set_target_properties(ssigonvif-samples PROPERTIES FOLDER SAMPLES) 21 | 22 | 23 | endif() -------------------------------------------------------------------------------- /samples/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ssigonvif/OnvifClientDevice.hpp" 2 | #include "ssigonvif/OnvifClientPTZ.hpp" 3 | #include "ssigonvif/OnvifClientMedia.hpp" 4 | #include 5 | #include 6 | 7 | int main(int argc, char** argv){ 8 | 9 | std::string password = argv[2]; 10 | OnvifClientPTZ *PTZ = new OnvifClientPTZ(argv[1], "root", password, false); 11 | OnvifClientMedia *Media = new OnvifClientMedia(argv[1], "root", password, false); 12 | Media->createProfile("PTZ", "PTZ"); 13 | //Media->getProfiles(); 14 | //std::cout << "Configurations:" << std::endl; 15 | //PTZ->getPTZConfigurations(); 16 | Media->addPTZConfiguration("PTZ", "4"); 17 | 18 | initscr(); 19 | noecho(); 20 | int c; 21 | printw("Use WASD to navigate\nI to zoom in\nO to zoom out\nP to continuous pan\nY to set home position\nH to go to home position\nESPACE to stop movement\nESC to quit"); 22 | while((c=getch()) != 27){ 23 | c = getch(); 24 | if(c==87 || c==119){ 25 | PTZ->tiltUp("PTZ", 5); 26 | }else if(c == 83 || c==115){ 27 | PTZ->tiltDown("PTZ", 5); 28 | }else if(c == 65 || c==97){ 29 | PTZ->panLeft("PTZ", 5); 30 | }else if(c == 68 || c==100){ 31 | PTZ->panRight("PTZ", 5); 32 | }else if(c == 73 || c==105){ 33 | PTZ->zoomIn("PTZ"); 34 | }else if(c == 79 || c==111){ 35 | PTZ->zoomOut("PTZ"); 36 | }else if(c==80 || c==112 ){ 37 | PTZ->continuousMove("PTZ", 0.2, 0.0, -0.1); 38 | }else if(c==89 || c==121 ){ 39 | PTZ->setHomePosition("PTZ"); 40 | }else if(c==72 || c==104 ){ 41 | PTZ->goToHomePosition("PTZ"); 42 | }else if(c==32){ 43 | PTZ->stop("PTZ", 1, 1); 44 | } 45 | } 46 | endwin(); 47 | 48 | return 0; 49 | } -------------------------------------------------------------------------------- /ssigonvif/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB INCLUDE_FILES "${PROJECT_SOURCE_DIR}/ssigonvif/include/ssigonvif/*.hpp") 2 | file(GLOB SOURCE_FILES "${PROJECT_SOURCE_DIR}/ssigonvif/src/*.cpp") 3 | 4 | add_library(ssigonvif ${SOURCE_FILES} ${INCLUDE_FILES}) 5 | target_include_directories(ssigonvif PUBLIC ${PROJECT_SOURCE_DIR}/ssigonvif/include/) 6 | set_target_properties(ssigonvif PROPERTIES FOLDER LIBRARY) 7 | 8 | string(TOUPPER "SSIGONVIF_API_EXPORTS" EXPORTS_MACRO) 9 | target_compile_definitions(ssigonvif PUBLIC ${EXPORTS_MACRO}) 10 | 11 | target_link_libraries(ssigonvif onvif) 12 | ssigonvif_link_openssl(ssigonvif) -------------------------------------------------------------------------------- /ssigonvif/include/ssigonvif/OnvifClientDevice.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ONVIFCLIENTDEVICE_HPP 2 | #define ONVIFCLIENTDEVICE_HPP 3 | 4 | #include 5 | #include "stdio.h" 6 | #include "gsoap/wsseapi.h" 7 | #include 8 | 9 | #include "onvif/soapDeviceBindingProxy.h" 10 | 11 | 12 | class OnvifClientDevice{ 13 | public: 14 | OnvifClientDevice(); 15 | OnvifClientDevice(std::string url, std::string user, std::string password, bool showCapabilities); 16 | ~OnvifClientDevice(); 17 | 18 | public: 19 | bool _hasMedia; 20 | bool _hasPTZ; 21 | 22 | protected: 23 | std::string _strUrl; 24 | std::string _user; 25 | std::string _password; 26 | 27 | struct soap *soap; 28 | 29 | DeviceBindingProxy proxyDevice; 30 | }; 31 | 32 | #endif 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ssigonvif/include/ssigonvif/OnvifClientMedia.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ONVIFCLIENTMEDIA_HPP 2 | #define ONVIFCLIENTMEDIA_HPP 3 | 4 | #include "OnvifClientDevice.hpp" 5 | #include "onvif/soapMediaBindingProxy.h" 6 | 7 | class OnvifClientMedia : public OnvifClientDevice{ 8 | public: 9 | OnvifClientMedia(std::string url, std::string user, std::string password, bool showCapabilities); 10 | ~OnvifClientMedia(); 11 | 12 | public: 13 | //create a new profile 14 | int createProfile(std::string profileName, std::string profileToken); 15 | //delete profile 16 | int deleteProfile(std::string profileToken); 17 | 18 | //get a list of all media profiles 19 | int getProfiles(); 20 | //get one media profile 21 | int getProfile(std::string profileToken); 22 | 23 | //get all video source configurations 24 | int getVideoSourceConfigurations(); 25 | //add video source configuration 26 | int addVideoSourceConfiguration(std::string profileToken, std::string configurationToken); 27 | 28 | //get all video encoder configurations 29 | int getVideoEncoderConfigurations(); 30 | //add video encoder configuration 31 | int addVideoEncoderConfiguration(std::string profileToken, std::string configurationToken); 32 | 33 | int setVideoEncoderConfiguration(std::string configurationToken); 34 | 35 | //get stream URI 36 | int getStreamURI(std::string profileToken); 37 | 38 | //get video encoder configuration options 39 | int getVideoEncoderConfigurationOptions(std::string profileToken, std::string configurationToken); 40 | 41 | //add PTZ configuration to media profile 42 | int addPTZConfiguration(std::string profileToken, std::string configurationToken); 43 | 44 | private: 45 | MediaBindingProxy proxyMedia; 46 | }; 47 | 48 | #endif -------------------------------------------------------------------------------- /ssigonvif/include/ssigonvif/OnvifClientPTZ.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ONVIFCLIENTPTZ_HPP 2 | #define ONVIFCLIENTPTZ_HPP 3 | 4 | #include "OnvifClientDevice.hpp" 5 | #include "onvif/soapPTZBindingProxy.h" 6 | 7 | class OnvifClientPTZ : public OnvifClientDevice{ 8 | public: 9 | OnvifClientPTZ(std::string url, std::string user, std::string password, bool showCapabilities); 10 | ~OnvifClientPTZ(); 11 | 12 | public: 13 | //get all PTZ configurations 14 | int getPTZConfigurations(); 15 | //get and print PTZ Status 16 | int getStatus(std::string profileToken); 17 | //absolute move 18 | int absoluteMove(std::string profileToken, float pan, float panSpeed, float tilt, float tiltSpeed, float zoom, float zoomSpeed); 19 | //relative move 20 | int relativeMove(std::string profileToken, float pan, float panSpeed, float tilt, float tiltSpeed, float zoom, float zoomSpeed); 21 | //continuous move 22 | int continuousMove(std::string profileToken, float panSpeed, float tiltSpeed, float zoomSpeed); 23 | //stop movement 24 | int stop(std::string profileToken, bool panTilt, bool zoom); 25 | //setHomePosition 26 | int setHomePosition(std::string profileToken); 27 | //goToHomePosition 28 | int goToHomePosition(std::string profileToken); 29 | //Get configuration and print it 30 | int getConfiguration(std::string configurationToken); 31 | 32 | 33 | //pan to the left n Degress 34 | int panLeft(std::string profileToken, int nDegrees); 35 | //pan to the right n Degrees 36 | int panRight(std::string profileToken, int nDegrees); 37 | 38 | //tilt down 39 | int tiltDown(std::string profileToken, int nDegrees); 40 | //tilt up 41 | int tiltUp(std::string profileToken, int nDegrees); 42 | 43 | //zoom in 44 | int zoomIn(std::string profileToken); 45 | //zoom out 46 | int zoomOut(std::string profileToken); 47 | 48 | private: 49 | PTZBindingProxy proxyPTZ; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /ssigonvif/src/OnvifClientDevice.cpp: -------------------------------------------------------------------------------- 1 | #include "ssigonvif/OnvifClientDevice.hpp" 2 | #include "DeviceBinding.nsmap" 3 | 4 | 5 | OnvifClientDevice::OnvifClientDevice(){ 6 | } 7 | 8 | OnvifClientDevice::OnvifClientDevice(std::string url, std::string user, std::string password, bool showCapabilities){ 9 | _strUrl = "http://" + url + "/onvif/services"; 10 | _user = user; 11 | _password = password; 12 | 13 | _hasMedia = false; 14 | _hasPTZ = false; 15 | 16 | proxyDevice.soap_endpoint = _strUrl.c_str(); 17 | 18 | soap_register_plugin(proxyDevice.soap, soap_wsse); 19 | soap = soap_new(); 20 | 21 | if (SOAP_OK != soap_wsse_add_UsernameTokenDigest(proxyDevice.soap, NULL, user.c_str(), password.c_str())) 22 | { 23 | } 24 | 25 | _tds__GetCapabilities *tds__GetCapabilities = soap_new__tds__GetCapabilities(soap, -1); 26 | tds__GetCapabilities->Category.push_back(tt__CapabilityCategory__All); 27 | _tds__GetCapabilitiesResponse *tds__GetCapabilitiesResponse = soap_new__tds__GetCapabilitiesResponse(soap, -1); 28 | 29 | if (SOAP_OK == proxyDevice.GetCapabilities(tds__GetCapabilities, tds__GetCapabilitiesResponse)) 30 | { 31 | if(showCapabilities){ 32 | if (tds__GetCapabilitiesResponse->Capabilities->Analytics != NULL) 33 | {/* 34 | processEventLog(__FILE__, __LINE__, stdout, "-------------------Analytics-------------------"); 35 | processEventLog(__FILE__, __LINE__, stdout, "XAddr:%s", tds__GetCapabilitiesResponse->Capabilities->Analytics->XAddr.c_str()); 36 | processEventLog(__FILE__, __LINE__, stdout, "RuleSupport:%s", (tds__GetCapabilitiesResponse->Capabilities->Analytics->RuleSupport) ? "Y" : "N"); 37 | processEventLog(__FILE__, __LINE__, stdout, "AnalyticsModuleSupport:%s", (tds__GetCapabilitiesResponse->Capabilities->Analytics->AnalyticsModuleSupport) ? "Y" : "N"); 38 | */ 39 | } 40 | 41 | if (tds__GetCapabilitiesResponse->Capabilities->Device != NULL) 42 | { 43 | /* 44 | processEventLog(__FILE__, __LINE__, stdout, "-------------------Device-------------------"); 45 | processEventLog(__FILE__, __LINE__, stdout, "XAddr:%s", tds__GetCapabilitiesResponse->Capabilities->Device->XAddr.c_str()); 46 | 47 | processEventLog(__FILE__, __LINE__, stdout, "-------------------Network-------------------"); 48 | processEventLog(__FILE__, __LINE__, stdout, "IPFilter:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Network->IPFilter) ? "Y" : "N"); 49 | processEventLog(__FILE__, __LINE__, stdout, "ZeroConfiguration:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Network->ZeroConfiguration) ? "Y" : "N"); 50 | processEventLog(__FILE__, __LINE__, stdout, "IPVersion6:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Network->IPVersion6) ? "Y" : "N"); 51 | processEventLog(__FILE__, __LINE__, stdout, "DynDNS:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Network->DynDNS) ? "Y" : "N"); 52 | 53 | processEventLog(__FILE__, __LINE__, stdout, "-------------------System-------------------"); 54 | processEventLog(__FILE__, __LINE__, stdout, "DiscoveryResolve:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->System->DiscoveryResolve) ? "Y" : "N"); 55 | processEventLog(__FILE__, __LINE__, stdout, "DiscoveryBye:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->System->DiscoveryBye) ? "Y" : "N"); 56 | processEventLog(__FILE__, __LINE__, stdout, "RemoteDiscovery:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->System->RemoteDiscovery) ? "Y" : "N"); 57 | */ 58 | int iSize = tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions.size(); 59 | 60 | if (iSize > 0) 61 | {/* 62 | processEventLog(__FILE__, __LINE__, stdout, "SupportedVersions:"); 63 | 64 | for (int i = 0; i < iSize; i++) 65 | { 66 | processEventLog(__FILE__, __LINE__, stdout, "%d.%d ", tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions[i]->Major, 67 | tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions[i]->Minor); 68 | } 69 | 70 | processEventLog(__FILE__, __LINE__, stdout, ""); 71 | */ 72 | } 73 | /* 74 | processEventLog(__FILE__, __LINE__, stdout, "SystemBackup:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->System->SystemBackup) ? "Y" : "N"); 75 | processEventLog(__FILE__, __LINE__, stdout, "FirmwareUpgrade:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->System->FirmwareUpgrade) ? "Y" : "N"); 76 | processEventLog(__FILE__, __LINE__, stdout, "SystemLogging:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->System->SystemLogging) ? "Y" : "N"); 77 | 78 | processEventLog(__FILE__, __LINE__, stdout, "-------------------IO-------------------"); 79 | processEventLog(__FILE__, __LINE__, stdout, "InputConnectors:%d", tds__GetCapabilitiesResponse->Capabilities->Device->IO->InputConnectors); 80 | processEventLog(__FILE__, __LINE__, stdout, "RelayOutputs:%d", tds__GetCapabilitiesResponse->Capabilities->Device->IO->RelayOutputs); 81 | 82 | processEventLog(__FILE__, __LINE__, stdout, "-------------------Security-------------------"); 83 | processEventLog(__FILE__, __LINE__, stdout, "TLS1.1:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->TLS1_x002e1) ? "Y" : "N"); 84 | processEventLog(__FILE__, __LINE__, stdout, "TLS1.2:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->TLS1_x002e2) ? "Y" : "N"); 85 | processEventLog(__FILE__, __LINE__, stdout, "OnboardKeyGeneration:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->OnboardKeyGeneration) ? "Y" : "N"); 86 | processEventLog(__FILE__, __LINE__, stdout, "AccessPolicyConfig:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->AccessPolicyConfig) ? "Y" : "N"); 87 | processEventLog(__FILE__, __LINE__, stdout, "X.509Token:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->X_x002e509Token) ? "Y" : "N"); 88 | processEventLog(__FILE__, __LINE__, stdout, "SAMLToken:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->SAMLToken) ? "Y" : "N"); 89 | processEventLog(__FILE__, __LINE__, stdout, "KerberosToken:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->KerberosToken) ? "Y" : "N"); 90 | processEventLog(__FILE__, __LINE__, stdout, "RELToken:%s", (tds__GetCapabilitiesResponse->Capabilities->Device->Security->RELToken) ? "Y" : "N"); 91 | */ 92 | 93 | } 94 | 95 | 96 | if (tds__GetCapabilitiesResponse->Capabilities->Imaging != NULL) 97 | { 98 | //processEventLog(__FILE__, __LINE__, stdout, "-------------------Imaging-------------------"); 99 | //processEventLog(__FILE__, __LINE__, stdout, "XAddr:%s", tds__GetCapabilitiesResponse->Capabilities->Imaging->XAddr.c_str()); 100 | } 101 | 102 | } 103 | 104 | if (tds__GetCapabilitiesResponse->Capabilities->Media != NULL){ 105 | _hasMedia = true; 106 | 107 | if(showCapabilities){ 108 | /* 109 | processEventLog(__FILE__, __LINE__, stdout, "-------------------Media-------------------"); 110 | processEventLog(__FILE__, __LINE__, stdout, "XAddr:%s", tds__GetCapabilitiesResponse->Capabilities->Media->XAddr.c_str()); 111 | 112 | processEventLog(__FILE__, __LINE__, stdout, "-------------------streaming-------------------"); 113 | processEventLog(__FILE__, __LINE__, stdout, "RTPMulticast:%s", (tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTPMulticast) ? "Y" : "N"); 114 | processEventLog(__FILE__, __LINE__, stdout, "RTP_TCP:%s", (tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTP_USCORETCP) ? "Y" : "N"); 115 | processEventLog(__FILE__, __LINE__, stdout, "RTP_RTSP_TCP:%s", (tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities->RTP_USCORERTSP_USCORETCP) ? "Y" : "N"); 116 | ` */ 117 | } 118 | } 119 | 120 | if (tds__GetCapabilitiesResponse->Capabilities->PTZ != NULL){ 121 | _hasPTZ = true; 122 | if(showCapabilities){ 123 | //processEventLog(__FILE__, __LINE__, stdout, "-------------------PTZ-------------------"); 124 | //processEventLog(__FILE__, __LINE__, stdout, "XAddr:%s", tds__GetCapabilitiesResponse->Capabilities->PTZ->XAddr.c_str()); 125 | } 126 | } 127 | } 128 | else 129 | { 130 | //PrintErr(proxyDevice.soap); 131 | } 132 | 133 | soap_destroy(soap); 134 | soap_end(soap); 135 | } 136 | 137 | OnvifClientDevice::~OnvifClientDevice(){ 138 | } 139 | 140 | --------------------------------------------------------------------------------