├── .gitignore ├── CMakeLists.txt ├── COPYING.txt ├── README.md ├── doxygen.config ├── doxygenate.py ├── introspect.cmake ├── prepare_dependencies.py ├── service_apis ├── CMakeLists.txt ├── calendar │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── google │ │ └── calendar_api │ │ │ ├── CMakeLists.txt │ │ │ ├── acl.cc │ │ │ ├── acl.h │ │ │ ├── acl_rule.cc │ │ │ ├── acl_rule.h │ │ │ ├── calendar.cc │ │ │ ├── calendar.h │ │ │ ├── calendar_api.h │ │ │ ├── calendar_list.cc │ │ │ ├── calendar_list.h │ │ │ ├── calendar_list_entry.cc │ │ │ ├── calendar_list_entry.h │ │ │ ├── calendar_notification.cc │ │ │ ├── calendar_notification.h │ │ │ ├── calendar_service.cc │ │ │ ├── calendar_service.h │ │ │ ├── channel.cc │ │ │ ├── channel.h │ │ │ ├── color_definition.cc │ │ │ ├── color_definition.h │ │ │ ├── colors.cc │ │ │ ├── colors.h │ │ │ ├── error.cc │ │ │ ├── error.h │ │ │ ├── event.cc │ │ │ ├── event.h │ │ │ ├── event_attachment.cc │ │ │ ├── event_attachment.h │ │ │ ├── event_attendee.cc │ │ │ ├── event_attendee.h │ │ │ ├── event_date_time.cc │ │ │ ├── event_date_time.h │ │ │ ├── event_reminder.cc │ │ │ ├── event_reminder.h │ │ │ ├── events.cc │ │ │ ├── events.h │ │ │ ├── free_busy_calendar.cc │ │ │ ├── free_busy_calendar.h │ │ │ ├── free_busy_group.cc │ │ │ ├── free_busy_group.h │ │ │ ├── free_busy_request.cc │ │ │ ├── free_busy_request.h │ │ │ ├── free_busy_request_item.cc │ │ │ ├── free_busy_request_item.h │ │ │ ├── free_busy_response.cc │ │ │ ├── free_busy_response.h │ │ │ ├── setting.cc │ │ │ ├── setting.h │ │ │ ├── settings.cc │ │ │ ├── settings.h │ │ │ ├── time_period.cc │ │ │ └── time_period.h │ └── readme.html └── storage │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── google │ └── storage_api │ │ ├── CMakeLists.txt │ │ ├── bucket.cc │ │ ├── bucket.h │ │ ├── bucket_access_control.cc │ │ ├── bucket_access_control.h │ │ ├── bucket_access_controls.cc │ │ ├── bucket_access_controls.h │ │ ├── buckets.cc │ │ ├── buckets.h │ │ ├── channel.cc │ │ ├── channel.h │ │ ├── compose_request.cc │ │ ├── compose_request.h │ │ ├── notification.cc │ │ ├── notification.h │ │ ├── notifications.cc │ │ ├── notifications.h │ │ ├── object.cc │ │ ├── object.h │ │ ├── object_access_control.cc │ │ ├── object_access_control.h │ │ ├── object_access_controls.cc │ │ ├── object_access_controls.h │ │ ├── objects.cc │ │ ├── objects.h │ │ ├── policy.cc │ │ ├── policy.h │ │ ├── rewrite_response.cc │ │ ├── rewrite_response.h │ │ ├── service_account.cc │ │ ├── service_account.h │ │ ├── storage_api.h │ │ ├── storage_service.cc │ │ ├── storage_service.h │ │ ├── test_iam_permissions_response.cc │ │ └── test_iam_permissions_response.h │ └── readme.html └── src ├── CMakeLists.txt ├── googleapis ├── CMakeLists.txt ├── base │ ├── callback-specializations.h │ ├── callback-types.h │ ├── callback.cc │ ├── callback.h │ ├── int128.h │ ├── integral_types.h │ ├── macros.h │ ├── mutex.h │ ├── once.cc │ ├── once.h │ ├── port.h │ ├── strtoint.cc │ ├── strtoint.h │ ├── template_util.h │ ├── thread_annotations.h │ ├── windows_compatability.cc │ └── windows_compatability.h ├── client │ ├── CMakeLists.txt │ ├── auth │ │ ├── credential_store.cc │ │ ├── credential_store.h │ │ ├── file_credential_store.cc │ │ ├── file_credential_store.h │ │ ├── jwt_builder.cc │ │ ├── jwt_builder.h │ │ ├── oauth2_authorization.cc │ │ ├── oauth2_authorization.h │ │ ├── oauth2_pending_authorizations.h │ │ ├── oauth2_service_authorization.cc │ │ ├── oauth2_service_authorization.h │ │ ├── test │ │ │ ├── file_credential_store_test.cc │ │ │ ├── interactive_oauth2_authorization_test.cc │ │ │ └── oauth2_authorization_test.cc │ │ ├── webserver_authorization_getter.cc │ │ └── webserver_authorization_getter.h │ ├── data │ │ ├── base64_codec.cc │ │ ├── base64_codec.h │ │ ├── codec.cc │ │ ├── codec.h │ │ ├── composite_data_reader.cc │ │ ├── data_reader.cc │ │ ├── data_reader.h │ │ ├── data_writer.cc │ │ ├── data_writer.h │ │ ├── file_data_reader.cc │ │ ├── file_data_writer.cc │ │ ├── file_data_writer.h │ │ ├── inmemory_data_reader.cc │ │ ├── istream_data_reader.cc │ │ ├── jsoncpp_data.cc │ │ ├── jsoncpp_data.h │ │ ├── jsoncpp_data_helpers.h │ │ ├── openssl_codec.cc │ │ ├── openssl_codec.h │ │ ├── roots.pem │ │ ├── serializable_json.cc │ │ ├── serializable_json.h │ │ └── test │ │ │ ├── base64_codec_test.cc │ │ │ ├── composite_data_reader_test.cc │ │ │ ├── data_reader_test.cc │ │ │ ├── data_writer_test.cc │ │ │ ├── file_data_reader_test.cc │ │ │ ├── inmemory_data_reader_test.cc │ │ │ ├── istream_data_reader_test.cc │ │ │ ├── jsoncpp_data_test.cc │ │ │ └── openssl_codec_test.cc │ ├── service │ │ ├── client_service.cc │ │ ├── client_service.h │ │ ├── media_uploader.cc │ │ ├── media_uploader.h │ │ ├── service_request_pager.cc │ │ ├── service_request_pager.h │ │ └── test │ │ │ ├── client_service_test.cc │ │ │ ├── media_uploader_test.cc │ │ │ └── service_request_pager_test.cc │ ├── test │ │ └── google │ │ │ └── wax_api │ │ │ ├── CMakeLists.txt │ │ │ ├── subscription.cc │ │ │ ├── subscription.h │ │ │ ├── wax_api.h │ │ │ ├── wax_create_session_request.cc │ │ │ ├── wax_create_session_request.h │ │ │ ├── wax_data_item.cc │ │ │ ├── wax_data_item.h │ │ │ ├── wax_list_response.cc │ │ │ ├── wax_list_response.h │ │ │ ├── wax_new_session_params.cc │ │ │ ├── wax_new_session_params.h │ │ │ ├── wax_new_session_request.cc │ │ │ ├── wax_new_session_request.h │ │ │ ├── wax_new_session_response.cc │ │ │ ├── wax_new_session_response.h │ │ │ ├── wax_remove_session_request.cc │ │ │ ├── wax_remove_session_request.h │ │ │ ├── wax_remove_session_response.cc │ │ │ ├── wax_remove_session_response.h │ │ │ ├── wax_service.cc │ │ │ └── wax_service.h │ ├── transport │ │ ├── ca_paths.cc │ │ ├── ca_paths.h │ │ ├── curl_http_transport.cc │ │ ├── curl_http_transport.h │ │ ├── html_scribe.cc │ │ ├── html_scribe.h │ │ ├── http_authorization.cc │ │ ├── http_authorization.h │ │ ├── http_request.cc │ │ ├── http_request.h │ │ ├── http_request_batch.cc │ │ ├── http_request_batch.h │ │ ├── http_response.cc │ │ ├── http_response.h │ │ ├── http_scribe.cc │ │ ├── http_scribe.h │ │ ├── http_transport.cc │ │ ├── http_transport.h │ │ ├── http_transport_global_state.cc │ │ ├── http_transport_global_state.h │ │ ├── http_types.h │ │ ├── json_playback_transport.cc │ │ ├── json_playback_transport.h │ │ ├── json_scribe.cc │ │ ├── json_scribe.h │ │ ├── test │ │ │ ├── curl_http_transport_test.cc │ │ │ ├── html_scribe_test.cc │ │ │ ├── http_request_batch_test.cc │ │ │ ├── http_scribe_test.cc │ │ │ ├── http_transport_test.cc │ │ │ ├── http_transport_test_fixture.cc │ │ │ ├── http_transport_test_fixture.h │ │ │ ├── json_playback_transport_test.cc │ │ │ ├── json_transport_playback.json │ │ │ ├── mock_http_transport.h │ │ │ └── wax_server.py │ │ ├── versioninfo.cc │ │ └── versioninfo.h │ └── util │ │ ├── abstract_webserver.cc │ │ ├── abstract_webserver.h │ │ ├── date_time.cc │ │ ├── date_time.h │ │ ├── escaping.cc │ │ ├── escaping.h │ │ ├── file_utils.cc │ │ ├── file_utils.h │ │ ├── program_path.cc │ │ ├── program_path.h │ │ ├── status.cc │ │ ├── status.h │ │ ├── test │ │ ├── date_time_test.cc │ │ ├── file_utils_test.cc │ │ ├── googleapis_gtest.h │ │ ├── googleapis_gtest_main.cc │ │ ├── uri_template_test.cc │ │ └── uri_utils_test.cc │ │ ├── uri_template.cc │ │ ├── uri_template.h │ │ ├── uri_utils.cc │ │ └── uri_utils.h ├── config.h.in ├── strings │ ├── ascii_ctype.cc │ ├── ascii_ctype.h │ ├── case.cc │ ├── case.h │ ├── join.h │ ├── memutil.cc │ ├── memutil.h │ ├── numbers.cc │ ├── numbers.h │ ├── split.cc │ ├── split.h │ ├── strcat.cc │ ├── strcat.h │ ├── stringpiece.cc │ ├── stringpiece.h │ ├── strip.cc │ ├── strip.h │ ├── util.cc │ └── util.h └── util │ ├── case_insensitive_hash.h │ ├── executor.cc │ ├── executor.h │ ├── file.cc │ ├── file.h │ ├── hash.cc │ ├── hash.h │ ├── mock_executor.h │ ├── status.cc │ └── status.h └── samples ├── CMakeLists.txt ├── README.md ├── calendar_sample_main.cc ├── resources └── download-client-secret.png └── storage_sample_main.cc /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .\#* 3 | CMakeFiles 4 | CMakeCache.txt 5 | CTestTestfile.cmake 6 | Makefile 7 | Testing 8 | cmake_install.cmake 9 | src/googleapis/config.h 10 | src/gmock 11 | external_dependencies 12 | bin 13 | lib 14 | export 15 | local.cmake 16 | build/ 17 | .vscode/ 18 | .idea/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google API C++ Client 2 | 3 | **This repository is deprecated as of May 30th 2019. Please do not use this for any new projects.** 4 | 5 | **PLEASE READ**: If you have a support contract with Google, and need help with this library - please create an issue in the [support console](https://cloud.google.com/support/). 6 | 7 | The current installation has only been tested on Unix/Linux systems; 8 | this release does not support Windows. 9 | 10 | ## Building 11 | 12 | ### Prerequisites: 13 | * python (Available from http://www.python.org/getit/) 14 | - verified with versions 2.6.4 and 2.7.3 15 | * C++ compiler and Make 16 | - Mac OSX https://developer.apple.com/xcode/ 17 | - Linux http://gcc.gnu.org/ 18 | 19 | ### Build Steps: 20 | 21 | ./prepare_dependencies.py 22 | mkdir build && cd build 23 | ../external_dependencies/install/bin/cmake .. 24 | make 25 | 26 | ## Running the Samples 27 | 28 | See [src/samples/README.md](src/samples/README.md) 29 | 30 | 31 | ## Building Clients for Other APIs 32 | 33 | To download additional APIs specialized for individual Google Services see: 34 | http://google.github.io/google-api-cpp-client/latest/available_service_apis.html 35 | and use this precise version of the apis client generator: 36 | https://github.com/google/apis-client-generator/tree/dcad06f5ff0fecfcf7a029efefe62a6b6287b025 37 | 38 | Here's an example invocation: 39 | 40 | $ python apis-client-generator/src/googleapis/codegen/generate_library.py --api_name=drive --api_version=v2 --language=cpp --output_dir=/tmp/generated 41 | 42 | It should be possible to build this from existing installed libraries. 43 | However, the build scripts are not yet written to find them. For initial 44 | support simplicity we download and build all the dependencies in the 45 | prepare_dependencies.py script for the time being as a one-time brute 46 | force preparation. 47 | 48 | ### Getting Help 49 | 50 | If you have problems, questions or suggestions, contact: 51 | The Google group at https://groups.google.com/group/google-api-cpp-client 52 | 53 | Or you may also ask questions on StackOverflow at: 54 | http://stackoverflow.com with the tag google-api-cpp-client 55 | 56 | **PLEASE READ**: If you have a support contract with Google, and need help with this library - please create an issue in the [support console](https://cloud.google.com/support/). 57 | 58 | ## Status 59 | 60 | This SDK is deprecated and archived. We don't accept patches any more. 61 | 62 | ### About the branches 63 | 64 | The master branch is where development is done. It usually is compatible with 65 | the generated libraries available from from google.developers.com. On occasion 66 | it gets aheaad of those. It usually catches up in a few days. 67 | 68 | The latest generated libraries for any Google API is available automatically 69 | from 70 | https://developers.google.com/resources/api-libraries/download//\/cpp 71 | 72 | For example, for Drive/v2, you would use 73 | https://developers.google.com/resources/api-libraries/download/drive/v2/cpp 74 | -------------------------------------------------------------------------------- /doxygenate.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | """INPUT_FILTER for Doxygen that converts C++ comments to Doxygen comments.""" 3 | import sys 4 | import re 5 | 6 | 7 | def Doxygenate(text): 8 | """Change commenting style to the one recognized by Doxygen.""" 9 | # /* -> /** 10 | text = re.sub(r'(/\*)([ \t\n]) ?', r'/**\2', text) 11 | 12 | # // -> /// 13 | text = re.sub(r'(//)([ \t\n]) ?', r'///\2', text) 14 | 15 | # // Author:-> /** \author */ 16 | text = re.sub(r'(//[ ]+Author:?[ ]*)([^\n]+)', r'/** \\author \2 */', text) 17 | print text 18 | 19 | if __name__ == '__main__': 20 | f = open(sys.argv[1], 'r') 21 | src = f.read() 22 | f.close() 23 | Doxygenate(src) 24 | -------------------------------------------------------------------------------- /introspect.cmake: -------------------------------------------------------------------------------- 1 | include(CheckIncludeFile) 2 | include(CheckCXXSourceCompiles) 3 | 4 | find_library(JSONCPP_LIBRARY 5 | NAMES jsoncpp libjsoncpp 6 | HINTS "${CMAKE_PREFIX_PATH}/jsoncpp/lib" 7 | REQUIRED) 8 | message(" -- using libjsoncpp from ${JSONCPP_LIBRARY}") 9 | 10 | find_library(CURL_LIBRARY 11 | NAMES curl libcurl 12 | HINTS "${CMAKE_PREFIX_PATH}/curl/lib") 13 | if (${CURL_LIBRARY} STREQUAL "CURL_LIBRARY-NOTFOUND") 14 | message("WARING: libcurl you do not have libcurl, skipping support for it.") 15 | else() 16 | message(" -- using libcurl from ${CURL_LIBRARY}") 17 | endif() 18 | 19 | check_include_file("libproc.h" HAVE_LIBPROC) 20 | check_include_file("mongoose/mongoose.h" HAVE_MONGOOSE) 21 | check_include_file("openssl/ossl_typ.h" HAVE_OPENSSL) 22 | 23 | check_cxx_source_compiles( 24 | "#include 25 | int type = S_IRGRP | S_IWOTH; 26 | " HAVE_UGO_PERMISSIONS) 27 | 28 | check_cxx_source_compiles( 29 | "#include 30 | int check_fstat(int fd) { 31 | stat64 info; 32 | return fstat64(fd, &info); 33 | }" HAVE_FSTAT64) 34 | 35 | #cmakedefine HAVE_FSTAT64 36 | #cmakedefine HAVE_UGO_PERMISSIONS 37 | #cmakedefine HAVE_LIBPROC 38 | #cmakedefine HAVE_MONGOOSE 39 | #cmakedefine HAVE_OPENSSL 40 | -------------------------------------------------------------------------------- /service_apis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB all_valid_subdirs RELATIVE 2 | ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt") 3 | 4 | foreach(dir ${all_valid_subdirs}) 5 | message(STATUS "path = ${dir}") 6 | if(${dir} MATCHES "^([^/]*)/CMakeLists.txt") 7 | string(REGEX REPLACE 8 | "^([^/]*)/CMakeLists.txt" "\\1" dir_trimmed ${dir}) 9 | add_subdirectory(${dir_trimmed}) 10 | endif() 11 | endforeach(dir) 12 | -------------------------------------------------------------------------------- /service_apis/calendar/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This is a CMake file for Calendar API v3 2 | # using the Google APIs Client Library for C++. 3 | # 4 | # See http://google.github.io/google-api-cpp-client/latest/start/get_started 5 | # for more information about what to do with this file. 6 | 7 | project (calendar) 8 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/.) 9 | 10 | add_subdirectory(google/calendar_api) 11 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This is a CMake file for Calendar API v3 2 | # using the Google APIs Client Library for C++. 3 | # 4 | # See http://google.github.io/google-api-cpp-client/latest/start/get_started 5 | # for more information about what to do with this file. 6 | 7 | project (google_calendar_api) 8 | 9 | # These sources assume that the CMakeLists.txt in ../.. added itself to 10 | # the include directories so that include paths are specified explicitly 11 | # with the directory #include "google/calendar_api/..." 12 | add_library(google_calendar_api STATIC 13 | acl.cc 14 | acl_rule.cc 15 | calendar.cc 16 | calendar_list.cc 17 | calendar_list_entry.cc 18 | calendar_notification.cc 19 | channel.cc 20 | color_definition.cc 21 | colors.cc 22 | error.cc 23 | event.cc 24 | event_attachment.cc 25 | event_attendee.cc 26 | event_date_time.cc 27 | event_reminder.cc 28 | events.cc 29 | free_busy_calendar.cc 30 | free_busy_group.cc 31 | free_busy_request.cc 32 | free_busy_request_item.cc 33 | free_busy_response.cc 34 | setting.cc 35 | settings.cc 36 | time_period.cc 37 | calendar_service.cc) 38 | target_link_libraries(google_calendar_api googleapis_http) 39 | target_link_libraries(google_calendar_api googleapis_internal) 40 | target_link_libraries(google_calendar_api googleapis_jsoncpp) 41 | target_link_libraries(google_calendar_api googleapis_utils) 42 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/acl.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Acl 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/acl.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/calendar_api/acl_rule.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_calendar_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | Acl* Acl::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | Acl::Acl(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | Acl::Acl(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | Acl::~Acl() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray Acl::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray Acl::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_calendar_api 72 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/acl_rule.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // AclRule 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/acl_rule.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | 40 | // Object factory method (static). 41 | AclRule::AclRuleScope* AclRule::AclRuleScope::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | AclRule::AclRuleScope::AclRuleScope(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | AclRule::AclRuleScope::AclRuleScope(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | AclRule::AclRuleScope::~AclRuleScope() { 57 | } 58 | 59 | // Properties. 60 | // Object factory method (static). 61 | AclRule* AclRule::New() { 62 | return new client::JsonCppCapsule; 63 | } 64 | 65 | // Standard immutable constructor. 66 | AclRule::AclRule(const Json::Value& storage) 67 | : client::JsonCppData(storage) { 68 | } 69 | 70 | // Standard mutable constructor. 71 | AclRule::AclRule(Json::Value* storage) 72 | : client::JsonCppData(storage) { 73 | } 74 | 75 | // Standard destructor. 76 | AclRule::~AclRule() { 77 | } 78 | 79 | // Properties. 80 | } // namespace google_calendar_api 81 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/calendar.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Calendar 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/calendar.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | Calendar* Calendar::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | Calendar::Calendar(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | Calendar::Calendar(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | Calendar::~Calendar() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/calendar_api.h: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | // This code was generated by google-apis-code-generator 1.5.1 13 | 14 | #ifndef GOOGLE_CALENDAR_API_CALENDAR_API_H_ 15 | #define GOOGLE_CALENDAR_API_CALENDAR_API_H_ 16 | 17 | #include "google/calendar_api/acl_rule.h" 18 | #include "google/calendar_api/acl.h" 19 | #include "google/calendar_api/calendar.h" 20 | #include "google/calendar_api/event_reminder.h" 21 | #include "google/calendar_api/calendar_notification.h" 22 | #include "google/calendar_api/calendar_list_entry.h" 23 | #include "google/calendar_api/calendar_list.h" 24 | #include "google/calendar_api/channel.h" 25 | #include "google/calendar_api/color_definition.h" 26 | #include "google/calendar_api/colors.h" 27 | #include "google/calendar_api/error.h" 28 | #include "google/calendar_api/event_attachment.h" 29 | #include "google/calendar_api/event_attendee.h" 30 | #include "google/calendar_api/event_date_time.h" 31 | #include "google/calendar_api/event.h" 32 | #include "google/calendar_api/events.h" 33 | #include "google/calendar_api/time_period.h" 34 | #include "google/calendar_api/free_busy_calendar.h" 35 | #include "google/calendar_api/free_busy_group.h" 36 | #include "google/calendar_api/free_busy_request_item.h" 37 | #include "google/calendar_api/free_busy_request.h" 38 | #include "google/calendar_api/free_busy_response.h" 39 | #include "google/calendar_api/setting.h" 40 | #include "google/calendar_api/settings.h" 41 | 42 | #include "google/calendar_api/calendar_service.h" 43 | 44 | 45 | #endif // GOOGLE_CALENDAR_API_CALENDAR_API_H_ 46 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/calendar_list.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // CalendarList 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/calendar_list.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/calendar_api/calendar_list_entry.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_calendar_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | CalendarList* CalendarList::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | CalendarList::CalendarList(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | CalendarList::CalendarList(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | CalendarList::~CalendarList() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray CalendarList::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray CalendarList::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_calendar_api 72 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/calendar_notification.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // CalendarNotification 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/calendar_notification.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | CalendarNotification* CalendarNotification::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | CalendarNotification::CalendarNotification(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | CalendarNotification::CalendarNotification(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | CalendarNotification::~CalendarNotification() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/channel.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Channel 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/channel.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_calendar_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | Channel* Channel::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | Channel::Channel(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | Channel::Channel(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | Channel::~Channel() { 57 | } 58 | 59 | // Properties. 60 | } // namespace google_calendar_api 61 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/color_definition.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // ColorDefinition 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/color_definition.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | ColorDefinition* ColorDefinition::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | ColorDefinition::ColorDefinition(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | ColorDefinition::ColorDefinition(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | ColorDefinition::~ColorDefinition() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/colors.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Colors 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/colors.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/client/util/date_time.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | #include "google/calendar_api/color_definition.h" 33 | 34 | 35 | #include 36 | #include "googleapis/strings/strcat.h" 37 | 38 | namespace google_calendar_api { 39 | using namespace googleapis; 40 | 41 | 42 | // Object factory method (static). 43 | Colors* Colors::New() { 44 | return new client::JsonCppCapsule; 45 | } 46 | 47 | // Standard immutable constructor. 48 | Colors::Colors(const Json::Value& storage) 49 | : client::JsonCppData(storage) { 50 | } 51 | 52 | // Standard mutable constructor. 53 | Colors::Colors(Json::Value* storage) 54 | : client::JsonCppData(storage) { 55 | } 56 | 57 | // Standard destructor. 58 | Colors::~Colors() { 59 | } 60 | 61 | // Properties. 62 | 63 | const client::JsonCppAssociativeArray Colors::get_calendar() const { 64 | const Json::Value& storage = Storage("calendar"); 65 | return client::JsonValueToCppValueHelper >(storage); 66 | } 67 | 68 | client::JsonCppAssociativeArray Colors::mutable_calendar() { 69 | Json::Value* storage = MutableStorage("calendar"); 70 | return client::JsonValueToMutableCppValueHelper >(storage); 71 | } 72 | 73 | const client::JsonCppAssociativeArray Colors::get_event() const { 74 | const Json::Value& storage = Storage("event"); 75 | return client::JsonValueToCppValueHelper >(storage); 76 | } 77 | 78 | client::JsonCppAssociativeArray Colors::mutable_event() { 79 | Json::Value* storage = MutableStorage("event"); 80 | return client::JsonValueToMutableCppValueHelper >(storage); 81 | } 82 | } // namespace google_calendar_api 83 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/error.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Error 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/error.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | Error* Error::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | Error::Error(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | Error::Error(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | Error::~Error() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/event_attachment.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // EventAttachment 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/event_attachment.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | EventAttachment* EventAttachment::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | EventAttachment::EventAttachment(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | EventAttachment::EventAttachment(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | EventAttachment::~EventAttachment() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/event_attendee.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // EventAttendee 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/event_attendee.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_calendar_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | EventAttendee* EventAttendee::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | EventAttendee::EventAttendee(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | EventAttendee::EventAttendee(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | EventAttendee::~EventAttendee() { 57 | } 58 | 59 | // Properties. 60 | } // namespace google_calendar_api 61 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/event_date_time.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // EventDateTime 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/event_date_time.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/client/util/date_time.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_calendar_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | EventDateTime* EventDateTime::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | EventDateTime::EventDateTime(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | EventDateTime::EventDateTime(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | EventDateTime::~EventDateTime() { 57 | } 58 | 59 | // Properties. 60 | } // namespace google_calendar_api 61 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/event_reminder.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // EventReminder 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/event_reminder.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_calendar_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | EventReminder* EventReminder::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | EventReminder::EventReminder(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | EventReminder::EventReminder(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | EventReminder::~EventReminder() { 57 | } 58 | 59 | // Properties. 60 | } // namespace google_calendar_api 61 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/events.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Events 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/events.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/client/util/date_time.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | #include "google/calendar_api/event.h" 33 | #include "google/calendar_api/event_reminder.h" 34 | 35 | 36 | #include 37 | #include "googleapis/strings/strcat.h" 38 | 39 | namespace google_calendar_api { 40 | using namespace googleapis; 41 | 42 | 43 | // Object factory method (static). 44 | Events* Events::New() { 45 | return new client::JsonCppCapsule; 46 | } 47 | 48 | // Standard immutable constructor. 49 | Events::Events(const Json::Value& storage) 50 | : client::JsonCppData(storage) { 51 | } 52 | 53 | // Standard mutable constructor. 54 | Events::Events(Json::Value* storage) 55 | : client::JsonCppData(storage) { 56 | } 57 | 58 | // Standard destructor. 59 | Events::~Events() { 60 | } 61 | 62 | // Properties. 63 | 64 | const client::JsonCppArray Events::get_default_reminders() const { 65 | const Json::Value& storage = Storage("defaultReminders"); 66 | return client::JsonValueToCppValueHelper >(storage); 67 | } 68 | 69 | client::JsonCppArray Events::mutable_defaultReminders() { 70 | Json::Value* storage = MutableStorage("defaultReminders"); 71 | return client::JsonValueToMutableCppValueHelper >(storage); 72 | } 73 | 74 | const client::JsonCppArray Events::get_items() const { 75 | const Json::Value& storage = Storage("items"); 76 | return client::JsonValueToCppValueHelper >(storage); 77 | } 78 | 79 | client::JsonCppArray Events::mutable_items() { 80 | Json::Value* storage = MutableStorage("items"); 81 | return client::JsonValueToMutableCppValueHelper >(storage); 82 | } 83 | } // namespace google_calendar_api 84 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/free_busy_calendar.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // FreeBusyCalendar 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/free_busy_calendar.h" 27 | #include "googleapis/client/data/jsoncpp_data.h" 28 | #include "googleapis/strings/stringpiece.h" 29 | 30 | #include "google/calendar_api/error.h" 31 | #include "google/calendar_api/time_period.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_calendar_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | FreeBusyCalendar* FreeBusyCalendar::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | FreeBusyCalendar::FreeBusyCalendar(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | FreeBusyCalendar::FreeBusyCalendar(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | FreeBusyCalendar::~FreeBusyCalendar() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray FreeBusyCalendar::get_busy() const { 63 | const Json::Value& storage = Storage("busy"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray FreeBusyCalendar::mutable_busy() { 68 | Json::Value* storage = MutableStorage("busy"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | 72 | const client::JsonCppArray FreeBusyCalendar::get_errors() const { 73 | const Json::Value& storage = Storage("errors"); 74 | return client::JsonValueToCppValueHelper >(storage); 75 | } 76 | 77 | client::JsonCppArray FreeBusyCalendar::mutable_errors() { 78 | Json::Value* storage = MutableStorage("errors"); 79 | return client::JsonValueToMutableCppValueHelper >(storage); 80 | } 81 | } // namespace google_calendar_api 82 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/free_busy_group.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // FreeBusyGroup 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/free_busy_group.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/calendar_api/error.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_calendar_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | FreeBusyGroup* FreeBusyGroup::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | FreeBusyGroup::FreeBusyGroup(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | FreeBusyGroup::FreeBusyGroup(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | FreeBusyGroup::~FreeBusyGroup() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray FreeBusyGroup::get_errors() const { 63 | const Json::Value& storage = Storage("errors"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray FreeBusyGroup::mutable_errors() { 68 | Json::Value* storage = MutableStorage("errors"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_calendar_api 72 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/free_busy_request.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // FreeBusyRequest 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/free_busy_request.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/client/util/date_time.h" 31 | #include "googleapis/strings/stringpiece.h" 32 | 33 | #include "google/calendar_api/free_busy_request_item.h" 34 | 35 | 36 | #include 37 | #include "googleapis/strings/strcat.h" 38 | 39 | namespace google_calendar_api { 40 | using namespace googleapis; 41 | 42 | 43 | // Object factory method (static). 44 | FreeBusyRequest* FreeBusyRequest::New() { 45 | return new client::JsonCppCapsule; 46 | } 47 | 48 | // Standard immutable constructor. 49 | FreeBusyRequest::FreeBusyRequest(const Json::Value& storage) 50 | : client::JsonCppData(storage) { 51 | } 52 | 53 | // Standard mutable constructor. 54 | FreeBusyRequest::FreeBusyRequest(Json::Value* storage) 55 | : client::JsonCppData(storage) { 56 | } 57 | 58 | // Standard destructor. 59 | FreeBusyRequest::~FreeBusyRequest() { 60 | } 61 | 62 | // Properties. 63 | 64 | const client::JsonCppArray FreeBusyRequest::get_items() const { 65 | const Json::Value& storage = Storage("items"); 66 | return client::JsonValueToCppValueHelper >(storage); 67 | } 68 | 69 | client::JsonCppArray FreeBusyRequest::mutable_items() { 70 | Json::Value* storage = MutableStorage("items"); 71 | return client::JsonValueToMutableCppValueHelper >(storage); 72 | } 73 | } // namespace google_calendar_api 74 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/free_busy_request_item.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // FreeBusyRequestItem 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/free_busy_request_item.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | FreeBusyRequestItem* FreeBusyRequestItem::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | FreeBusyRequestItem::FreeBusyRequestItem(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | FreeBusyRequestItem::FreeBusyRequestItem(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | FreeBusyRequestItem::~FreeBusyRequestItem() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/free_busy_response.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // FreeBusyResponse 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/free_busy_response.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/client/util/date_time.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | #include "google/calendar_api/free_busy_calendar.h" 33 | #include "google/calendar_api/free_busy_group.h" 34 | 35 | 36 | #include 37 | #include "googleapis/strings/strcat.h" 38 | 39 | namespace google_calendar_api { 40 | using namespace googleapis; 41 | 42 | 43 | // Object factory method (static). 44 | FreeBusyResponse* FreeBusyResponse::New() { 45 | return new client::JsonCppCapsule; 46 | } 47 | 48 | // Standard immutable constructor. 49 | FreeBusyResponse::FreeBusyResponse(const Json::Value& storage) 50 | : client::JsonCppData(storage) { 51 | } 52 | 53 | // Standard mutable constructor. 54 | FreeBusyResponse::FreeBusyResponse(Json::Value* storage) 55 | : client::JsonCppData(storage) { 56 | } 57 | 58 | // Standard destructor. 59 | FreeBusyResponse::~FreeBusyResponse() { 60 | } 61 | 62 | // Properties. 63 | 64 | const client::JsonCppAssociativeArray FreeBusyResponse::get_calendars() const { 65 | const Json::Value& storage = Storage("calendars"); 66 | return client::JsonValueToCppValueHelper >(storage); 67 | } 68 | 69 | client::JsonCppAssociativeArray FreeBusyResponse::mutable_calendars() { 70 | Json::Value* storage = MutableStorage("calendars"); 71 | return client::JsonValueToMutableCppValueHelper >(storage); 72 | } 73 | 74 | const client::JsonCppAssociativeArray FreeBusyResponse::get_groups() const { 75 | const Json::Value& storage = Storage("groups"); 76 | return client::JsonValueToCppValueHelper >(storage); 77 | } 78 | 79 | client::JsonCppAssociativeArray FreeBusyResponse::mutable_groups() { 80 | Json::Value* storage = MutableStorage("groups"); 81 | return client::JsonValueToMutableCppValueHelper >(storage); 82 | } 83 | } // namespace google_calendar_api 84 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/setting.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Setting 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/setting.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | Setting* Setting::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | Setting::Setting(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | Setting::Setting(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | Setting::~Setting() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/settings.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // Settings 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/settings.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/calendar_api/setting.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_calendar_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | Settings* Settings::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | Settings::Settings(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | Settings::Settings(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | Settings::~Settings() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray Settings::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray Settings::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_calendar_api 72 | -------------------------------------------------------------------------------- /service_apis/calendar/google/calendar_api/time_period.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Calendar API (calendar/v3) 19 | // Description: 20 | // Manipulates events and other calendar data. 21 | // Classes: 22 | // TimePeriod 23 | // Documentation: 24 | // https://developers.google.com/google-apps/calendar/firstapp 25 | 26 | #include "google/calendar_api/time_period.h" 27 | #include "googleapis/client/data/jsoncpp_data.h" 28 | #include "googleapis/client/util/date_time.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_calendar_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | TimePeriod* TimePeriod::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | TimePeriod::TimePeriod(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | TimePeriod::TimePeriod(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | TimePeriod::~TimePeriod() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_calendar_api 60 | -------------------------------------------------------------------------------- /service_apis/calendar/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Calendar API v3 Client Library for C++ 4 | 5 | 6 |

Calendar API v3 Client Library for C++

7 | 8 |

9 | If you are using a default build environment as documented in the 10 | Google APIs Client Library for C++ Installation Guide then: 11 |

    12 |
  1. Move this directory to the service_apis directory in 13 | the build root. 14 |
  2. Run make from the root directory 15 |
16 |

17 |

18 | To use the specialized service library, consumers may either: 19 |

    20 |
  1. Add this directory to your INCLUDE path. 21 |
      22 |
    • In your CMakeLists.txt file, add the following:
      23 | INCLUDE_DIRECTORIES(${GOOGLEAPIS_SERVICE_REPOSITORY_DIR}/{{ api.module.name }) 24 |
    • Add the following target_link_libraries for your 25 | build target my_build_target:
      26 | target_link_libraries(my_build_target 27 |
    28 |
  2. Either include the single monolithic header file
    29 | #include "/.h" 30 |
  3. Or include only the individual header files explicitly needed. 31 | 32 |

    33 | 34 | The provided CMakeLists.txt file is a CMake file compatible with 35 | those in the Google APIs Client Library for C++ SDK. 36 |

    37 | 38 |

    39 | See Getting Started with the Google APIs Client Library for C++ for more 40 | information on how to use these service API libraries. 41 |

    42 | 43 | 44 | -------------------------------------------------------------------------------- /service_apis/storage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This is a CMake file for YouTube Data API v3 2 | # using the Google APIs Client Library for C++. 3 | # 4 | # See http://google.github.io/google-api-cpp-client/latest/start/get_started 5 | # for more information about what to do with this file. 6 | 7 | project (storage) 8 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/.) 9 | 10 | add_subdirectory(google/storage_api) 11 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This is a CMake file for Cloud Storage JSON API v1 2 | # using the Google APIs Client Library for C++. 3 | # 4 | # See http://google.github.io/google-api-cpp-client/latest/start/get_started 5 | # for more information about what to do with this file. 6 | 7 | project (google_storage_api) 8 | 9 | # These sources assume that the CMakeLists.txt in ../.. added itself to 10 | # the include directories so that include paths are specified explicitly 11 | # with the directory #include "google/storage_api/..." 12 | add_library(google_storage_api STATIC 13 | bucket.cc 14 | bucket_access_control.cc 15 | bucket_access_controls.cc 16 | buckets.cc 17 | channel.cc 18 | compose_request.cc 19 | notification.cc 20 | notifications.cc 21 | object.cc 22 | object_access_control.cc 23 | object_access_controls.cc 24 | objects.cc 25 | policy.cc 26 | rewrite_response.cc 27 | service_account.cc 28 | test_iam_permissions_response.cc 29 | storage_service.cc) 30 | target_link_libraries(google_storage_api googleapis_http) 31 | target_link_libraries(google_storage_api googleapis_internal) 32 | target_link_libraries(google_storage_api googleapis_jsoncpp) 33 | target_link_libraries(google_storage_api googleapis_utils) 34 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/bucket_access_control.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // BucketAccessControl 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/bucket_access_control.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_storage_api { 36 | using namespace googleapis; 37 | 38 | 39 | 40 | // Object factory method (static). 41 | BucketAccessControl::BucketAccessControlProjectTeam* BucketAccessControl::BucketAccessControlProjectTeam::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | BucketAccessControl::BucketAccessControlProjectTeam::BucketAccessControlProjectTeam(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | BucketAccessControl::BucketAccessControlProjectTeam::BucketAccessControlProjectTeam(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | BucketAccessControl::BucketAccessControlProjectTeam::~BucketAccessControlProjectTeam() { 57 | } 58 | 59 | // Properties. 60 | // Object factory method (static). 61 | BucketAccessControl* BucketAccessControl::New() { 62 | return new client::JsonCppCapsule; 63 | } 64 | 65 | // Standard immutable constructor. 66 | BucketAccessControl::BucketAccessControl(const Json::Value& storage) 67 | : client::JsonCppData(storage) { 68 | } 69 | 70 | // Standard mutable constructor. 71 | BucketAccessControl::BucketAccessControl(Json::Value* storage) 72 | : client::JsonCppData(storage) { 73 | } 74 | 75 | // Standard destructor. 76 | BucketAccessControl::~BucketAccessControl() { 77 | } 78 | 79 | // Properties. 80 | } // namespace google_storage_api 81 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/bucket_access_controls.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // BucketAccessControls 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/bucket_access_controls.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/storage_api/bucket_access_control.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_storage_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | BucketAccessControls* BucketAccessControls::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | BucketAccessControls::BucketAccessControls(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | BucketAccessControls::BucketAccessControls(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | BucketAccessControls::~BucketAccessControls() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray BucketAccessControls::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray BucketAccessControls::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_storage_api 72 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/buckets.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // Buckets 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/buckets.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/storage_api/bucket.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_storage_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | Buckets* Buckets::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | Buckets::Buckets(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | Buckets::Buckets(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | Buckets::~Buckets() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray Buckets::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray Buckets::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_storage_api 72 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/channel.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // Channel 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/channel.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_storage_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | Channel* Channel::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | Channel::Channel(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | Channel::Channel(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | Channel::~Channel() { 57 | } 58 | 59 | // Properties. 60 | } // namespace google_storage_api 61 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/notification.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // Notification 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/notification.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_storage_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | Notification* Notification::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | Notification::Notification(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | Notification::Notification(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | Notification::~Notification() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_storage_api 60 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/notifications.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // Notifications 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/notifications.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/storage_api/notification.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_storage_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | Notifications* Notifications::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | Notifications::Notifications(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | Notifications::Notifications(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | Notifications::~Notifications() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray Notifications::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray Notifications::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_storage_api 72 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/object_access_control.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // ObjectAccessControl 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/object_access_control.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_storage_api { 37 | using namespace googleapis; 38 | 39 | 40 | 41 | // Object factory method (static). 42 | ObjectAccessControl::ObjectAccessControlProjectTeam* ObjectAccessControl::ObjectAccessControlProjectTeam::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | ObjectAccessControl::ObjectAccessControlProjectTeam::ObjectAccessControlProjectTeam(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | ObjectAccessControl::ObjectAccessControlProjectTeam::ObjectAccessControlProjectTeam(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | ObjectAccessControl::ObjectAccessControlProjectTeam::~ObjectAccessControlProjectTeam() { 58 | } 59 | 60 | // Properties. 61 | // Object factory method (static). 62 | ObjectAccessControl* ObjectAccessControl::New() { 63 | return new client::JsonCppCapsule; 64 | } 65 | 66 | // Standard immutable constructor. 67 | ObjectAccessControl::ObjectAccessControl(const Json::Value& storage) 68 | : client::JsonCppData(storage) { 69 | } 70 | 71 | // Standard mutable constructor. 72 | ObjectAccessControl::ObjectAccessControl(Json::Value* storage) 73 | : client::JsonCppData(storage) { 74 | } 75 | 76 | // Standard destructor. 77 | ObjectAccessControl::~ObjectAccessControl() { 78 | } 79 | 80 | // Properties. 81 | } // namespace google_storage_api 82 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/object_access_controls.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // ObjectAccessControls 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/object_access_controls.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/storage_api/object_access_control.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_storage_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | ObjectAccessControls* ObjectAccessControls::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | ObjectAccessControls::ObjectAccessControls(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | ObjectAccessControls::ObjectAccessControls(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | ObjectAccessControls::~ObjectAccessControls() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray ObjectAccessControls::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray ObjectAccessControls::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_storage_api 72 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/objects.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // Objects 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/objects.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/storage_api/object.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_storage_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | Objects* Objects::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | Objects::Objects(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | Objects::Objects(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | Objects::~Objects() { 58 | } 59 | 60 | // Properties. 61 | 62 | const client::JsonCppArray Objects::get_items() const { 63 | const Json::Value& storage = Storage("items"); 64 | return client::JsonValueToCppValueHelper >(storage); 65 | } 66 | 67 | client::JsonCppArray Objects::mutable_items() { 68 | Json::Value* storage = MutableStorage("items"); 69 | return client::JsonValueToMutableCppValueHelper >(storage); 70 | } 71 | } // namespace google_storage_api 72 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/policy.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // Policy 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/policy.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_storage_api { 36 | using namespace googleapis; 37 | 38 | 39 | 40 | // Object factory method (static). 41 | Policy::PolicyBindings* Policy::PolicyBindings::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | Policy::PolicyBindings::PolicyBindings(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | Policy::PolicyBindings::PolicyBindings(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | Policy::PolicyBindings::~PolicyBindings() { 57 | } 58 | 59 | // Properties. 60 | // Object factory method (static). 61 | Policy* Policy::New() { 62 | return new client::JsonCppCapsule; 63 | } 64 | 65 | // Standard immutable constructor. 66 | Policy::Policy(const Json::Value& storage) 67 | : client::JsonCppData(storage) { 68 | } 69 | 70 | // Standard mutable constructor. 71 | Policy::Policy(Json::Value* storage) 72 | : client::JsonCppData(storage) { 73 | } 74 | 75 | // Standard destructor. 76 | Policy::~Policy() { 77 | } 78 | 79 | // Properties. 80 | } // namespace google_storage_api 81 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/rewrite_response.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // RewriteResponse 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/rewrite_response.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | #include "google/storage_api/object.h" 33 | 34 | 35 | #include 36 | #include "googleapis/strings/strcat.h" 37 | 38 | namespace google_storage_api { 39 | using namespace googleapis; 40 | 41 | 42 | // Object factory method (static). 43 | RewriteResponse* RewriteResponse::New() { 44 | return new client::JsonCppCapsule; 45 | } 46 | 47 | // Standard immutable constructor. 48 | RewriteResponse::RewriteResponse(const Json::Value& storage) 49 | : client::JsonCppData(storage) { 50 | } 51 | 52 | // Standard mutable constructor. 53 | RewriteResponse::RewriteResponse(Json::Value* storage) 54 | : client::JsonCppData(storage) { 55 | } 56 | 57 | // Standard destructor. 58 | RewriteResponse::~RewriteResponse() { 59 | } 60 | 61 | // Properties. 62 | 63 | const Object RewriteResponse::get_resource() const { 64 | const Json::Value& storage = Storage("resource"); 65 | return client::JsonValueToCppValueHelper(storage); 66 | } 67 | 68 | Object RewriteResponse::mutable_resource() { 69 | Json::Value* storage = MutableStorage("resource"); 70 | return client::JsonValueToMutableCppValueHelper(storage); 71 | } 72 | } // namespace google_storage_api 73 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/service_account.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // ServiceAccount 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/service_account.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_storage_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | ServiceAccount* ServiceAccount::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | ServiceAccount::ServiceAccount(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | ServiceAccount::ServiceAccount(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | ServiceAccount::~ServiceAccount() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_storage_api 60 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/storage_api.h: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | // This code was generated by google-apis-code-generator 1.5.1 13 | 14 | #ifndef GOOGLE_STORAGE_API_STORAGE_API_H_ 15 | #define GOOGLE_STORAGE_API_STORAGE_API_H_ 16 | 17 | #include "google/storage_api/bucket_access_control.h" 18 | #include "google/storage_api/object_access_control.h" 19 | #include "google/storage_api/bucket.h" 20 | #include "google/storage_api/bucket_access_controls.h" 21 | #include "google/storage_api/buckets.h" 22 | #include "google/storage_api/channel.h" 23 | #include "google/storage_api/object.h" 24 | #include "google/storage_api/compose_request.h" 25 | #include "google/storage_api/notification.h" 26 | #include "google/storage_api/notifications.h" 27 | #include "google/storage_api/object_access_controls.h" 28 | #include "google/storage_api/objects.h" 29 | #include "google/storage_api/policy.h" 30 | #include "google/storage_api/rewrite_response.h" 31 | #include "google/storage_api/service_account.h" 32 | #include "google/storage_api/test_iam_permissions_response.h" 33 | 34 | #include "google/storage_api/storage_service.h" 35 | 36 | 37 | #endif // GOOGLE_STORAGE_API_STORAGE_API_H_ 38 | -------------------------------------------------------------------------------- /service_apis/storage/google/storage_api/test_iam_permissions_response.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Cloud Storage JSON API (storage/v1) 19 | // Description: 20 | // Stores and retrieves potentially large, immutable data objects. 21 | // Classes: 22 | // TestIamPermissionsResponse 23 | // Documentation: 24 | // https://developers.google.com/storage/docs/json_api/ 25 | 26 | #include "google/storage_api/test_iam_permissions_response.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_storage_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | TestIamPermissionsResponse* TestIamPermissionsResponse::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | TestIamPermissionsResponse::TestIamPermissionsResponse(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | TestIamPermissionsResponse::TestIamPermissionsResponse(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | TestIamPermissionsResponse::~TestIamPermissionsResponse() { 56 | } 57 | 58 | // Properties. 59 | } // namespace google_storage_api 60 | -------------------------------------------------------------------------------- /service_apis/storage/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | YouTube Data API v3 Client Library for C++ 4 | 5 | 6 |

    YouTube Data API v3 Client Library for C++

    7 | 8 |

    9 | If you are using a default build environment as documented in the 10 | Google APIs Client Library for C++ Installation Guide then: 11 |

      12 |
    1. Move this directory to the service_apis directory in 13 | the build root. 14 |
    2. Run make from the root directory 15 |
    16 |

    17 |

    18 | To use the specialized service library, consumers may either: 19 |

      20 |
    1. Add this directory to your INCLUDE path. 21 |
        22 |
      • In your CMakeLists.txt file, add the following:
        23 | INCLUDE_DIRECTORIES(${GOOGLEAPIS_SERVICE_REPOSITORY_DIR}/{{ api.module.name }) 24 |
      • Add the following target_link_libraries for your 25 | build target my_build_target:
        26 | target_link_libraries(my_build_target 27 |
      28 |
    2. Either include the single monolithic header file
      29 | #include "/.h" 30 |
    3. Or include only the individual header files explicitly needed. 31 | 32 |

      33 | 34 | The provided CMakeLists.txt file is a CMake file compatible with 35 | those in the Google APIs Client Library for C++ SDK. 36 |

      37 | 38 |

      39 | See Getting Started with the Google APIs Client Library for C++ for more 40 | information on how to use these service API libraries. 41 |

      42 | 43 | 44 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(googleapis) 2 | 3 | if(EXISTS "./gmock") 4 | include_directories( 5 | ${CMAKE_CURRENT_SOURCE_DIR}/gmock/include 6 | ${CMAKE_CURRENT_SOURCE_DIR}/gmock/gtest/include) 7 | add_subdirectory(gmock) 8 | else() 9 | include_directories(${GMOCK_INCLUDES}) 10 | endif() 11 | -------------------------------------------------------------------------------- /src/googleapis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project (GoogleApis_C++_Client_Utils) 2 | 3 | add_subdirectory(client) 4 | 5 | # The rest of googleapis is auto-generated. 6 | # Really we'd like this to be part of some other external project. 7 | add_library(googleapis_internal STATIC 8 | ./base/callback.cc 9 | ./base/once.cc 10 | ./base/strtoint.cc 11 | ./base/windows_compatability.cc 12 | ./strings/ascii_ctype.cc 13 | ./strings/case.cc 14 | ./strings/memutil.cc 15 | ./strings/numbers.cc 16 | ./strings/split.cc 17 | ./strings/strcat.cc 18 | ./strings/stringpiece.cc 19 | ./strings/strip.cc 20 | ./strings/util.cc 21 | ./util/executor.cc 22 | ./util/file.cc 23 | ./util/hash.cc 24 | ./util/status.cc 25 | ) 26 | target_link_libraries(googleapis_internal ${GLOG_LIBRARY}) 27 | install(TARGETS googleapis_internal DESTINATION ${GOOGLEAPIS_INSTALL_LIB_DIR}) 28 | 29 | install(FILES 30 | base/callback-specializations.h 31 | base/callback-types.h 32 | base/callback.h 33 | base/int128.h 34 | base/integral_types.h 35 | base/macros.h 36 | base/mutex.h 37 | base/once.h 38 | base/port.h 39 | base/strtoint.h 40 | base/template_util.h 41 | base/thread_annotations.h 42 | base/windows_compatability.h 43 | DESTINATION ${GOOGLEAPIS_INSTALL_INCLUDE_DIR}/base) 44 | 45 | install(FILES 46 | strings/ascii_ctype.h 47 | strings/case.h 48 | strings/join.h 49 | strings/memutil.h 50 | strings/numbers.h 51 | strings/split.h 52 | strings/strcat.h 53 | strings/stringpiece.h 54 | strings/strip.h 55 | strings/util.h 56 | DESTINATION ${GOOGLEAPIS_INSTALL_INCLUDE_DIR}/strings) 57 | 58 | install(FILES 59 | util/case_insensitive_hash.h 60 | util/executor.h 61 | util/file.h 62 | util/hash.h 63 | util/mock_executor.h 64 | util/status.h 65 | DESTINATION ${GOOGLEAPIS_INSTALL_INCLUDE_DIR}/util) 66 | 67 | -------------------------------------------------------------------------------- /src/googleapis/base/callback.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #include "googleapis/base/callback.h" 20 | 21 | #include "googleapis/base/mutex.h" 22 | #include 23 | 24 | namespace googleapis { 25 | 26 | // Fails with informative error message when 'name' is not a repeatable 27 | // callback. 28 | // This is a helper utility function for callback-specializations.h. 29 | // CallbackUtils_ class is defined in generate-callback-specializations.py. 30 | void CallbackUtils_::FailIsRepeatable(const char* name) { 31 | LOG(FATAL) << "A " << name << " made with NewCallback() " 32 | "is not a repeatable callback!"; 33 | } 34 | 35 | } // namespace googleapis 36 | -------------------------------------------------------------------------------- /src/googleapis/base/once.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #include "googleapis/base/mutex.h" 20 | #include "googleapis/base/once.h" 21 | 22 | namespace googleapis { 23 | 24 | #ifdef _MSC_VER 25 | void GoogleOnceInit(GoogleOnceType* once, void (*initializer)()) { 26 | static Mutex mutex_(base::LINKER_INITIALIZED); 27 | MutexLock l(&mutex_); 28 | if (!*once) { 29 | *once = true; 30 | initializer(); 31 | } 32 | } 33 | #endif 34 | 35 | } // namespace googleapis 36 | -------------------------------------------------------------------------------- /src/googleapis/base/once.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #ifndef GOOGLEAPIS_ONCE_H_ // NOLINT 20 | #define GOOGLEAPIS_ONCE_H_ 21 | 22 | #ifndef _MSC_VER 23 | #include 24 | #endif 25 | #include 26 | #include "googleapis/base/port.h" 27 | namespace googleapis { 28 | 29 | #ifndef _MSC_VER 30 | 31 | typedef pthread_once_t GoogleOnceType; 32 | #define GOOGLE_ONCE_INIT PTHREAD_ONCE_INIT 33 | 34 | inline void GoogleOnceInit(GoogleOnceType* once, void (*initializer)()) { 35 | CHECK_EQ(0, pthread_once(once, initializer)); 36 | } 37 | 38 | #else 39 | 40 | // I cant get Windows INIT_ONCE to work, even setting _WIN32_WINNT = 0x0600 41 | // So let's implement this ourselves. 42 | 43 | typedef int64 GoogleOnceType; 44 | #define GOOGLE_ONCE_INIT 0 45 | void GoogleOnceInit(GoogleOnceType* once, void (*initializer)()); 46 | 47 | #endif 48 | 49 | } // namespace googleapis 50 | #endif // GOOGLEAPIS_ONCE_H_ NOLINT 51 | -------------------------------------------------------------------------------- /src/googleapis/base/strtoint.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | // 21 | // Architecture-neutral plug compatible replacements for strtol() friends. 22 | // See strtoint.h for details on how to use this component. 23 | // 24 | 25 | #include 26 | #include 27 | #include "googleapis/base/port.h" 28 | #include "googleapis/base/strtoint.h" 29 | 30 | namespace googleapis { 31 | 32 | // Replacement strto[u]l functions that have identical overflow and underflow 33 | // characteristics for both ILP-32 and LP-64 platforms, including errno 34 | // preservation for error-free calls. 35 | int32 strto32_adapter(const char *nptr, char **endptr, int base) { 36 | const int saved_errno = errno; 37 | errno = 0; 38 | const long result = strtol(nptr, endptr, base); 39 | if (errno == ERANGE && result == LONG_MIN) { 40 | return kint32min; 41 | } else if (errno == ERANGE && result == LONG_MAX) { 42 | return kint32max; 43 | } else if (errno == 0 && result < kint32min) { 44 | errno = ERANGE; 45 | return kint32min; 46 | } else if (errno == 0 && result > kint32max) { 47 | errno = ERANGE; 48 | return kint32max; 49 | } 50 | if (errno == 0) 51 | errno = saved_errno; 52 | return static_cast(result); 53 | } 54 | 55 | uint32 strtou32_adapter(const char *nptr, char **endptr, int base) { 56 | const int saved_errno = errno; 57 | errno = 0; 58 | const unsigned long result = strtoul(nptr, endptr, base); 59 | if (errno == ERANGE && result == ULONG_MAX) { 60 | return kuint32max; 61 | } else if (errno == 0 && result > kuint32max) { 62 | errno = ERANGE; 63 | return kuint32max; 64 | } 65 | if (errno == 0) 66 | errno = saved_errno; 67 | return static_cast(result); 68 | } 69 | 70 | } // namespace googleapis 71 | -------------------------------------------------------------------------------- /src/googleapis/base/windows_compatability.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | // TODO(user): 20130723 20 | // 21 | // Path handling is not right in general. 22 | // - Need to handle share paths that start with '//' 23 | // - We dont handle device specifiers ('C:' etc) 24 | // The code in here is sufficient just for existing tests and smoke testing 25 | // samples. Additional concepts introduced by Windows are generally not 26 | // yet accomodated. 27 | // 28 | // Need to do a thorough scrubbing on TCHAR in the code. 29 | // And also the use of _MSC_VER is the appropriate guard in each 30 | // porting situation. 31 | 32 | #include "googleapis/base/windows_compatability.h" 33 | 34 | #include 35 | #include 36 | using std::string; 37 | 38 | #include 39 | #include "googleapis/strings/util.h" 40 | #include "googleapis/base/port.h" 41 | 42 | namespace googleapis { 43 | 44 | using std::string; 45 | 46 | #ifdef _MSC_VER 47 | 48 | string FromWindowsPath(const string& path) { 49 | return StringReplace(path, "\\", "/", true); 50 | } 51 | 52 | string ToWindowsPath(const string& str) { 53 | return StringReplace(str, "/", "\\", true); 54 | } 55 | 56 | const WCHAR* ToWindowsWideString(const string& from, string* to) { 57 | int buffer_size = from.size() + 1; 58 | std::unique_ptr wide_string(new WCHAR[buffer_size]); 59 | 60 | int len = MultiByteToWideChar( 61 | CP_UTF8, 62 | 0, 63 | from.c_str(), 64 | from.size(), 65 | wide_string.get(), 66 | buffer_size - 1); 67 | CHECK_NE(0, len) << "Could not convert " << from 68 | << " error=" << GetLastError(); 69 | wide_string.get()[len] = 0; 70 | to->assign(reinterpret_cast(wide_string.get()), 71 | (len + 1) * sizeof(WCHAR)); 72 | return reinterpret_cast(to->c_str()); 73 | } 74 | 75 | string FromWindowsStr(const TCHAR* windows) { 76 | #ifndef UNICODE 77 | return string(windows); 78 | #else 79 | int data_size = wcslen(windows); 80 | std::unique_ptr data(new char[2 * data_size + 2]); 81 | int len = WideCharToMultiByte(CP_UTF8, 0, 82 | windows, data_size, 83 | data.get(), 2 * data_size + 1, 84 | NULL, NULL); 85 | CHECK_NE(0, len) << "Failed with " << GetLastError(); 86 | return string(data.get(), len); 87 | #endif 88 | } 89 | 90 | // These call the windows _vsnprintf, but always NUL-terminate. 91 | int base_port_MSVC_vsnprintf(char *str, size_t size, const char *format, 92 | va_list ap) { 93 | if (size == 0) // not even room for a \0? 94 | return -1; // not what C99 says to do, but what windows does 95 | str[size - 1] = '\0'; 96 | return _vsnprintf(str, size - 1, format, ap); 97 | } 98 | 99 | int base_port_MSVC_snprintf(char *str, size_t size, const char *format, ...) { 100 | va_list ap; 101 | va_start(ap, format); 102 | const int r = base_port_MSVC_vsnprintf(str, size, format, ap); 103 | va_end(ap); 104 | return r; 105 | } 106 | 107 | #endif // _MSC_VER 108 | 109 | } // namespace googleapis 110 | -------------------------------------------------------------------------------- /src/googleapis/base/windows_compatability.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | // This file provides some convienence routines for attempting to build 20 | // under windows. The windows build is not supported at this time since 21 | // it is not clear that the value is not worth the effort. 22 | // 23 | // The assumption for the windows port, at this time anyway, is that 24 | // the data interfaces are the same as the unix-flavored OS's even though 25 | // this is not the case at all for actual Windows APIs. 26 | // This means that: 27 | // Files are delimited by '/' (APIs will translate paths internally only 28 | // to call into windows) 29 | // 30 | // std::string uses char (APIs will convert to TCHAR only to call into 31 | // windows) 32 | // 33 | // the time epoch is seconds since 1/1/1970 (APIs will convert to windows 34 | // epoch of 100 nanosecond units since 1/1/1601 as needed). 35 | // 36 | #if defined(_MSC_VER) && !defined(GOOGLEAPIS_BASE_WINDOWS_COMPATABILITY_H_) 37 | #define GOOGLEAPIS_BASE_WINDOWS_COMPATABILITY_H_ 38 | 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | #include 45 | using std::string; 46 | #include "googleapis/base/port.h" 47 | namespace googleapis { 48 | 49 | inline struct tm* gmtime_r(const time_t *timep, struct tm* result) { 50 | return !gmtime_s(result, timep) ? NULL : result; 51 | } 52 | 53 | // windows.h is #defining DELETE which causes syntax errors for our 54 | // DELETE enum values. 55 | #ifdef DELETE 56 | #undef DELETE 57 | #endif 58 | 59 | // windows.h is also #defining ERROR and although it doesn't conflict with 60 | // of the library. 61 | #ifdef ERROR 62 | #undef ERROR 63 | #endif 64 | 65 | // Converts muti-byte utf8 encoding std::string into windows multibyte wide 66 | // string. 67 | const WCHAR* ToWindowsWideString(const string& from, string* to); 68 | 69 | // std::string is probably a utf8 encoding of char 70 | // but windows APIs uses strings of TCHAR which are wide characters 71 | // if we are using UNICODE. So this method converts a std::string of utf8 char 72 | // into a std::string of TCHAR (which might be wide). 73 | inline const TCHAR* ToWindowsString(const string& from, string* to) { 74 | #ifdef UNICODE 75 | return ToWindowsWideString(from, to); // TCHAR is WCHAR 76 | #else 77 | *to = from; 78 | return reinterpret_cast(to->c_str()); 79 | #endif 80 | } 81 | 82 | // Converts from TCHAR windows strings into utf8 encoding std::string. 83 | string FromWindowsStr(const TCHAR* windows); 84 | 85 | // Converts '/' delimited paths into windows '\' delimited paths. 86 | string ToWindowsPath(const string& str); 87 | 88 | // Converts windows '\' delimited paths into standard '/' delimited paths. 89 | string FromWindowsPath(const string& str); 90 | 91 | } // namespace googleapis 92 | #endif // defined(_MSC_VER) && !defined(GOOGLEAPIS_BASE_WINDOWS_COMPATABILITY_H_) 93 | -------------------------------------------------------------------------------- /src/googleapis/client/auth/credential_store.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | using std::string; 23 | #include "googleapis/client/auth/credential_store.h" 24 | #include "googleapis/client/data/codec.h" 25 | #include "googleapis/client/data/data_reader.h" 26 | #include "googleapis/client/transport/http_authorization.h" 27 | #include "googleapis/client/util/status.h" 28 | #include "googleapis/base/callback.h" 29 | 30 | namespace googleapis { 31 | 32 | namespace client { 33 | 34 | CredentialStoreFactory::CredentialStoreFactory() {} 35 | CredentialStoreFactory::~CredentialStoreFactory() {} 36 | 37 | void CredentialStoreFactory::set_codec_factory(CodecFactory* codec_factory) { 38 | codec_factory_.reset(codec_factory); 39 | } 40 | 41 | CredentialStore::CredentialStore() {} 42 | CredentialStore::~CredentialStore() {} 43 | 44 | void CredentialStore::set_codec( 45 | Codec* codec) { 46 | codec_.reset(codec); 47 | } 48 | 49 | static DataReader* WrapReader(DataReader* input_reader, Codec* codec, 50 | bool with_encoder, googleapis::util::Status* status) { 51 | if (!codec) { 52 | *status = StatusOk(); 53 | return input_reader; // passes ownership back 54 | } 55 | 56 | Closure* closure = DeletePointerClosure(input_reader); 57 | return with_encoder 58 | ? codec->NewManagedEncodingReader(input_reader, closure, status) 59 | : codec->NewManagedDecodingReader(input_reader, closure, status); 60 | } 61 | 62 | DataReader* CredentialStore::DecodedToEncodingReader( 63 | DataReader* input_reader, googleapis::util::Status* status) { 64 | return WrapReader(input_reader, codec_.get(), true, status); 65 | } 66 | 67 | DataReader* CredentialStore::EncodedToDecodingReader( 68 | DataReader* input_reader, googleapis::util::Status* status) { 69 | return WrapReader(input_reader, codec_.get(), false, status); 70 | } 71 | 72 | } // namespace client 73 | 74 | } // namespace googleapis 75 | -------------------------------------------------------------------------------- /src/googleapis/client/auth/jwt_builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #ifndef GOOGLEAPIS_AUTH_JWT_BUILDER_H_ 20 | #define GOOGLEAPIS_AUTH_JWT_BUILDER_H_ 21 | 22 | #include 23 | #include 24 | using std::string; 25 | 26 | #include "googleapis/strings/stringpiece.h" 27 | #include "googleapis/util/status.h" 28 | 29 | namespace googleapis { 30 | 31 | namespace client { 32 | 33 | /* 34 | * A helper class used to create the JWT we pass to the OAuth2.0 server. 35 | * 36 | * This class could be broken out into its own module if it is needed elsewhere 37 | * or to test more explicitly. 38 | */ 39 | class JwtBuilder { 40 | public: 41 | static googleapis::util::Status LoadPrivateKeyFromPkcs12Path( 42 | const string& path, string* result_key); 43 | 44 | static void AppendAsBase64(const char* data, size_t size, string* to); 45 | static void AppendAsBase64(const string& from, string* to); 46 | 47 | static EVP_PKEY* LoadPkeyFromData(const StringPiece data); 48 | static EVP_PKEY* LoadPkeyFromP12Path(const char* pkcs12_key_path); 49 | 50 | static googleapis::util::Status MakeJwtUsingEvp( 51 | const string& claims, EVP_PKEY* pkey, string* jwt); 52 | }; 53 | 54 | } // namespace client 55 | 56 | } // namespace googleapis 57 | #endif // GOOGLEAPIS_AUTH_JWT_BUILDER_H_ 58 | -------------------------------------------------------------------------------- /src/googleapis/client/data/file_data_writer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | // 20 | 21 | #include 22 | #include 23 | #include 24 | using std::string; 25 | 26 | #include "googleapis/client/data/data_reader.h" 27 | #include "googleapis/client/data/data_writer.h" 28 | #include "googleapis/client/data/file_data_writer.h" 29 | #include "googleapis/client/util/status.h" 30 | #include "googleapis/base/callback.h" 31 | #include 32 | #include "googleapis/util/file.h" 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace googleapis { 36 | 37 | namespace client { 38 | 39 | FileDataWriter::FileDataWriter( 40 | const string& path, const FileOpenOptions& options) 41 | : path_(path), options_(options), file_(NULL) { 42 | } 43 | 44 | // When clearing the writer, erase the underlying file. 45 | util::Status FileDataWriter::DoClear() { 46 | if (File::Exists(path_)) { 47 | if (!File::Delete(path_)) { 48 | return StatusUnknown("Could not delete file"); 49 | } 50 | } 51 | return StatusOk(); 52 | } 53 | 54 | util::Status FileDataWriter::DoBegin() { 55 | if (file_) file_->Close(file::Defaults()).IgnoreError(); 56 | file_ = File::OpenWithOptions(path_, "w", options_); 57 | if (!file_) { 58 | googleapis::util::Status status = 59 | StatusInvalidArgument(StrCat("Could not open ", path_)); 60 | LOG(WARNING) << status.error_message(); 61 | return status; 62 | } 63 | return StatusOk(); 64 | } 65 | 66 | util::Status FileDataWriter::DoEnd() { 67 | if (file_) { 68 | bool ok = file_->Close(file::Defaults()).ok(); 69 | file_ = NULL; 70 | if (!ok) { 71 | return StatusUnknown("Error closing file"); 72 | } 73 | } 74 | return StatusOk(); 75 | } 76 | 77 | FileDataWriter::~FileDataWriter() { 78 | if (file_) { 79 | file_->Flush(); 80 | file_->Close(file::Defaults()).IgnoreError(); 81 | } 82 | } 83 | 84 | util::Status FileDataWriter::DoWrite(int64 bytes, const char* buffer) { 85 | return file_->Write(buffer, bytes); 86 | } 87 | 88 | DataReader* FileDataWriter::DoNewDataReader(Closure* deleter) { 89 | if (file_) file_->Flush(); 90 | return NewManagedFileDataReader(path_, deleter); 91 | } 92 | 93 | 94 | DataWriter* NewFileDataWriter(const string& path) { 95 | FileOpenOptions options; 96 | options.set_permissions(S_IRUSR | S_IWUSR); 97 | return new FileDataWriter(path, options); 98 | } 99 | 100 | DataWriter* NewFileDataWriter( 101 | const string& path, const FileOpenOptions& options) { 102 | return new FileDataWriter(path, options); 103 | } 104 | 105 | } // namespace client 106 | 107 | } // namespace googleapis 108 | -------------------------------------------------------------------------------- /src/googleapis/client/data/file_data_writer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #ifndef GOOGLEAPIS_DATA_FILE_DATA_WRITER_H_ 20 | #define GOOGLEAPIS_DATA_FILE_DATA_WRITER_H_ 21 | 22 | // 23 | 24 | #include 25 | using std::string; 26 | 27 | #include "googleapis/client/data/data_reader.h" 28 | #include "googleapis/client/data/data_writer.h" 29 | #include "googleapis/client/util/status.h" 30 | #include "googleapis/util/file.h" 31 | namespace googleapis { 32 | 33 | class FileOpenOptions; 34 | 35 | namespace client { 36 | 37 | class FileDataWriter : public DataWriter { 38 | public: 39 | FileDataWriter(const string& path, const FileOpenOptions& options); 40 | ~FileDataWriter() override; 41 | 42 | googleapis::util::Status DoClear() override; 43 | 44 | googleapis::util::Status DoBegin() override; 45 | 46 | googleapis::util::Status DoEnd() override; 47 | 48 | googleapis::util::Status DoWrite(int64 bytes, const char* buffer) override; 49 | 50 | DataReader* DoNewDataReader(Closure* deleter) override; 51 | 52 | private: 53 | string path_; 54 | FileOpenOptions options_; 55 | File* file_; 56 | }; 57 | 58 | /* 59 | * Creates a data writer that rewrites the file at the given path. 60 | * @ingroup DataLayerRaw 61 | * 62 | * @param[in] path The caller will own the file at the given path. 63 | */ 64 | DataWriter* NewFileDataWriter(const string& path); 65 | 66 | /* 67 | * Creates a data writer that rewrites the file at the given path with control 68 | * over how the file is created. 69 | * @ingroup DataLayerRaw 70 | * 71 | * @param[in] path The caller will own the file at the given path. 72 | * @param[in] options The options can be used to override the permissions 73 | * to given the created file. 74 | */ 75 | DataWriter* NewFileDataWriter(const string& path, 76 | const FileOpenOptions& options); 77 | 78 | } // namespace client 79 | 80 | } // namespace googleapis 81 | #endif // GOOGLEAPIS_DATA_FILE_DATA_WRITER_H_ 82 | -------------------------------------------------------------------------------- /src/googleapis/client/data/inmemory_data_reader.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | 23 | #include "googleapis/client/data/data_reader.h" 24 | #include "googleapis/client/util/status.h" 25 | #include "googleapis/base/integral_types.h" 26 | #include "googleapis/strings/stringpiece.h" 27 | #include "googleapis/strings/strcat.h" 28 | 29 | namespace googleapis { 30 | 31 | namespace client { 32 | 33 | class InMemoryDataReader : public DataReader { 34 | public: 35 | InMemoryDataReader(const StringPiece& data, Closure* deleter) 36 | : DataReader(deleter), data_(data) { 37 | set_total_length(data_.size()); 38 | } 39 | 40 | virtual ~InMemoryDataReader() { 41 | } 42 | 43 | virtual bool seekable() const { return true; } 44 | 45 | protected: 46 | virtual int64 DoSetOffset(int64 position) { 47 | if (position > data_.size()) return data_.size(); 48 | 49 | // The base class keeps track of offset and will update on return. 50 | return position; 51 | } 52 | 53 | virtual int64 DoReadToBuffer(int64 max_bytes, char* storage) { 54 | int64 remaining = data_.size() - offset(); 55 | if (remaining == 0) { 56 | set_done(true); 57 | return 0; 58 | } 59 | int64 read = std::min(max_bytes, remaining); 60 | if (read > 0) { 61 | memcpy(storage, data_.data() + offset(), read); 62 | if (read == remaining) { 63 | // We'll be aggressive here though it's still legal if we dont 64 | // yet know we're done. 65 | set_done(true); 66 | } 67 | } 68 | return read; 69 | } 70 | 71 | virtual bool DoAppendUntilPatternInclusive( 72 | const string& pattern, string* consumed) { 73 | int64 start = offset(); 74 | int64 found = data_.find(pattern, start); 75 | int64 end = found == string::npos ? data_.size() : found + pattern.size(); 76 | StrAppend(consumed, data_.substr(start, end - start)); 77 | return found != StringPiece::npos; 78 | } 79 | 80 | private: 81 | StringPiece data_; 82 | }; 83 | 84 | DataReader* NewUnmanagedInMemoryDataReader(const StringPiece& data) { 85 | return new InMemoryDataReader(data, NULL); 86 | } 87 | 88 | DataReader* NewManagedInMemoryDataReader( 89 | const StringPiece& data, Closure* deleter) { 90 | return new InMemoryDataReader(data, deleter); 91 | } 92 | 93 | DataReader* NewManagedInMemoryDataReader(string* str) { 94 | return NewManagedInMemoryDataReader( 95 | StringPiece(*str), DeletePointerClosure(str)); 96 | } 97 | 98 | } // namespace client 99 | 100 | } // namespace googleapis 101 | -------------------------------------------------------------------------------- /src/googleapis/client/data/jsoncpp_data.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | using std::string; 23 | #include "googleapis/client/data/data_reader.h" 24 | #include "googleapis/client/data/jsoncpp_data.h" 25 | #include "googleapis/client/util/status.h" 26 | #include 27 | #include 28 | #include 29 | 30 | namespace googleapis { 31 | 32 | namespace client { 33 | 34 | JsonCppData::JsonCppData(const Json::Value& value) 35 | : is_mutable_(false), value_(const_cast(&value)) { 36 | } 37 | JsonCppData::JsonCppData(Json::Value* value) 38 | : is_mutable_(true), value_(value) { 39 | } 40 | JsonCppData::~JsonCppData() { 41 | } 42 | 43 | void JsonCppData::CheckIsMutable() const { 44 | CHECK(is_mutable_); 45 | } 46 | 47 | DataReader* JsonCppData::MakeJsonReader() const { 48 | Json::FastWriter writer; 49 | const string& json = writer.write(Storage()); 50 | return NewManagedInMemoryDataReader(json); // copy the data 51 | } 52 | 53 | util::Status JsonCppData::LoadFromJsonReader(DataReader* data_reader) { 54 | string storage = data_reader->RemainderToString(); 55 | if (!data_reader->ok()) { 56 | return data_reader->status(); 57 | } 58 | 59 | const char* data = storage.data(); 60 | int64 size = storage.size(); 61 | Json::Reader json_reader; 62 | bool result = json_reader.parse(data, data + size, *MutableStorage(), false); 63 | if (!result) { 64 | return StatusInvalidArgument(json_reader.getFormatedErrorMessages()); 65 | } 66 | return StatusOk(); 67 | } 68 | 69 | util::Status JsonCppData::LoadFromJsonStream(std::istream* stream) { 70 | Json::Reader reader; 71 | bool result = reader.parse(*stream, *MutableStorage()); 72 | if (!result) { 73 | return StatusInvalidArgument(reader.getFormatedErrorMessages()); 74 | } 75 | return StatusOk(); 76 | } 77 | 78 | util::Status JsonCppData::StoreToJsonStream(std::ostream* stream) const { 79 | Json::StyledStreamWriter writer; 80 | writer.write(*stream, Storage()); 81 | if (stream->fail()) { 82 | return StatusUnknown("Error storing JSON"); 83 | } 84 | return StatusOk(); 85 | } 86 | 87 | void JsonCppData::Clear() { 88 | MutableStorage()->clear(); 89 | } 90 | 91 | JsonCppDictionary::JsonCppDictionary(const Json::Value& value) 92 | : JsonCppData(value) { 93 | } 94 | 95 | JsonCppDictionary::JsonCppDictionary(Json::Value* value) 96 | : JsonCppData(value) { 97 | } 98 | 99 | } // namespace client 100 | 101 | } // namespace googleapis 102 | -------------------------------------------------------------------------------- /src/googleapis/client/data/serializable_json.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include // NOLINT 22 | #include // NOLINT 23 | #include 24 | #include 25 | using std::string; 26 | 27 | #include "googleapis/client/data/data_reader.h" 28 | #include "googleapis/client/data/serializable_json.h" 29 | #include "googleapis/client/util/status.h" 30 | #include "googleapis/strings/strcat.h" 31 | 32 | namespace googleapis { 33 | 34 | namespace client { 35 | 36 | SerializableJson::~SerializableJson() { 37 | } 38 | 39 | util::Status SerializableJson::LoadFromJsonStream(std::istream* stream) { 40 | std::unique_ptr reader(NewUnmanagedIstreamDataReader(stream)); 41 | if (!reader->ok()) { 42 | return reader->status(); 43 | } 44 | return LoadFromJsonReader(reader.get()); 45 | } 46 | 47 | util::Status SerializableJson::StoreToJsonStream( 48 | std::ostream* stream) const { 49 | std::unique_ptr reader(MakeJsonReader()); 50 | if (!reader->ok()) return reader->status(); 51 | 52 | string data = reader->RemainderToString(); 53 | if (!reader->ok()) return reader->status(); 54 | 55 | *stream << data; 56 | if (stream->fail()) { 57 | return StatusUnknown(StrCat("Error writing ", data.size(), "bytes")); 58 | } 59 | return StatusOk(); 60 | } 61 | 62 | } // namespace client 63 | 64 | } // namespace googleapis 65 | -------------------------------------------------------------------------------- /src/googleapis/client/service/service_request_pager.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include "googleapis/client/service/service_request_pager.h" 22 | 23 | namespace googleapis { 24 | 25 | namespace client { 26 | 27 | BaseServiceRequestPager::BaseServiceRequestPager( 28 | ClientServiceRequest* request) 29 | : request_(request), done_(false) { 30 | } 31 | 32 | BaseServiceRequestPager::~BaseServiceRequestPager() { 33 | } 34 | 35 | bool BaseServiceRequestPager::NextPage() { 36 | if (done_) return false; 37 | 38 | if (!ExecuteNextPage().ok()) { 39 | done_ = true; 40 | return false; 41 | } 42 | return true; 43 | } 44 | 45 | void BaseServiceRequestPager::Reset() { 46 | done_ = false; 47 | next_page_token_.clear(); 48 | } 49 | 50 | } // namespace client 51 | 52 | } // namespace googleapis 53 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This is a CMake file for Wax API v1 2 | # using the Google APIs Client Library for C++. 3 | # 4 | # See http://google.github.io/google-api-cpp-client/latest/start/get_started 5 | # for more information about what to do with this file. 6 | 7 | project (google_wax_api) 8 | 9 | # These sources assume that the CMakeLists.txt in ../.. added itself to 10 | # the include directories so that include paths are specified explicitly 11 | # with the directory #include "google/wax_api/..." 12 | add_library(google_wax_api STATIC 13 | subscription.cc 14 | wax_create_session_request.cc 15 | wax_data_item.cc 16 | wax_list_response.cc 17 | wax_new_session_params.cc 18 | wax_new_session_request.cc 19 | wax_new_session_response.cc 20 | wax_remove_session_request.cc 21 | wax_remove_session_response.cc 22 | wax_service.cc) 23 | target_link_libraries(google_wax_api googleapis_http) 24 | target_link_libraries(google_wax_api googleapis_internal) 25 | target_link_libraries(google_wax_api googleapis_jsoncpp) 26 | target_link_libraries(google_wax_api googleapis_utils) 27 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/subscription.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // Subscription 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/subscription.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_wax_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | Subscription* Subscription::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | Subscription::Subscription(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | Subscription::Subscription(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | Subscription::~Subscription() { 57 | } 58 | } // namespace google_wax_api 59 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_api.h: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | // This code was generated by google-apis-code-generator 1.5.1 13 | 14 | #ifndef GOOGLE_WAX_API_WAX_API_H_ 15 | #define GOOGLE_WAX_API_WAX_API_H_ 16 | 17 | #include "google/wax_api/subscription.h" 18 | #include "google/wax_api/wax_create_session_request.h" 19 | #include "google/wax_api/wax_data_item.h" 20 | #include "google/wax_api/wax_list_response.h" 21 | #include "google/wax_api/wax_new_session_params.h" 22 | #include "google/wax_api/wax_new_session_request.h" 23 | #include "google/wax_api/wax_new_session_response.h" 24 | #include "google/wax_api/wax_remove_session_request.h" 25 | #include "google/wax_api/wax_remove_session_response.h" 26 | 27 | #include "google/wax_api/wax_service.h" 28 | 29 | 30 | #endif // GOOGLE_WAX_API_WAX_API_H_ 31 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_create_session_request.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxCreateSessionRequest 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_create_session_request.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_wax_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | WaxCreateSessionRequest* WaxCreateSessionRequest::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | WaxCreateSessionRequest::WaxCreateSessionRequest(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | WaxCreateSessionRequest::WaxCreateSessionRequest(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | WaxCreateSessionRequest::~WaxCreateSessionRequest() { 57 | } 58 | } // namespace google_wax_api 59 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_data_item.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxDataItem 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_data_item.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_wax_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | WaxDataItem* WaxDataItem::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | WaxDataItem::WaxDataItem(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | WaxDataItem::WaxDataItem(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | WaxDataItem::~WaxDataItem() { 57 | } 58 | } // namespace google_wax_api 59 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_list_response.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxListResponse 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_list_response.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/wax_api/wax_data_item.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_wax_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | WaxListResponse* WaxListResponse::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | WaxListResponse::WaxListResponse(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | WaxListResponse::WaxListResponse(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | WaxListResponse::~WaxListResponse() { 58 | } 59 | } // namespace google_wax_api 60 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_new_session_params.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxNewSessionParams 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_new_session_params.h" 27 | #include 28 | #include "googleapis/base/integral_types.h" 29 | #include "googleapis/client/data/jsoncpp_data.h" 30 | #include "googleapis/strings/stringpiece.h" 31 | 32 | 33 | #include 34 | #include "googleapis/strings/strcat.h" 35 | 36 | namespace google_wax_api { 37 | using namespace googleapis; 38 | 39 | 40 | // Object factory method (static). 41 | WaxNewSessionParams* WaxNewSessionParams::New() { 42 | return new client::JsonCppCapsule; 43 | } 44 | 45 | // Standard immutable constructor. 46 | WaxNewSessionParams::WaxNewSessionParams(const Json::Value& storage) 47 | : client::JsonCppData(storage) { 48 | } 49 | 50 | // Standard mutable constructor. 51 | WaxNewSessionParams::WaxNewSessionParams(Json::Value* storage) 52 | : client::JsonCppData(storage) { 53 | } 54 | 55 | // Standard destructor. 56 | WaxNewSessionParams::~WaxNewSessionParams() { 57 | } 58 | } // namespace google_wax_api 59 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_new_session_request.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxNewSessionRequest 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_new_session_request.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | #include "google/wax_api/wax_new_session_params.h" 32 | 33 | 34 | #include 35 | #include "googleapis/strings/strcat.h" 36 | 37 | namespace google_wax_api { 38 | using namespace googleapis; 39 | 40 | 41 | // Object factory method (static). 42 | WaxNewSessionRequest* WaxNewSessionRequest::New() { 43 | return new client::JsonCppCapsule; 44 | } 45 | 46 | // Standard immutable constructor. 47 | WaxNewSessionRequest::WaxNewSessionRequest(const Json::Value& storage) 48 | : client::JsonCppData(storage) { 49 | } 50 | 51 | // Standard mutable constructor. 52 | WaxNewSessionRequest::WaxNewSessionRequest(Json::Value* storage) 53 | : client::JsonCppData(storage) { 54 | } 55 | 56 | // Standard destructor. 57 | WaxNewSessionRequest::~WaxNewSessionRequest() { 58 | } 59 | } // namespace google_wax_api 60 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_new_session_response.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxNewSessionResponse 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_new_session_response.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_wax_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | WaxNewSessionResponse* WaxNewSessionResponse::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | WaxNewSessionResponse::WaxNewSessionResponse(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | WaxNewSessionResponse::WaxNewSessionResponse(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | WaxNewSessionResponse::~WaxNewSessionResponse() { 56 | } 57 | } // namespace google_wax_api 58 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_remove_session_request.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxRemoveSessionRequest 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_remove_session_request.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_wax_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | WaxRemoveSessionRequest* WaxRemoveSessionRequest::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | WaxRemoveSessionRequest::WaxRemoveSessionRequest(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | WaxRemoveSessionRequest::WaxRemoveSessionRequest(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | WaxRemoveSessionRequest::~WaxRemoveSessionRequest() { 56 | } 57 | } // namespace google_wax_api 58 | -------------------------------------------------------------------------------- /src/googleapis/client/test/google/wax_api/wax_remove_session_response.cc: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | // use this file except in compliance with the License. You may obtain a copy of 3 | // the License at 4 | // 5 | // http://www.apache.org/licenses/LICENSE-2.0 6 | // 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | // License for the specific language governing permissions and limitations under 11 | // the License. 12 | 13 | // This code was generated by google-apis-code-generator 1.5.1 14 | 15 | // ---------------------------------------------------------------------------- 16 | // NOTE: This file is generated from Google APIs Discovery Service. 17 | // Service: 18 | // Wax API (wax/v1) 19 | // Description: 20 | // Apiary system integration testing backend API. 21 | // Classes: 22 | // WaxRemoveSessionResponse 23 | // Documentation: 24 | // http://go/apiarytesting/wax-api 25 | 26 | #include "google/wax_api/wax_remove_session_response.h" 27 | #include 28 | #include "googleapis/client/data/jsoncpp_data.h" 29 | #include "googleapis/strings/stringpiece.h" 30 | 31 | 32 | #include 33 | #include "googleapis/strings/strcat.h" 34 | 35 | namespace google_wax_api { 36 | using namespace googleapis; 37 | 38 | 39 | // Object factory method (static). 40 | WaxRemoveSessionResponse* WaxRemoveSessionResponse::New() { 41 | return new client::JsonCppCapsule; 42 | } 43 | 44 | // Standard immutable constructor. 45 | WaxRemoveSessionResponse::WaxRemoveSessionResponse(const Json::Value& storage) 46 | : client::JsonCppData(storage) { 47 | } 48 | 49 | // Standard mutable constructor. 50 | WaxRemoveSessionResponse::WaxRemoveSessionResponse(Json::Value* storage) 51 | : client::JsonCppData(storage) { 52 | } 53 | 54 | // Standard destructor. 55 | WaxRemoveSessionResponse::~WaxRemoveSessionResponse() { 56 | } 57 | } // namespace google_wax_api 58 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/ca_paths.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #include 20 | using std::string; 21 | 22 | #include "googleapis/client/transport/ca_paths.h" 23 | #include "googleapis/client/util/program_path.h" 24 | 25 | namespace googleapis { 26 | 27 | 28 | namespace client { 29 | 30 | std::string DetermineDefaultCaCertsPath() { 31 | const std::string program_path(GetCurrentProgramFilenamePath()); 32 | auto dirname(client::StripBasename(program_path)); 33 | dirname.append("roots.pem"); // dirname has ending slash. 34 | return dirname; 35 | } 36 | 37 | } // namespace client 38 | 39 | } // namespace googleapis 40 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/ca_paths.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #ifndef GOOGLEAPIS_TRANSPORT_CA_PATHS_H_ 20 | #define GOOGLEAPIS_TRANSPORT_CA_PATHS_H_ 21 | 22 | #include 23 | namespace googleapis { 24 | using std::string; 25 | 26 | namespace client { 27 | 28 | /* 29 | * Returns the default location of the SSL certificate validation data. 30 | * 31 | * The default location is assumed to be the same directory as the 32 | * executable for the running process in a file called 'roots.pem'. 33 | */ 34 | std::string DetermineDefaultCaCertsPath(); 35 | 36 | } // namespace client 37 | 38 | } // namespace googleapis 39 | #endif // GOOGLEAPIS_TRANSPORT_CA_PATHS_H_ 40 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/http_authorization.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include "googleapis/client/transport/http_authorization.h" 22 | 23 | namespace googleapis { 24 | 25 | namespace client { 26 | 27 | AuthorizationCredential::~AuthorizationCredential() { 28 | } 29 | 30 | } // namespace client 31 | 32 | } // namespace googleapis 33 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/http_authorization.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #ifndef GOOGLEAPIS_TRANSPORT_HTTP_AUTHORIZATION_H_ 22 | #define GOOGLEAPIS_TRANSPORT_HTTP_AUTHORIZATION_H_ 23 | 24 | #include 25 | using std::string; 26 | 27 | #include "googleapis/client/util/status.h" 28 | #include "googleapis/base/callback.h" 29 | #include "googleapis/base/macros.h" 30 | namespace googleapis { 31 | 32 | namespace client { 33 | 34 | class DataReader; 35 | class HttpRequest; 36 | 37 | /* 38 | * The abstraction used to pass credentials also contains knowledge about how 39 | * to use the credentials to authorize requests. 40 | * @ingroup TransportLayerCore 41 | * 42 | * In practice this is probably an OAuth2Credential, but this class provides 43 | * an abstract interface sufficient to keep OAuth 2.0 dependencies out of the 44 | * HTTP transport layer and core libraries that dont care about the mechanism 45 | * details. 46 | */ 47 | class AuthorizationCredential { 48 | public: 49 | /* 50 | * Standard destructor. 51 | */ 52 | virtual ~AuthorizationCredential(); 53 | 54 | /* 55 | * Returns the type of credential for tracing/debug purposes. 56 | */ 57 | virtual const string type() const = 0; 58 | 59 | /* 60 | * Refreshes credential. 61 | * 62 | * @return ok or reason for failure. 63 | */ 64 | virtual googleapis::util::Status Refresh() = 0; 65 | 66 | /* 67 | * Refreshes credential asynchronously. 68 | * 69 | * @param[in] callback Called on refresh termination status. 70 | */ 71 | virtual void RefreshAsync(Callback1* callback) = 0; 72 | 73 | /* 74 | * Initialize the credential from a stream. 75 | * 76 | * @param[in] serialized_credential A serialized credential stream to 77 | * load from. 78 | * 79 | * @see MakeDataReader 80 | */ 81 | virtual googleapis::util::Status Load(DataReader* serialized_credential) = 0; 82 | 83 | /* 84 | * Creates a DataReader stream serializing the credential. 85 | * 86 | * @return serialized stream suitable for Load. 87 | */ 88 | virtual DataReader* MakeDataReader() const = 0; 89 | 90 | /* 91 | * Uses the credential to authorize a request. 92 | * 93 | * @param[in,out] request The request to authorized will be modified as 94 | * needed depending on the specific class (e.g. adding an 95 | * authoriation header). 96 | * @return failure if the request cannot be authorized. A success does 97 | * not guarantee that the server will accept the authorization 98 | * but a failure guarantees that it will not. 99 | */ 100 | virtual googleapis::util::Status AuthorizeRequest(HttpRequest* request) = 0; 101 | }; 102 | 103 | } // namespace client 104 | 105 | } // namespace googleapis 106 | #endif // GOOGLEAPIS_TRANSPORT_HTTP_AUTHORIZATION_H_ 107 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/http_response.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | using std::string; 23 | #include "googleapis/client/data/data_reader.h" 24 | #include "googleapis/client/data/data_writer.h" 25 | #include "googleapis/client/transport/http_response.h" 26 | #include "googleapis/client/transport/http_transport.h" 27 | #include "googleapis/client/util/status.h" 28 | #include 29 | #include "googleapis/strings/strcat.h" 30 | 31 | namespace googleapis { 32 | 33 | namespace client { 34 | 35 | HttpResponse::HttpResponse() 36 | : request_state_(new HttpRequestState), 37 | body_writer_(NewStringDataWriter()) { 38 | } 39 | 40 | HttpResponse::~HttpResponse() { 41 | // TODO(user): 20130525 42 | // Need to clean this up. 43 | // 44 | // There might be a subtle race condition here in that the state allows us to 45 | // wait on a request to complete. If the request owning this response 46 | // is destroyed while the state is waiting then we'll destroy the mutex 47 | // out from underneath the wait. 48 | // 49 | // So destach the state and have it destroy itself when that wait completes. 50 | request_state_.release()->DestroyWhenDone(); 51 | } 52 | 53 | void HttpResponse::set_body_reader(DataReader* reader) { 54 | body_reader_.reset(reader); 55 | } 56 | 57 | void HttpResponse::set_body_writer(DataWriter* writer) { 58 | body_writer_.reset(writer); 59 | } 60 | 61 | util::Status HttpResponse::GetBodyString(string* body) { 62 | body->clear(); 63 | if (!body_reader_.get()) { 64 | return StatusOk(); 65 | } 66 | 67 | if (body_reader_->offset() != 0 && !body_reader_->Reset()) { 68 | LOG(WARNING) << "Could not reset HTTP response reader"; 69 | return body_reader_->status(); 70 | } 71 | 72 | *body = body_reader_->RemainderToString(); 73 | googleapis::util::Status status = body_reader_->status(); 74 | 75 | // Attempt to reset the reader, but dont worry about errors. 76 | // The reset is just to be friendly to subsequent reads. 77 | body_reader_->Reset(); 78 | 79 | return status; 80 | } 81 | 82 | void HttpResponse::Clear() { 83 | body_reader_.reset(NULL); 84 | body_writer_->Clear(); 85 | headers_.clear(); 86 | } 87 | 88 | const string* HttpResponse::FindHeaderValue(const string& name) const { 89 | HttpHeaderMultiMap::const_iterator found = headers_.find(name); 90 | return (found == headers_.end()) ? NULL : &found->second; 91 | } 92 | 93 | } // namespace client 94 | 95 | } // namespace googleapis 96 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/http_transport_global_state.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | // This file implements the global state extension of the HttpTransport layer. 22 | // This state is not part of the core API or used in the implementation of the 23 | // core API. It is made available to facilitate the use of the API, 24 | // particularly for simple applications when getting started. 25 | // 26 | // The global state reduces the amount of setup code required, and amount 27 | // of code needed to remember or propagate configuration information. 28 | 29 | #include // NOLINT 30 | 31 | #include "googleapis/client/transport/http_transport.h" 32 | #include "googleapis/client/transport/http_transport_global_state.h" 33 | 34 | namespace googleapis { 35 | 36 | namespace { 37 | using client::HttpTransportLayerConfig; 38 | 39 | static HttpTransportLayerConfig* configuration_ = NULL; 40 | 41 | static void InitModule() { 42 | configuration_ = new HttpTransportLayerConfig; 43 | } 44 | 45 | std::once_flag g_once_flag; 46 | 47 | } // anonymous namespace 48 | 49 | namespace client { 50 | 51 | HttpTransportLayerConfig* GetGlobalHttpTransportLayerConfiguration() { 52 | std::call_once(g_once_flag, &InitModule); 53 | return configuration_; 54 | } 55 | 56 | } // namespace client 57 | 58 | } // namespace googleapis 59 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/http_transport_global_state.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #ifndef GOOGLEAPIS_TRANSPORT_HTTP_TRANSPORT_GLOBAL_STATE_H_ 22 | #define GOOGLEAPIS_TRANSPORT_HTTP_TRANSPORT_GLOBAL_STATE_H_ 23 | namespace googleapis { 24 | 25 | namespace client { 26 | 27 | class HttpTransportLayerConfig; 28 | 29 | /* 30 | * Returns global instance for the global configuration. 31 | * 32 | * The global configuration is not used internally so changing this has 33 | * no effect on the core runtime library. It is available to be used by 34 | * applications and libraries that wish to link with this module and use 35 | * it to share information. A more general solution that does not require 36 | * global state is to create your own HttpTransportLayerConfig. 37 | * 38 | * @return The library retains ownership of this instance however the 39 | * caller can modify its attributes to configuration the runtime. 40 | */ 41 | HttpTransportLayerConfig* GetGlobalHttpTransportLayerConfiguration(); 42 | 43 | } // namespace client 44 | 45 | } // namespace googleapis 46 | #endif // GOOGLEAPIS_TRANSPORT_HTTP_TRANSPORT_GLOBAL_STATE_H_ 47 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/test/curl_http_transport_test.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include "googleapis/client/transport/curl_http_transport.h" 22 | #include "googleapis/client/transport/http_transport.h" 23 | #include "googleapis/client/transport/test/http_transport_test_fixture.h" 24 | 25 | #include 26 | #include 27 | 28 | namespace googleapis { 29 | 30 | 31 | // This runs the standard test suite defined by HttpTransportTestFixture 32 | // but using the CurlHttpTransportFactory. 33 | } // namespace googleapis 34 | 35 | using namespace googleapis; 36 | int main(int argc, char** argv) { 37 | google::ParseCommandLineFlags(&argc, &argv, false); // init gflags 38 | ::testing::InitGoogleTest(&argc, argv); // init gtest 39 | client::HttpTransportLayerConfig config; 40 | client::HttpTransportFactory* factory = 41 | new client::CurlHttpTransportFactory(&config); 42 | 43 | CHECK_EQ(client::CurlHttpTransport::kTransportIdentifier, 44 | factory->default_id()); 45 | std::unique_ptr check_instance( 46 | factory->New()); 47 | CHECK_EQ(client::CurlHttpTransport::kTransportIdentifier, 48 | check_instance->id()); 49 | 50 | config.ResetDefaultTransportFactory(factory); 51 | HttpTransportTestFixture::SetTestConfiguration(&config); 52 | 53 | return RUN_ALL_TESTS(); 54 | } 55 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/test/http_transport_test_fixture.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | // 21 | // TODO(user): 20130117 22 | // Make this test independent of the wax json service. 23 | // Instead add some other simple PUBLIC service or mock 24 | // that can be open sourced. 25 | 26 | #ifndef GOOGLEAPIS_HTTP_TRANSPORT_TEST_FIXTURE_H_ 27 | #define GOOGLEAPIS_HTTP_TRANSPORT_TEST_FIXTURE_H_ 28 | 29 | #include "googleapis/client/transport/http_transport.h" 30 | #include 31 | 32 | namespace google_wax_api { 33 | class WaxService; 34 | } // namespace google_wax_api 35 | namespace googleapis { 36 | 37 | namespace client { 38 | class HttpTransportFactory; 39 | } // namespace client 40 | 41 | /* 42 | * Test fixture for verifying basic HttpTransport implementations. 43 | * @ingroup TransportLayerTesting 44 | * 45 | * This class is compiled into a library that runs tests against the 46 | * core HttpTransport interface. To test a specific implementation 47 | * you should set up a HttpTransportLayerConfiguration that uses that 48 | * implementation then HttpTransportTestFixture::SetTestConfiguration 49 | * to inject the configuration before running the tests. 50 | */ 51 | class HttpTransportTestFixture : public testing::Test { 52 | public: 53 | static google_wax_api::WaxService& GetGlobalWaxService(); 54 | static const string& GetGlobalSessionId(); 55 | static void ResetGlobalSessionId(); 56 | static void SetUpTestCase(); 57 | static void TearDownTestCase(); 58 | 59 | static void SetTestConfiguration( 60 | const client::HttpTransportLayerConfig* config); 61 | 62 | HttpTransportTestFixture(); 63 | virtual ~HttpTransportTestFixture(); 64 | 65 | private: 66 | DISALLOW_COPY_AND_ASSIGN(HttpTransportTestFixture); 67 | }; 68 | 69 | } // namespace googleapis 70 | #endif // GOOGLEAPIS_HTTP_TRANSPORT_TEST_FIXTURE_H_ 71 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/test/json_playback_transport_test.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include "googleapis/client/data/data_reader.h" 22 | #include "googleapis/client/transport/json_playback_transport.h" 23 | #include "googleapis/client/transport/http_scribe.h" 24 | #include "googleapis/client/transport/http_transport.h" 25 | #include "googleapis/client/transport/test/http_transport_test_fixture.h" 26 | #include "googleapis/client/util/uri_utils.h" 27 | #include 28 | #include "googleapis/strings/strcat.h" 29 | #include 30 | 31 | DECLARE_bool(fork_wax); 32 | 33 | namespace googleapis { 34 | 35 | using client::DataReader; 36 | using client::HttpTransport; 37 | using client::JoinPath; 38 | using client::JsonPlaybackTransportFactory; 39 | 40 | // This runs the standard test suite defined by HttpTransportTestFixture 41 | // but using the HttpOverRpcTransport factory. 42 | } // namespace googleapis 43 | 44 | using namespace googleapis; 45 | int main(int argc, char** argv) { 46 | FLAGS_logtostderr = true; 47 | FLAGS_fork_wax = false; 48 | testing::InitGoogleTest(&argc, argv); 49 | 50 | client::HttpTransportLayerConfig config; 51 | JsonPlaybackTransportFactory* factory = new JsonPlaybackTransportFactory( 52 | &config); 53 | factory->ResetCensor(new client::HttpScribeCensor); 54 | const string data_dir = "src/googleapis/client/transport/test"; 55 | { 56 | // To create this file, run another concrete transport test using this 57 | // fixture and the flag --http_scribe_path=json_transport_playback.json 58 | // then put that output file into the data_dir. 59 | // 60 | // For example: 61 | // curl_http_transport_test --http_scribe_path=json_transport_playback.json 62 | 63 | string path = JoinPath(data_dir, "json_transport_playback.json"); 64 | 65 | std::unique_ptr reader( 66 | client::NewUnmanagedFileDataReader(path)); 67 | EXPECT_TRUE(factory->LoadTranscript(reader.get()).ok()); 68 | } 69 | 70 | CHECK_EQ(client::JsonPlaybackTransport::kTransportIdentifier, 71 | factory->default_id()); 72 | std::unique_ptr check_instance( 73 | factory->New()); 74 | CHECK_EQ(client::JsonPlaybackTransport::kTransportIdentifier, 75 | check_instance->id()); 76 | 77 | config.ResetDefaultTransportFactory(factory); 78 | HttpTransportTestFixture::SetTestConfiguration(&config); 79 | 80 | return RUN_ALL_TESTS(); 81 | } 82 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/versioninfo.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | using std::string; 23 | 24 | #if !defined(WIN32) && !defined(_WIN32) 25 | # include 26 | #endif 27 | #include "googleapis/config.h" 28 | #include "googleapis/client/transport/versioninfo.h" 29 | #include "googleapis/base/port.h" 30 | #include "googleapis/strings/strcat.h" 31 | 32 | namespace googleapis { 33 | 34 | namespace client { 35 | using std::string; 36 | 37 | const int VersionInfo::kMajorVersionNumber = googleapis_VERSION_MAJOR; 38 | const int VersionInfo::kMinorVersionNumber = googleapis_VERSION_MINOR; 39 | const int VersionInfo::kPatchVersionNumber = googleapis_VERSION_PATCH; 40 | const char VersionInfo::kVersionDecorator[] = googleapis_VERSION_DECORATOR; 41 | 42 | const string VersionInfo::GetVersionString() { 43 | // If patch version is 0 then just ommit it. 44 | // So 1.0.0 is just 1.0 45 | string patch_version = 46 | kPatchVersionNumber == 0 ? "" : StrCat(".", kPatchVersionNumber); 47 | const char* decorator_sep = (kVersionDecorator[0] ? "-" : ""); 48 | return StrCat(kMajorVersionNumber, ".", kMinorVersionNumber, 49 | patch_version, decorator_sep, kVersionDecorator); 50 | } 51 | 52 | const string VersionInfo::GetPlatformString() { 53 | #if !defined(WIN32) && !defined(_WIN32) 54 | struct utsname uts; 55 | if (uname(&uts)) return "Unix"; 56 | return StrCat(uts.sysname, "/", uts.release); 57 | #else 58 | OSVERSIONINFOEX info; 59 | info.dwOSVersionInfoSize = sizeof(info); 60 | if (!GetVersionEx((LPOSVERSIONINFO)&info)) return "Windows"; 61 | const char* type = 62 | info.wProductType == VER_NT_WORKSTATION 63 | ? "W" 64 | : info.wProductType == VER_NT_SERVER 65 | ? "S" 66 | : info.wProductType == VER_NT_DOMAIN_CONTROLLER 67 | ? "C" 68 | : "U"; 69 | return StrCat("Windows/", info.dwMajorVersion, ".", 70 | info.dwMinorVersion, type); 71 | #endif 72 | } 73 | 74 | } // namespace client 75 | 76 | } // namespace googleapis 77 | -------------------------------------------------------------------------------- /src/googleapis/client/transport/versioninfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #ifndef GOOGLEAPIS_TRANSPORT_VERSIONINFO_H_ 22 | #define GOOGLEAPIS_TRANSPORT_VERSIONINFO_H_ 23 | 24 | #include 25 | namespace googleapis { 26 | using std::string; 27 | 28 | namespace client { 29 | 30 | class VersionInfo { 31 | public: 32 | /* 33 | * The major version number is used for compatability purposes. 34 | */ 35 | static const int kMajorVersionNumber; 36 | 37 | /* 38 | * The minor version number is used for incremental fixes and enhancements. 39 | */ 40 | static const int kMinorVersionNumber; 41 | 42 | /* 43 | * The patch version number is used to patch releases. 44 | */ 45 | static const int kPatchVersionNumber; 46 | 47 | /* 48 | * The version decorator is used to mark unofficial versions. The intent 49 | * is that this will be empty for official releases but something else 50 | * for builds from the head, etc. 51 | */ 52 | static const char kVersionDecorator[]; 53 | 54 | /* 55 | * Returns a string with the complete version string. 56 | * 57 | * @return string in the form major.minor-decorator 58 | */ 59 | static const std::string GetVersionString(); 60 | 61 | /* 62 | * Returns platform that we are running on 63 | */ 64 | static const std::string GetPlatformString(); 65 | }; 66 | 67 | } // namespace client 68 | 69 | } // namespace googleapis 70 | #endif // GOOGLEAPIS_TRANSPORT_VERSIONINFO_H_ 71 | -------------------------------------------------------------------------------- /src/googleapis/client/util/escaping.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #ifndef GOOGLEAPIS_UTIL_ESCAPING_H_ 20 | #define GOOGLEAPIS_UTIL_ESCAPING_H_ 21 | 22 | #include 23 | namespace googleapis { 24 | using std::string; 25 | 26 | 27 | namespace googleapis_util { 28 | 29 | 30 | int WebSafeBase64Escape(const unsigned char *src, int szsrc, char *dest, 31 | int szdest, bool do_padding); 32 | void WebSafeBase64Escape(const unsigned char *src, int szsrc, 33 | string *dest, bool do_padding); 34 | 35 | int Base64Escape(const unsigned char *src, int szsrc, char *dest, int szdest); 36 | void Base64Escape(const unsigned char *src, int szsrc, 37 | string* dest, bool do_padding); 38 | void Base64Escape(const string& src, string* dest); 39 | 40 | int CalculateBase64EscapedLen(int input_len, bool do_padding = true); 41 | 42 | bool Base64Unescape(const char *src, int szsrc, string* dest); 43 | 44 | bool WebSafeBase64Unescape(const char *src, int szsrc, string* dest); 45 | 46 | } // namespace googleapis_util 47 | 48 | } // namespace googleapis 49 | #endif // GOOGLEAPIS_UTIL_ESCAPING_H_ 50 | -------------------------------------------------------------------------------- /src/googleapis/client/util/program_path.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #if defined(_MSC_VER) 25 | #include 26 | #include "googleapis/base/windows_compatability.h" 27 | #else 28 | #include 29 | #endif 30 | #if __APPLE__ 31 | #include "TargetConditionals.h" 32 | #if !TARGET_OS_IPHONE 33 | #define HAVE_LIBPROC 34 | #include 35 | #endif 36 | #endif 37 | 38 | #include 39 | using std::string; 40 | 41 | #include "googleapis/client/util/program_path.h" 42 | 43 | namespace googleapis { 44 | 45 | namespace client { 46 | 47 | #ifdef HAVE_LIBPROC 48 | 49 | std::string GetCurrentProgramFilenamePath() { // OSX version 50 | char buf[PROC_PIDPATHINFO_MAXSIZE]; 51 | int ret = proc_pidpath(getpid(), buf, sizeof(buf)); 52 | if (ret <= 0) { 53 | // TODO(user): Fix the API to return the path and a status. Logging the 54 | // error and returning a bad path is useless. 55 | // LOG(ERROR) << "Could not get pidpath"; 56 | return "./"; 57 | } 58 | return std::string(buf); 59 | } 60 | 61 | #elif defined(_MSC_VER) 62 | 63 | std::string GetCurrentProgramFilenamePath() { // Windows version 64 | char* value = NULL; 65 | if (_get_pgmptr(&value)) return "./"; 66 | 67 | // Convert windows path to unix style path so our public interface 68 | // is consistent, especially when we operate on paths. 69 | return FromWindowsPath(value); 70 | } 71 | 72 | #else 73 | 74 | std::string GetCurrentProgramFilenamePath() { // Linux (default) version 75 | std::string path_to_proc_info("/proc/"); 76 | path_to_proc_info.append(std::to_string(getpid())).append("/exe"); 77 | char buf[PATH_MAX]; 78 | int bytes = readlink(path_to_proc_info.c_str(), buf, sizeof(buf)); 79 | if (bytes <= 0) { 80 | // LOG(ERROR) << "Could not read " << path_to_proc_info; 81 | return "./"; 82 | } 83 | return std::string(buf, bytes); 84 | } 85 | 86 | #endif 87 | 88 | std::string DetermineDefaultApplicationName() { 89 | auto program_path(GetCurrentProgramFilenamePath()); 90 | auto basename(Basename(program_path)); 91 | int dot = basename.rfind('.'); 92 | if (dot != std::string::npos) { 93 | basename = basename.substr(0, dot); 94 | } 95 | return basename; 96 | } 97 | 98 | std::string Basename(const std::string& path) { 99 | int slash = path.rfind("/"); 100 | if (slash == std::string::npos) return path; 101 | return path.substr(slash + 1); 102 | } 103 | 104 | std::string StripBasename(const std::string& path) { 105 | int slash = path.rfind("/"); 106 | if (slash == std::string::npos) return ""; 107 | if (slash == path.size() - 1) { 108 | return path.substr(0, slash); // remove trailing slash 109 | } else { 110 | return path.substr(0, slash + 1); // keep trailing slash 111 | } 112 | } 113 | 114 | } // namespace client 115 | 116 | } // namespace googleapis 117 | -------------------------------------------------------------------------------- /src/googleapis/client/util/program_path.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | // 21 | // Utility methods for finding the path to the executable. 22 | 23 | #ifndef GOOGLEAPIS_UTIL_PROGRAM_PATH_H_ 24 | #define GOOGLEAPIS_UTIL_PROGRAM_PATH_H_ 25 | 26 | #include 27 | namespace googleapis { 28 | using std::string; 29 | 30 | namespace client { 31 | 32 | std::string GetCurrentProgramFilenamePath(); 33 | 34 | /* 35 | * Returns the part of the path after the final "/". If there is no 36 | * "/" in the path, the result is the same as the input. 37 | */ 38 | std::string Basename(const std::string& path); 39 | 40 | /* 41 | * Returns the part of the path up through the final "/". If there is no 42 | * "/" in the path, the result is an empty string. 43 | */ 44 | std::string StripBasename(const std::string& path); 45 | 46 | /* 47 | * Returns the default application name assumed for this process. 48 | * 49 | * The default name will be the filename of the program that is curently 50 | * running (without other path elements). 51 | */ 52 | std::string DetermineDefaultApplicationName(); 53 | 54 | } // namespace client 55 | 56 | } // namespace googleapis 57 | #endif // GOOGLEAPIS_UTIL_PROGRAM_PATH_H_ 58 | -------------------------------------------------------------------------------- /src/googleapis/client/util/test/googleapis_gtest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | // 21 | // Convience helpers for GTest. 22 | // These require linking against googleapis_gtest_main instead of gtest_main 23 | 24 | #ifndef GOOGLEAPIS_UTIL_GOOGLEAPIS_GTEST_H_ 25 | #define GOOGLEAPIS_UTIL_GOOGLEAPIS_GTEST_H_ 26 | 27 | #include 28 | namespace googleapis { 29 | 30 | namespace client { 31 | 32 | /* 33 | * Returns the temporary directory created for running the current test. 34 | * 35 | * This function is only avalable when using googleapis_test_main for tests. 36 | */ 37 | string GetTestingTempDir(); 38 | 39 | } // namespace client 40 | 41 | } // namespace googleapis 42 | #endif // GOOGLEAPIS_UTIL_GOOGLEAPIS_GTEST_H_ 43 | -------------------------------------------------------------------------------- /src/googleapis/client/util/test/googleapis_gtest_main.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | using std::cout; 26 | using std::endl; 27 | using std::ostream; 28 | #include 29 | #include 30 | using std::string; 31 | 32 | #ifdef _MSC_VER 33 | #include 34 | #endif 35 | 36 | #include "googleapis/client/util/test/googleapis_gtest.h" 37 | #include "googleapis/client/util/status.h" 38 | #include 39 | #include "googleapis/util/file.h" 40 | 41 | namespace googleapis { 42 | 43 | using std::string; 44 | 45 | namespace { 46 | 47 | #ifdef _MSC_VER 48 | // Windows gives us a file name by creating a file. 49 | // we want a directory so this is no good. 50 | // Fow now we'll just delete the temporary file and use its name. 51 | static string tempnam(const char* ignore_dir, const char* prefix) { 52 | TCHAR dir[MAX_PATH + 1]; 53 | int len = GetTempPath(ARRAYSIZE(dir), dir); 54 | 55 | string windows_prefix; 56 | const TCHAR* name_prefix = ToWindowsString(prefix, &windows_prefix); 57 | TCHAR path[MAX_PATH + 1]; 58 | UINT result = GetTempFileName(dir, name_prefix, 0, path); 59 | DeleteFile(path); // Was created a side effect. 60 | 61 | CHECK_NE(0, result); 62 | string windows_path = googleapis::FromWindowsStr(path); 63 | return googleapis::FromWindowsPath(windows_path); 64 | } 65 | #endif 66 | 67 | std::unique_ptr default_tempdir_; 68 | 69 | void CreateTestingTempDir() { 70 | #if defined(__linux__) 71 | default_tempdir_.reset(new string(mkdtemp("/tmp/gapi.XXXXXX"))); 72 | #else 73 | default_tempdir_.reset(new string(tempnam(NULL, "gapi"))); 74 | #endif 75 | 76 | googleapis::util::Status status = 77 | File::RecursivelyCreateDirWithPermissions(*default_tempdir_, S_IRWXU); 78 | 79 | // If this fails, maybe there was a race condition. 80 | // But more likely we have a permissions problem. 81 | ASSERT_TRUE(status.ok()) << "Could not create " << *default_tempdir_; 82 | LOG(INFO) << "Using test_tmpdir=" << *default_tempdir_; 83 | } 84 | 85 | void DeleteTestingTempDir() { 86 | LOG(INFO) << "Deleting test_tmpdir=" << *default_tempdir_; 87 | File::RecursivelyDeleteDir(*default_tempdir_); 88 | } 89 | 90 | } // annoymous namespace 91 | 92 | namespace client { 93 | 94 | string GetTestingTempDir() { 95 | return *default_tempdir_; 96 | } 97 | 98 | } // namespace client 99 | 100 | 101 | } // namespace googleapis 102 | 103 | using namespace googleapis; 104 | int main(int argc, char** argv) { 105 | testing::InitGoogleTest(&argc, argv); 106 | 107 | #ifdef _MSC_VER 108 | // Change glog fatal failure function to abort so DEATH tests will see 109 | // a failure. Otherwise the default handler used by glog does not result 110 | // in a failure exit in _DEBUG. 111 | google::InstallFailureFunction(abort); 112 | #endif 113 | 114 | CreateTestingTempDir(); 115 | int result = RUN_ALL_TESTS(); 116 | DeleteTestingTempDir(); 117 | 118 | return result; 119 | } 120 | -------------------------------------------------------------------------------- /src/googleapis/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef GOOGLEAPIS_CONFIG_H_ 2 | #define GOOGLEAPIS_CONFIG_H_ 3 | 4 | #define googleapis_VERSION_MAJOR @googleapis_VERSION_MAJOR@ 5 | #define googleapis_VERSION_MINOR @googleapis_VERSION_MINOR@ 6 | #define googleapis_VERSION_PATCH @googleapis_VERSION_PATCH@ 7 | #define googleapis_VERSION_DECORATOR "@googleapis_VERSION_DECORATOR@" 8 | 9 | // Indicates whether libproc is available. This is used on OSx for process 10 | // information rather than /proc on standard Unix. 11 | #cmakedefine HAVE_LIBPROC @HAVE_LIBPROC@ 12 | 13 | // Indicates fstat64 as well as lseek64 since these probably go together 14 | #cmakedefine HAVE_FSTAT64 @HAVE_FSTAT64@ 15 | 16 | // Indicates whether File suppports user/group/other permissions. 17 | // In the current windows port, user group permissions are not available. 18 | #cmakedefine HAVE_UGO_PERMISSIONS @HAVE_UGO_PERMISSIONS@ 19 | 20 | // Indicates wWhether file suppports user/group/other permissions. 21 | // In the current windows port, user group permissions are not available. 22 | #cmakedefine HAVE_OPENSSL @HAVE_OPENSSL@ 23 | 24 | // Indicates whether the Mongoose Http Server library is available 25 | // as an embedded http server. 26 | #cmakedefine HAVE_MONGOOSE @HAVE_MONGOOSE@ 27 | 28 | #endif // GOOGLEAPIS_CONFIG_H_ 29 | -------------------------------------------------------------------------------- /src/googleapis/strings/join.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | #ifndef GOOGLEAPIS_STRINGS_JOIN_H_ 21 | #define GOOGLEAPIS_STRINGS_JOIN_H_ 22 | 23 | #include 24 | using std::string; 25 | #include "googleapis/strings/strcat.h" 26 | #include "googleapis/strings/stringpiece.h" 27 | namespace googleapis { 28 | 29 | namespace strings { 30 | 31 | // ---------------------------------------------------------------------- 32 | // Join() 33 | // This merges a container of any type supported by StrAppend() with delim 34 | // inserted as separators between components. This is essentially a 35 | // templatized version of JoinUsingToBuffer(). 36 | // 37 | // JoinElementsIterator() 38 | // Same as JoinElements(), except that the input elements are specified 39 | // with a pair of forward iterators. 40 | // ---------------------------------------------------------------------- 41 | 42 | template 43 | void JoinElementsIterator(ITERATOR first, 44 | ITERATOR last, 45 | StringPiece delim, 46 | string* result) { 47 | result->clear(); 48 | for (ITERATOR it = first; it != last; ++it) { 49 | if (it != first) { 50 | StrAppend(result, delim); 51 | } 52 | StrAppend(result, *it); 53 | } 54 | } 55 | 56 | template 57 | string JoinElementsIterator(ITERATOR first, 58 | ITERATOR last, 59 | StringPiece delim) { 60 | string result; 61 | JoinElementsIterator(first, last, delim, &result); 62 | return result; 63 | } 64 | 65 | template 66 | inline void Join(const CONTAINER& components, 67 | StringPiece delim, 68 | string* result) { 69 | JoinElementsIterator(components.begin(), components.end(), delim, result); 70 | } 71 | 72 | template 73 | inline string Join(const CONTAINER& components, StringPiece delim) { 74 | string result; 75 | Join(components, delim, &result); 76 | return result; 77 | } 78 | 79 | } // namespace strings 80 | } // namespace googleapis 81 | #endif // GOOGLEAPIS_STRINGS_JOIN_H_ 82 | -------------------------------------------------------------------------------- /src/googleapis/strings/split.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include "googleapis/strings/split.h" 22 | 23 | #include 24 | 25 | #include "googleapis/strings/stringpiece.h" 26 | 27 | namespace googleapis { 28 | 29 | namespace strings { 30 | 31 | std::vector Split(const StringPiece& source, 32 | const StringPiece& delim) { 33 | std::vector result; 34 | 35 | if (source.empty()) { 36 | return result; 37 | } 38 | 39 | if (delim.empty()) { 40 | // Split on every char. 41 | for (const char* pc = source.data(); 42 | pc < source.data() + source.size(); 43 | ++pc) { 44 | result.push_back(StringPiece(pc, 1)); 45 | } 46 | return result; 47 | } 48 | 49 | int offset = 0; 50 | for (int next = 0; offset < source.size(); offset = next + delim.size()) { 51 | next = source.find(delim, offset); 52 | if (next == StringPiece::npos) { 53 | next = source.size(); 54 | } 55 | result.push_back(source.substr(offset, next - offset)); 56 | } 57 | 58 | if (offset == source.size()) { 59 | // Source terminated exactly on a delim, so push an empty dude to end. 60 | // Keep the pointer monotonically increasing for kicks. 61 | result.push_back(source.substr(source.size() - 1, 0)); 62 | } 63 | 64 | return result; 65 | } 66 | 67 | } // namespace strings 68 | 69 | } // namespace googleapis 70 | -------------------------------------------------------------------------------- /src/googleapis/strings/split.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | // 21 | // Simple routines for splitting strings. 22 | 23 | #ifndef GOOGLEAPIS_STRINGS_SPLIT_H_ 24 | #define GOOGLEAPIS_STRINGS_SPLIT_H_ 25 | 26 | #include 27 | 28 | #include "googleapis/strings/stringpiece.h" 29 | namespace googleapis { 30 | 31 | namespace strings { 32 | std::vector Split(const StringPiece& source, 33 | const StringPiece& delim); 34 | } // namespace strings 35 | 36 | } // namespace googleapis 37 | #endif // GOOGLEAPIS_STRINGS_SPLIT_H_ 38 | -------------------------------------------------------------------------------- /src/googleapis/util/executor.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #include // NOLINT 20 | 21 | #if __APPLE__ 22 | 23 | #include "googleapis/base/callback.h" 24 | #include "googleapis/base/mutex.h" 25 | 26 | #else 27 | 28 | #include "googleapis/base/callback.h" 29 | #include "googleapis/base/mutex.h" 30 | #endif 31 | #include "googleapis/util/executor.h" 32 | 33 | namespace googleapis { 34 | 35 | namespace { 36 | using thread::Executor; 37 | 38 | static Executor* default_executor_ = NULL; 39 | static Executor* global_inline_executor_ = NULL; 40 | 41 | std::once_flag module_init_; 42 | Mutex module_mutex_(base::LINKER_INITIALIZED); 43 | 44 | class InlineExecutor : public Executor { 45 | public: 46 | virtual ~InlineExecutor() {} 47 | 48 | virtual void Add(Closure* closure) { 49 | closure->Run(); 50 | } 51 | 52 | virtual bool TryAdd(Closure* closure) { 53 | closure->Run(); 54 | return true; 55 | } 56 | }; 57 | 58 | void InitModule() { 59 | global_inline_executor_ = new InlineExecutor; 60 | default_executor_ = global_inline_executor_; 61 | } 62 | 63 | } // anonymous namespace 64 | 65 | namespace thread { 66 | 67 | Executor::Executor() {} 68 | Executor::~Executor() {} 69 | 70 | // static 71 | Executor* Executor::DefaultExecutor() { 72 | std::call_once(module_init_, InitModule); 73 | return default_executor_; 74 | } 75 | 76 | // static 77 | void Executor::SetDefaultExecutor(Executor* executor) { 78 | std::call_once(module_init_, InitModule); 79 | MutexLock l(&module_mutex_); 80 | default_executor_ = executor; 81 | } 82 | 83 | // static 84 | Executor* NewInlineExecutor() { 85 | return new InlineExecutor; 86 | } 87 | 88 | // static 89 | Executor* SingletonInlineExecutor() { 90 | std::call_once(module_init_, InitModule); 91 | return global_inline_executor_; 92 | } 93 | 94 | } // namespace thread 95 | 96 | } // namespace googleapis 97 | -------------------------------------------------------------------------------- /src/googleapis/util/executor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | #ifndef GOOGLEAPIS_THREAD_EXECUTOR_H_ 20 | #define GOOGLEAPIS_THREAD_EXECUTOR_H_ 21 | 22 | 23 | #include "googleapis/base/macros.h" 24 | namespace googleapis { 25 | 26 | class Closure; 27 | 28 | namespace thread { 29 | 30 | class Executor { 31 | public: 32 | Executor(); 33 | virtual ~Executor(); 34 | 35 | virtual void Add(Closure* callback) = 0; 36 | virtual bool TryAdd(Closure* callback) = 0; 37 | 38 | // Caller retains ownership. 39 | static void SetDefaultExecutor(Executor* executor); 40 | static Executor* DefaultExecutor(); 41 | 42 | private: 43 | DISALLOW_COPY_AND_ASSIGN(Executor); 44 | }; 45 | 46 | // Immediately executes closures without using threads. 47 | // Caller should delete when done with it. 48 | Executor* NewInlineExecutor(); 49 | 50 | // Ownership is maintained internally by the Executor itself. 51 | Executor* SingletonInlineExecutor(); 52 | 53 | } // namespace thread 54 | 55 | } // namespace googleapis 56 | #endif // GOOGLEAPIS_THREAD_EXECUTOR_H_ 57 | -------------------------------------------------------------------------------- /src/googleapis/util/hash.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | // 21 | // If you need a cryptographic-strength hash function, find it 22 | // somewhere else. 23 | 24 | #include 25 | #include "googleapis/base/integral_types.h" 26 | #include "googleapis/util/hash.h" 27 | 28 | namespace googleapis { 29 | 30 | static const uint32 kPrimes32[16] = { 31 | 65537, 65539, 65543, 65551, 65557, 65563, 65579, 65581, 32 | 65587, 65599, 65609, 65617, 65629, 65633, 65647, 65651, 33 | }; 34 | 35 | static const uint64 kPrimes64[] = { 36 | GG_ULONGLONG(4294967311), GG_ULONGLONG(4294967357), 37 | GG_ULONGLONG(4294967371), GG_ULONGLONG(4294967377), 38 | GG_ULONGLONG(4294967387), GG_ULONGLONG(4294967389), 39 | GG_ULONGLONG(4294967459), GG_ULONGLONG(4294967477), 40 | GG_ULONGLONG(4294967497), GG_ULONGLONG(4294967513), 41 | GG_ULONGLONG(4294967539), GG_ULONGLONG(4294967543), 42 | GG_ULONGLONG(4294967549), GG_ULONGLONG(4294967561), 43 | GG_ULONGLONG(4294967563), GG_ULONGLONG(4294967569) 44 | }; 45 | 46 | uint32 Hash32StringWithSeedReferenceImplementation(const char *s, size_t len, 47 | uint32 seed) { 48 | uint32 n = seed; 49 | size_t prime1 = 0, prime2 = 8; // Indices into kPrimes32 50 | union { 51 | uint16 n; 52 | char bytes[sizeof(uint16)]; 53 | } chunk; 54 | for (const char *i = s, *const end = s + len; i != end; ) { 55 | chunk.bytes[0] = *i++; 56 | chunk.bytes[1] = i == end ? 0 : *i++; 57 | n = n * kPrimes32[prime1++] ^ chunk.n * kPrimes32[prime2++]; 58 | prime1 &= 0x0F; 59 | prime2 &= 0x0F; 60 | } 61 | return n; 62 | } 63 | 64 | uint32 Hash32StringWithSeed(const char *s, size_t len, uint32 c) { 65 | return Hash32StringWithSeedReferenceImplementation(s, len, c); 66 | } 67 | 68 | uint64 Hash64StringWithSeed(const char *s, size_t len, uint64 seed) { 69 | uint64 n = seed; 70 | size_t prime1 = 0, prime2 = 8; // Indices into kPrimes64 71 | union { 72 | uint32 n; 73 | char bytes[sizeof(uint32)]; 74 | } chunk; 75 | for (const char *i = s, *const end = s + len; i != end; ) { 76 | chunk.bytes[0] = *i++; 77 | chunk.bytes[1] = i == end ? 0 : *i++; 78 | chunk.bytes[2] = i == end ? 0 : *i++; 79 | chunk.bytes[3] = i == end ? 0 : *i++; 80 | n = n * kPrimes64[prime1++] ^ chunk.n * kPrimes64[prime2++]; 81 | prime1 &= 0x0F; 82 | prime2 &= 0x0F; 83 | } 84 | return n; 85 | } 86 | 87 | uint64 FingerprintReferenceImplementation(const char *s, uint32 len) { 88 | return Hash64StringWithSeed(s, len, 42); 89 | } 90 | 91 | } // namespace googleapis 92 | -------------------------------------------------------------------------------- /src/googleapis/util/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | #ifndef UTILS_HASH_HASH_H_ // NOLINT 21 | #define UTILS_HASH_HASH_H_ 22 | #include 23 | #include 24 | 25 | #include 26 | using std::string; 27 | #include 28 | #include "googleapis/base/port.h" 29 | #ifdef _WIN32 30 | #include "googleapis/base/windows_compatability.h" 31 | #endif 32 | #include "googleapis/base/integral_types.h" 33 | namespace googleapis { 34 | 35 | static inline void mix(uint32& a, uint32& b, uint32& c) { // 32bit version NOLINT 36 | a -= b; a -= c; a ^= (c >> 13); 37 | b -= c; b -= a; b ^= (a << 8); 38 | c -= a; c -= b; c ^= (b >> 13); 39 | a -= b; a -= c; a ^= (c >> 12); 40 | b -= c; b -= a; b ^= (a << 16); 41 | c -= a; c -= b; c ^= (b >> 5); 42 | a -= b; a -= c; a ^= (c >> 3); 43 | b -= c; b -= a; b ^= (a << 10); 44 | c -= a; c -= b; c ^= (b >> 15); 45 | } 46 | 47 | static inline void mix(uint64& a, uint64& b, uint64& c) { // 64bit version NOLINT 48 | a -= b; a -= c; a ^= (c >> 43); 49 | b -= c; b -= a; b ^= (a << 9); 50 | c -= a; c -= b; c ^= (b >> 8); 51 | a -= b; a -= c; a ^= (c >> 38); 52 | b -= c; b -= a; b ^= (a << 23); 53 | c -= a; c -= b; c ^= (b >> 5); 54 | a -= b; a -= c; a ^= (c >> 35); 55 | b -= c; b -= a; b ^= (a << 49); 56 | c -= a; c -= b; c ^= (b >> 11); 57 | a -= b; a -= c; a ^= (c >> 12); 58 | b -= c; b -= a; b ^= (a << 18); 59 | c -= a; c -= b; c ^= (b >> 22); 60 | } 61 | 62 | inline uint32 Hash32NumWithSeed(uint32 num, uint32 c) { 63 | uint32 b = 0x9e3779b9UL; // the golden ratio; an arbitrary value 64 | mix(num, b, c); 65 | return c; 66 | } 67 | 68 | inline uint64 Hash64NumWithSeed(uint64 num, uint64 c) { 69 | uint64 b = GG_ULONGLONG(0xe08c1d668b756f82); // more of the golden ratio 70 | mix(num, b, c); 71 | return c; 72 | } 73 | 74 | uint64 Hash64StringWithSeed(const char *s, size_t len, uint64 seed); 75 | 76 | // not implemented but referenced by stringpiece 77 | uint32 Hash32StringWithSeedReferenceImplementation(const char *s, size_t len, 78 | uint32 seed); 79 | 80 | inline size_t HashTo32(const char* s, size_t len) { 81 | return Hash32StringWithSeedReferenceImplementation(s, len, 42); 82 | } 83 | 84 | inline size_t HashStringThoroughly(const char* s, size_t len) { 85 | return HashTo32(s, len); 86 | } 87 | 88 | // MOE::strip_line The rest of this file is a subset of hash.h 89 | // MOE::strip_line But if it doesnt port, steal guts of protobuf's hash.h 90 | 91 | } // namespace googleapis 92 | #endif // UTILS_HASH_HASH_H_ NOLINT 93 | -------------------------------------------------------------------------------- /src/googleapis/util/mock_executor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #ifndef THREAD_MOCK_EXECUTOR_H_ 22 | #define THREAD_MOCK_EXECUTOR_H_ 23 | 24 | #include 25 | #include "googleapis/util/executor.h" 26 | namespace googleapis { 27 | 28 | namespace thread { 29 | 30 | class MockExecutor : public Executor { 31 | public: 32 | MOCK_METHOD1(Add, void(Closure* callback)); 33 | MOCK_METHOD1(TryAdd, bool(Closure* closure)); 34 | MOCK_METHOD1(AddIfReadyToRun, bool(Closure* closure)); 35 | MOCK_METHOD2(AddAfter, void(int ms, Closure *closure)); 36 | MOCK_CONST_METHOD0(num_pending_closures, int()); 37 | }; 38 | 39 | } // namespace thread 40 | 41 | } // namespace googleapis 42 | #endif // THREAD_MOCK_EXECUTOR_H_ 43 | -------------------------------------------------------------------------------- /src/googleapis/util/status.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * \copyright Copyright 2013 Google Inc. All Rights Reserved. 3 | * \license @{ 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * @} 18 | */ 19 | 20 | 21 | #include 22 | using std::string; 23 | 24 | #include "googleapis/util/status.h" 25 | 26 | namespace googleapis { 27 | 28 | #define CASE(code) case googleapis::util::error::code: return #code 29 | static std::string CodeToString(googleapis::util::error::Code code) { 30 | switch (code) { 31 | CASE(OK); 32 | CASE(CANCELLED); 33 | CASE(INVALID_ARGUMENT); 34 | CASE(DEADLINE_EXCEEDED); 35 | CASE(NOT_FOUND); 36 | CASE(ALREADY_EXISTS); 37 | CASE(PERMISSION_DENIED); 38 | CASE(RESOURCE_EXHAUSTED); 39 | CASE(FAILED_PRECONDITION); 40 | CASE(ABORTED); 41 | CASE(OUT_OF_RANGE); 42 | CASE(UNIMPLEMENTED); 43 | CASE(INTERNAL); 44 | CASE(UNAVAILABLE); 45 | CASE(DATA_LOSS); 46 | default: 47 | std::string result("Error #"); 48 | result.append(std::to_string(code)); 49 | return result; 50 | } 51 | // not reached 52 | } 53 | #undef CASE 54 | 55 | namespace util { 56 | 57 | std::string Status::ToString() const { 58 | std::string result = CodeToString(code_); 59 | if (!msg_.empty()) { 60 | result.append(": "); 61 | result.append(msg_); 62 | } 63 | 64 | return result; 65 | } 66 | 67 | } // namespace util 68 | 69 | } // namespace googleapis 70 | -------------------------------------------------------------------------------- /src/samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project (GoogleApis_C++_Samples) 2 | 3 | include_directories(${GFLAGS_INCLUDES}) 4 | INCLUDE_DIRECTORIES(${GOOGLEAPIS_SERVICE_REPOSITORY_DIR}/calendar) 5 | INCLUDE_DIRECTORIES(${GOOGLEAPIS_SERVICE_REPOSITORY_DIR}/storage) 6 | 7 | # This is the basic sample from the tutorial 8 | add_executable(calendar_sample calendar_sample_main.cc) 9 | target_link_libraries(calendar_sample google_calendar_api) 10 | target_link_libraries(calendar_sample googleapis_jsoncpp) 11 | target_link_libraries(calendar_sample googleapis_curl_http) 12 | target_link_libraries(calendar_sample googleapis_http) 13 | target_link_libraries(calendar_sample googleapis_oauth2) 14 | target_link_libraries(calendar_sample googleapis_utils) 15 | if (HAVE_OPENSSL) 16 | target_link_libraries(calendar_sample googleapis_openssl_codec) 17 | endif() 18 | target_link_libraries(calendar_sample ${GFLAGS_LIBRARY}) 19 | target_link_libraries(calendar_sample pthread) 20 | 21 | add_executable(storage_sample storage_sample_main.cc) 22 | target_link_libraries(storage_sample google_calendar_api) 23 | target_link_libraries(storage_sample google_storage_api) 24 | target_link_libraries(storage_sample googleapis_jsoncpp) 25 | target_link_libraries(storage_sample googleapis_curl_http) 26 | target_link_libraries(storage_sample googleapis_http) 27 | target_link_libraries(storage_sample googleapis_oauth2) 28 | target_link_libraries(storage_sample googleapis_utils) 29 | if (HAVE_OPENSSL) 30 | target_link_libraries(storage_sample googleapis_openssl_codec) 31 | endif() 32 | target_link_libraries(storage_sample ${GFLAGS_LIBRARY}) 33 | target_link_libraries(storage_sample pthread) 34 | -------------------------------------------------------------------------------- /src/samples/resources/download-client-secret.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/google-api-cpp-client/3df15df632bef43eb320645ac3329d872aabf5ad/src/samples/resources/download-client-secret.png --------------------------------------------------------------------------------