├── .gitattributes ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── VERSION ├── build.sh ├── compiler ├── CHANGES.txt ├── CONTRIBUTORS.txt ├── COPYING.txt ├── INSTALL.txt ├── Makefile.am ├── README.txt ├── autogen.sh ├── configure.ac ├── editors │ ├── README.txt │ ├── proto.vim │ └── protobuf-mode.el ├── examples │ ├── AddPerson.java │ ├── ListPeople.java │ ├── Makefile │ ├── README.txt │ ├── add_person.cc │ ├── add_person.py │ ├── addressbook.proto │ ├── list_people.cc │ └── list_people.py ├── generate_descriptor_proto.sh ├── gtest │ ├── CHANGES │ ├── CONTRIBUTORS │ ├── COPYING │ ├── Makefile.am │ ├── README │ ├── build-aux │ │ └── stamp-h1 │ ├── codegear │ │ ├── gtest.cbproj │ │ ├── gtest.groupproj │ │ ├── gtest_all.cc │ │ ├── gtest_link.cc │ │ ├── gtest_main.cbproj │ │ └── gtest_unittest.cbproj │ ├── configure.ac │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── m4 │ │ ├── acx_pthread.m4 │ │ └── gtest.m4 │ ├── make │ │ └── Makefile │ ├── msvc │ │ ├── gtest.sln │ │ ├── gtest.vcproj │ │ ├── gtest_color_test_.vcproj │ │ ├── gtest_env_var_test_.vcproj │ │ ├── gtest_environment_test.vcproj │ │ ├── gtest_main.vcproj │ │ ├── gtest_output_test_.vcproj │ │ ├── gtest_prod_test.vcproj │ │ ├── gtest_uninitialized_test_.vcproj │ │ └── gtest_unittest.vcproj │ ├── samples │ │ ├── .deps │ │ │ ├── sample1.Plo │ │ │ ├── sample1_unittest.Po │ │ │ ├── sample2.Plo │ │ │ ├── sample2_unittest.Po │ │ │ ├── sample3_unittest.Po │ │ │ ├── sample4.Plo │ │ │ ├── sample4_unittest.Po │ │ │ ├── sample5_unittest.Po │ │ │ ├── sample6_unittest.Po │ │ │ ├── sample7_unittest.Po │ │ │ └── sample8_unittest.Po │ │ ├── prime_tables.h │ │ ├── sample1.cc │ │ ├── sample1.h │ │ ├── sample1_unittest.cc │ │ ├── sample2.cc │ │ ├── sample2.h │ │ ├── sample2_unittest.cc │ │ ├── sample3-inl.h │ │ ├── sample3_unittest.cc │ │ ├── sample4.cc │ │ ├── sample4.h │ │ ├── sample4_unittest.cc │ │ ├── sample5_unittest.cc │ │ ├── sample6_unittest.cc │ │ ├── sample7_unittest.cc │ │ └── sample8_unittest.cc │ ├── scons │ │ └── SConscript │ ├── scripts │ │ ├── fuse_gtest_files.py │ │ ├── gen_gtest_pred_impl.py │ │ ├── gtest-config │ │ ├── gtest-config.in │ │ └── test │ │ │ └── Makefile │ ├── src │ │ ├── .deps │ │ │ ├── gtest-death-test.Plo │ │ │ ├── gtest-filepath.Plo │ │ │ ├── gtest-port.Plo │ │ │ ├── gtest-test-part.Plo │ │ │ ├── gtest-typed-test.Plo │ │ │ ├── gtest.Plo │ │ │ ├── gtest_main.Plo │ │ │ ├── test_gtest_no_rtti_test-gtest-all.Po │ │ │ ├── test_gtest_no_rtti_test-gtest_main.Po │ │ │ ├── test_gtest_throw_on_failure_ex_test-gtest-all.Po │ │ │ ├── test_gtest_throw_on_failure_test_-gtest-all.Po │ │ │ ├── test_gtest_tuple_test-gtest-all.Po │ │ │ ├── test_gtest_tuple_test-gtest_main.Po │ │ │ └── test_gtest_use_own_tuple_test-gtest-all.Po │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-port.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ ├── test │ │ ├── .deps │ │ │ ├── gtest-filepath_test.Po │ │ │ ├── gtest-linked_ptr_test.Po │ │ │ ├── gtest-message_test.Po │ │ │ ├── gtest-options_test.Po │ │ │ ├── gtest-param-test2_test.Po │ │ │ ├── gtest-param-test_test.Po │ │ │ ├── gtest-port_test.Po │ │ │ ├── gtest-test-part_test.Po │ │ │ ├── gtest-typed-test2_test.Po │ │ │ ├── gtest-typed-test_test.Po │ │ │ ├── gtest-unittest-api_test.Po │ │ │ ├── gtest_break_on_failure_unittest_.Po │ │ │ ├── gtest_color_test_.Po │ │ │ ├── gtest_env_var_test_.Po │ │ │ ├── gtest_environment_test.Po │ │ │ ├── gtest_filter_unittest_.Po │ │ │ ├── gtest_help_test_.Po │ │ │ ├── gtest_list_tests_unittest_.Po │ │ │ ├── gtest_main_unittest.Po │ │ │ ├── gtest_no_test_unittest.Po │ │ │ ├── gtest_output_test_.Po │ │ │ ├── gtest_pred_impl_unittest.Po │ │ │ ├── gtest_prod_test.Po │ │ │ ├── gtest_repeat_test.Po │ │ │ ├── gtest_sole_header_test.Po │ │ │ ├── gtest_stress_test.Po │ │ │ ├── gtest_uninitialized_test_.Po │ │ │ ├── gtest_unittest.Po │ │ │ ├── gtest_xml_outfile1_test_.Po │ │ │ ├── gtest_xml_outfile2_test_.Po │ │ │ ├── gtest_xml_output_unittest_.Po │ │ │ ├── production.Po │ │ │ ├── test_gtest_death_test_test-gtest-death-test_test.Po │ │ │ ├── test_gtest_no_rtti_test-gtest_unittest.Po │ │ │ ├── test_gtest_throw_on_failure_ex_test-gtest_throw_on_failure_ex_test.Po │ │ │ ├── test_gtest_throw_on_failure_test_-gtest_throw_on_failure_test_.Po │ │ │ ├── test_gtest_tuple_test-gtest-tuple_test.Po │ │ │ ├── test_gtest_use_own_tuple_test-gtest-param-test2_test.Po │ │ │ └── test_gtest_use_own_tuple_test-gtest-param-test_test.Po │ │ ├── gtest-death-test_test.cc │ │ ├── gtest-filepath_test.cc │ │ ├── gtest-linked_ptr_test.cc │ │ ├── gtest-message_test.cc │ │ ├── gtest-options_test.cc │ │ ├── gtest-param-test2_test.cc │ │ ├── gtest-param-test_test.cc │ │ ├── gtest-param-test_test.h │ │ ├── gtest-port_test.cc │ │ ├── gtest-test-part_test.cc │ │ ├── gtest-tuple_test.cc │ │ ├── gtest-typed-test2_test.cc │ │ ├── gtest-typed-test_test.cc │ │ ├── gtest-typed-test_test.h │ │ ├── gtest-unittest-api_test.cc │ │ ├── gtest_all_test.cc │ │ ├── gtest_break_on_failure_unittest.py │ │ ├── gtest_break_on_failure_unittest_.cc │ │ ├── gtest_color_test.py │ │ ├── gtest_color_test_.cc │ │ ├── gtest_env_var_test.py │ │ ├── gtest_env_var_test_.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_filter_unittest.py │ │ ├── gtest_filter_unittest_.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_list_tests_unittest.py │ │ ├── gtest_list_tests_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_nc.cc │ │ ├── gtest_nc_test.py │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_output_test.py │ │ ├── gtest_output_test_.cc │ │ ├── gtest_output_test_golden_lin.txt │ │ ├── gtest_output_test_golden_win.txt │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ ├── gtest_throw_on_failure_test.py │ │ ├── gtest_throw_on_failure_test_.cc │ │ ├── gtest_uninitialized_test.py │ │ ├── gtest_uninitialized_test_.cc │ │ ├── gtest_unittest.cc │ │ ├── gtest_xml_outfile1_test_.cc │ │ ├── gtest_xml_outfile2_test_.cc │ │ ├── gtest_xml_outfiles_test.py │ │ ├── gtest_xml_output_unittest.py │ │ ├── gtest_xml_output_unittest_.cc │ │ ├── gtest_xml_test_utils.py │ │ ├── production.cc │ │ └── production.h │ └── xcode │ │ ├── Config │ │ ├── DebugProject.xcconfig │ │ ├── FrameworkTarget.xcconfig │ │ ├── General.xcconfig │ │ ├── InternalPythonTestTarget.xcconfig │ │ ├── InternalTestTarget.xcconfig │ │ ├── ReleaseProject.xcconfig │ │ └── TestTarget.xcconfig │ │ ├── Resources │ │ └── Info.plist │ │ ├── Samples │ │ └── FrameworkSample │ │ │ ├── Info.plist │ │ │ ├── WidgetFramework.xcodeproj │ │ │ └── project.pbxproj │ │ │ ├── widget.cc │ │ │ ├── widget.h │ │ │ └── widget_test.cc │ │ ├── Scripts │ │ ├── runtests.sh │ │ └── versiongenerate.py │ │ └── gtest.xcodeproj │ │ └── project.pbxproj ├── java │ ├── README.txt │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── google │ │ │ └── protobuf │ │ │ ├── AbstractMessage.java │ │ │ ├── AbstractMessageLite.java │ │ │ ├── BlockingRpcChannel.java │ │ │ ├── BlockingService.java │ │ │ ├── ByteString.java │ │ │ ├── CodedInputStream.java │ │ │ ├── CodedOutputStream.java │ │ │ ├── DescriptorProtos.java │ │ │ ├── Descriptors.java │ │ │ ├── DynamicMessage.java │ │ │ ├── ExtensionRegistry.java │ │ │ ├── ExtensionRegistryLite.java │ │ │ ├── FieldSet.java │ │ │ ├── GeneratedMessage.java │ │ │ ├── GeneratedMessageLite.java │ │ │ ├── Internal.java │ │ │ ├── InvalidProtocolBufferException.java │ │ │ ├── Message.java │ │ │ ├── MessageLite.java │ │ │ ├── ProtocolMessageEnum.java │ │ │ ├── RpcCallback.java │ │ │ ├── RpcChannel.java │ │ │ ├── RpcController.java │ │ │ ├── RpcUtil.java │ │ │ ├── Service.java │ │ │ ├── ServiceException.java │ │ │ ├── TextFormat.java │ │ │ ├── UninitializedMessageException.java │ │ │ ├── UnknownFieldSet.java │ │ │ └── WireFormat.java │ │ └── test │ │ └── java │ │ └── com │ │ └── google │ │ └── protobuf │ │ ├── AbstractMessageTest.java │ │ ├── CodedInputStreamTest.java │ │ ├── CodedOutputStreamTest.java │ │ ├── DescriptorsTest.java │ │ ├── DynamicMessageTest.java │ │ ├── GeneratedMessageTest.java │ │ ├── LiteTest.java │ │ ├── MessageTest.java │ │ ├── ServiceTest.java │ │ ├── TestUtil.java │ │ ├── TextFormatTest.java │ │ ├── UnknownFieldSetTest.java │ │ ├── WireFormatTest.java │ │ └── multiple_files_test.proto ├── m4 │ ├── ac_system_extensions.m4 │ ├── acx_check_suncc.m4 │ ├── acx_pthread.m4 │ └── stl_hash.m4 ├── protobuf-lite.pc ├── protobuf-lite.pc.in ├── protobuf.pc ├── protobuf.pc.in ├── python │ ├── README.txt │ ├── ez_setup.py │ ├── google │ │ ├── __init__.py │ │ └── protobuf │ │ │ ├── __init__.py │ │ │ ├── descriptor.py │ │ │ ├── internal │ │ │ ├── __init__.py │ │ │ ├── containers.py │ │ │ ├── decoder.py │ │ │ ├── decoder_test.py │ │ │ ├── descriptor_test.py │ │ │ ├── encoder.py │ │ │ ├── encoder_test.py │ │ │ ├── generator_test.py │ │ │ ├── input_stream.py │ │ │ ├── input_stream_test.py │ │ │ ├── message_listener.py │ │ │ ├── message_test.py │ │ │ ├── more_extensions.proto │ │ │ ├── more_messages.proto │ │ │ ├── output_stream.py │ │ │ ├── output_stream_test.py │ │ │ ├── reflection_test.py │ │ │ ├── service_reflection_test.py │ │ │ ├── test_util.py │ │ │ ├── text_format_test.py │ │ │ ├── type_checkers.py │ │ │ ├── wire_format.py │ │ │ └── wire_format_test.py │ │ │ ├── message.py │ │ │ ├── reflection.py │ │ │ ├── service.py │ │ │ ├── service_reflection.py │ │ │ └── text_format.py │ ├── mox.py │ ├── setup.py │ └── stubout.py ├── src │ ├── Makefile.am │ └── google │ │ └── protobuf │ │ ├── compiler │ │ ├── code_generator.cc │ │ ├── code_generator.h │ │ ├── command_line_interface.cc │ │ ├── command_line_interface.h │ │ ├── command_line_interface_unittest.cc │ │ ├── cpp │ │ │ ├── cpp_bootstrap_unittest.cc │ │ │ ├── cpp_enum.cc │ │ │ ├── cpp_enum.h │ │ │ ├── cpp_enum_field.cc │ │ │ ├── cpp_enum_field.h │ │ │ ├── cpp_extension.cc │ │ │ ├── cpp_extension.h │ │ │ ├── cpp_field.cc │ │ │ ├── cpp_field.h │ │ │ ├── cpp_file.cc │ │ │ ├── cpp_file.h │ │ │ ├── cpp_generator.cc │ │ │ ├── cpp_generator.h │ │ │ ├── cpp_helpers.cc │ │ │ ├── cpp_helpers.h │ │ │ ├── cpp_message.cc │ │ │ ├── cpp_message.h │ │ │ ├── cpp_message_field.cc │ │ │ ├── cpp_message_field.h │ │ │ ├── cpp_primitive_field.cc │ │ │ ├── cpp_primitive_field.h │ │ │ ├── cpp_service.cc │ │ │ ├── cpp_service.h │ │ │ ├── cpp_string_field.cc │ │ │ ├── cpp_string_field.h │ │ │ ├── cpp_test_bad_identifiers.proto │ │ │ └── cpp_unittest.cc │ │ ├── importer.cc │ │ ├── importer.h │ │ ├── importer_unittest.cc │ │ ├── java │ │ │ ├── java_enum.cc │ │ │ ├── java_enum.h │ │ │ ├── java_enum_field.cc │ │ │ ├── java_enum_field.h │ │ │ ├── java_extension.cc │ │ │ ├── java_extension.h │ │ │ ├── java_field.cc │ │ │ ├── java_field.h │ │ │ ├── java_file.cc │ │ │ ├── java_file.h │ │ │ ├── java_generator.cc │ │ │ ├── java_generator.h │ │ │ ├── java_helpers.cc │ │ │ ├── java_helpers.h │ │ │ ├── java_message.cc │ │ │ ├── java_message.h │ │ │ ├── java_message_field.cc │ │ │ ├── java_message_field.h │ │ │ ├── java_primitive_field.cc │ │ │ ├── java_primitive_field.h │ │ │ ├── java_service.cc │ │ │ └── java_service.h │ │ ├── main.cc │ │ ├── objectivec │ │ │ ├── objectivec_enum.cc │ │ │ ├── objectivec_enum.h │ │ │ ├── objectivec_enum_field.cc │ │ │ ├── objectivec_enum_field.h │ │ │ ├── objectivec_extension.cc │ │ │ ├── objectivec_extension.h │ │ │ ├── objectivec_field.cc │ │ │ ├── objectivec_field.h │ │ │ ├── objectivec_file.cc │ │ │ ├── objectivec_file.h │ │ │ ├── objectivec_generator.cc │ │ │ ├── objectivec_generator.h │ │ │ ├── objectivec_helpers.cc │ │ │ ├── objectivec_helpers.h │ │ │ ├── objectivec_message.cc │ │ │ ├── objectivec_message.h │ │ │ ├── objectivec_message_field.cc │ │ │ ├── objectivec_message_field.h │ │ │ ├── objectivec_primitive_field.cc │ │ │ └── objectivec_primitive_field.h │ │ ├── package_info.h │ │ ├── parser.cc │ │ ├── parser.h │ │ ├── parser_unittest.cc │ │ └── python │ │ │ ├── python_generator.cc │ │ │ └── python_generator.h │ │ ├── descriptor.cc │ │ ├── descriptor.h │ │ ├── descriptor.pb.cc │ │ ├── descriptor.pb.h │ │ ├── descriptor.proto │ │ ├── descriptor_database.cc │ │ ├── descriptor_database.h │ │ ├── descriptor_database_unittest.cc │ │ ├── descriptor_unittest.cc │ │ ├── dynamic_message.cc │ │ ├── dynamic_message.h │ │ ├── dynamic_message_unittest.cc │ │ ├── extension_set.cc │ │ ├── extension_set.h │ │ ├── extension_set_heavy.cc │ │ ├── extension_set_unittest.cc │ │ ├── generated_message_reflection.cc │ │ ├── generated_message_reflection.h │ │ ├── generated_message_reflection_unittest.cc │ │ ├── generated_message_util.cc │ │ ├── generated_message_util.h │ │ ├── io │ │ ├── coded_stream.cc │ │ ├── coded_stream.h │ │ ├── coded_stream_unittest.cc │ │ ├── gzip_stream.cc │ │ ├── gzip_stream.h │ │ ├── gzip_stream_unittest.sh │ │ ├── package_info.h │ │ ├── printer.cc │ │ ├── printer.h │ │ ├── printer_unittest.cc │ │ ├── tokenizer.cc │ │ ├── tokenizer.h │ │ ├── tokenizer_unittest.cc │ │ ├── zero_copy_stream.cc │ │ ├── zero_copy_stream.h │ │ ├── zero_copy_stream_impl.cc │ │ ├── zero_copy_stream_impl.h │ │ ├── zero_copy_stream_impl_lite.cc │ │ ├── zero_copy_stream_impl_lite.h │ │ └── zero_copy_stream_unittest.cc │ │ ├── lite_unittest.cc │ │ ├── message.cc │ │ ├── message.h │ │ ├── message_lite.cc │ │ ├── message_lite.h │ │ ├── message_unittest.cc │ │ ├── objectivec-descriptor.pb.cc │ │ ├── objectivec-descriptor.pb.h │ │ ├── objectivec-descriptor.proto │ │ ├── package_info.h │ │ ├── reflection_ops.cc │ │ ├── reflection_ops.h │ │ ├── reflection_ops_unittest.cc │ │ ├── repeated_field.cc │ │ ├── repeated_field.h │ │ ├── repeated_field_unittest.cc │ │ ├── service.cc │ │ ├── service.h │ │ ├── stubs │ │ ├── common.cc │ │ ├── common.h │ │ ├── common_unittest.cc │ │ ├── hash.cc │ │ ├── hash.h │ │ ├── map-util.h │ │ ├── once.cc │ │ ├── once.h │ │ ├── once_unittest.cc │ │ ├── stl_util-inl.h │ │ ├── structurally_valid.cc │ │ ├── structurally_valid_unittest.cc │ │ ├── strutil.cc │ │ ├── strutil.h │ │ ├── strutil_unittest.cc │ │ ├── substitute.cc │ │ └── substitute.h │ │ ├── test_util.cc │ │ ├── test_util.h │ │ ├── test_util_lite.cc │ │ ├── test_util_lite.h │ │ ├── testdata │ │ ├── golden_message │ │ ├── golden_packed_fields_message │ │ ├── text_format_unittest_data.txt │ │ └── text_format_unittest_extensions_data.txt │ │ ├── testing │ │ ├── file.cc │ │ ├── file.h │ │ ├── googletest.cc │ │ ├── googletest.h │ │ ├── zcgunzip.cc │ │ └── zcgzip.cc │ │ ├── text_format.cc │ │ ├── text_format.h │ │ ├── text_format_unittest.cc │ │ ├── unittest.proto │ │ ├── unittest_custom_options.proto │ │ ├── unittest_embed_optimize_for.proto │ │ ├── unittest_empty.proto │ │ ├── unittest_enormous_descriptor.proto │ │ ├── unittest_import.proto │ │ ├── unittest_import_lite.proto │ │ ├── unittest_lite.proto │ │ ├── unittest_lite_imports_nonlite.proto │ │ ├── unittest_mset.proto │ │ ├── unittest_optimize_for.proto │ │ ├── unknown_field_set.cc │ │ ├── unknown_field_set.h │ │ ├── unknown_field_set_unittest.cc │ │ ├── wire_format.cc │ │ ├── wire_format.h │ │ ├── wire_format_lite.cc │ │ ├── wire_format_lite.h │ │ ├── wire_format_lite_inl.h │ │ └── wire_format_unittest.cc ├── stamp-h1 └── vsprojects │ ├── config.h │ ├── convert2008to2005.sh │ ├── extract_includes.bat │ ├── libprotobuf-lite.vcproj │ ├── libprotobuf.vcproj │ ├── libprotoc.vcproj │ ├── lite-test.vcproj │ ├── protobuf.sln │ ├── protoc.vcproj │ ├── readme.txt │ └── tests.vcproj ├── protobuf-ios.podspec └── runtime └── protobuf-ios ├── Classes ├── AbstractMessage.h ├── AbstractMessage.m ├── AbstractMessage_Builder.h ├── AbstractMessage_Builder.m ├── Bootstrap.h ├── CodedInputStream.h ├── CodedInputStream.m ├── CodedOutputStream.h ├── CodedOutputStream.m ├── ConcreteExtensionField.h ├── ConcreteExtensionField.m ├── Descriptor.pb.h ├── Descriptor.pb.m ├── ExtendableMessage.h ├── ExtendableMessage.m ├── ExtendableMessage_Builder.h ├── ExtendableMessage_Builder.m ├── ExtensionField.h ├── ExtensionRegistry.h ├── ExtensionRegistry.m ├── Field.h ├── Field.m ├── ForwardDeclarations.h ├── GeneratedMessage.h ├── GeneratedMessage.m ├── GeneratedMessage_Builder.h ├── GeneratedMessage_Builder.m ├── Message.h ├── Message_Builder.h ├── MutableExtensionRegistry.h ├── MutableExtensionRegistry.m ├── MutableField.h ├── MutableField.m ├── PBArray.h ├── PBArray.m ├── ProtocolBuffers.h ├── RingBuffer.h ├── RingBuffer.m ├── TextFormat.h ├── TextFormat.m ├── UnknownFieldSet.h ├── UnknownFieldSet.m ├── UnknownFieldSet_Builder.h ├── UnknownFieldSet_Builder.m ├── Utilities.h ├── Utilities.m ├── WireFormat.h ├── WireFormat.m └── protobuf-ios-Prefix.pch ├── protobuf-ios.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ ├── protobuf-ios.xcscheme │ │ └── protobuf-iosTests.xcscheme └── xcuserdata │ └── chenming.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── protobuf-iosTests ├── en.lproj └── InfoPlist.strings └── protobuf-iosTests-Info.plist /.gitattributes: -------------------------------------------------------------------------------- 1 | linguist-vendored=compiler/ 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | 3 | # path to your xcodeproj folder 4 | #xcode_project: runtime/protobuf-ios/protobuf-ios.xcodeproj 5 | 6 | #xcode_scheme: protobuf-iosTests 7 | # 8 | 9 | script: ./build.sh 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # protobuf-ios Change Log 2 | 3 | ## 2.3.1 4 | 5 | - Support write to / parse from delimited stream (protobuf 2.3 feature). 6 | - Initial release to support **cocoapod** 7 | 8 | 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012, Ming Chen 2 | Copyright (C) 2010, Booyah Inc. 3 | Copyright (C) 2008, Cyrus Najmabadi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is furnished 10 | to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 2.3.2 2 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | xctool -project runtime/protobuf-ios/protobuf-ios.xcodeproj -scheme protobuf-ios build 4 | 5 | #xctool -project runtime/protobuf-ios/protobuf-ios.xcodeproj -scheme protobuf-iosTests build test -sdk iphonesimulator 6 | -------------------------------------------------------------------------------- /compiler/CONTRIBUTORS.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mingchen/protobuf-ios/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/CONTRIBUTORS.txt -------------------------------------------------------------------------------- /compiler/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | Code generated by the Protocol Buffer compiler is owned by the owner 31 | of the input file used when generating it. This code is not 32 | standalone and requires a support library to be linked with it. This 33 | support library is itself covered by the above license. 34 | -------------------------------------------------------------------------------- /compiler/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script to generate the configure script and other files that will 4 | # be included in the distribution. These files are not checked in because they 5 | # are automatically generated. 6 | 7 | # Check that we're being run from the right directory. 8 | if test ! -f src/google/protobuf/stubs/common.h; then 9 | cat >&2 << __EOF__ 10 | Could not find source code. Make sure you are running this script from the 11 | root of the distribution tree. 12 | __EOF__ 13 | exit 1 14 | fi 15 | 16 | set -ex 17 | 18 | # Temporary hack: Must change C runtime library to "multi-threaded DLL", 19 | # otherwise it will be set to "multi-threaded static" when MSVC upgrades 20 | # the project file to MSVC 2005/2008. vladl of Google Test says gtest will 21 | # probably change their default to match, then this will be unnecessary. 22 | # One of these mappings converts the debug configuration and the other 23 | # converts the release configuration. I don't know which is which. 24 | sed -i -e 's/RuntimeLibrary="5"/RuntimeLibrary="3"/g; 25 | s/RuntimeLibrary="4"/RuntimeLibrary="2"/g;' gtest/msvc/*.vcproj 26 | 27 | # TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings. 28 | autoreconf -f -i -Wall,no-obsolete 29 | 30 | rm -rf autom4te.cache config.h.in~ 31 | exit 0 32 | -------------------------------------------------------------------------------- /compiler/editors/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains syntax highlighting and configuration files for editors 2 | to properly display Protocol Buffer files. 3 | 4 | See each file's header comment for directions on how to use it with the 5 | appropriate editor. 6 | -------------------------------------------------------------------------------- /compiler/examples/ListPeople.java: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | import com.example.tutorial.AddressBookProtos.AddressBook; 4 | import com.example.tutorial.AddressBookProtos.Person; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.PrintStream; 8 | 9 | class ListPeople { 10 | // Iterates though all people in the AddressBook and prints info about them. 11 | static void Print(AddressBook addressBook) { 12 | for (Person person: addressBook.getPersonList()) { 13 | System.out.println("Person ID: " + person.getId()); 14 | System.out.println(" Name: " + person.getName()); 15 | if (person.hasEmail()) { 16 | System.out.println(" E-mail address: " + person.getEmail()); 17 | } 18 | 19 | for (Person.PhoneNumber phoneNumber : person.getPhoneList()) { 20 | switch (phoneNumber.getType()) { 21 | case MOBILE: 22 | System.out.print(" Mobile phone #: "); 23 | break; 24 | case HOME: 25 | System.out.print(" Home phone #: "); 26 | break; 27 | case WORK: 28 | System.out.print(" Work phone #: "); 29 | break; 30 | } 31 | System.out.println(phoneNumber.getNumber()); 32 | } 33 | } 34 | } 35 | 36 | // Main function: Reads the entire address book from a file and prints all 37 | // the information inside. 38 | public static void main(String[] args) throws Exception { 39 | if (args.length != 1) { 40 | System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE"); 41 | System.exit(-1); 42 | } 43 | 44 | // Read the existing address book. 45 | AddressBook addressBook = 46 | AddressBook.parseFrom(new FileInputStream(args[0])); 47 | 48 | Print(addressBook); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /compiler/examples/Makefile: -------------------------------------------------------------------------------- 1 | # See README.txt. 2 | 3 | .PHONY: all cpp java python clean 4 | 5 | all: cpp java python 6 | 7 | cpp: add_person_cpp list_people_cpp 8 | java: add_person_java list_people_java 9 | python: add_person_python list_people_python 10 | 11 | clean: 12 | rm -f add_person_cpp list_people_cpp add_person_java list_people_java add_person_python list_people_python 13 | rm -f javac_middleman AddPerson*.class ListPeople*.class com/example/tutorial/*.class 14 | rm -f protoc_middleman addressbook.pb.cc addressbook.pb.h addressbook_pb2.py com/example/tutorial/AddressBookProtos.java 15 | rm -f *.pyc 16 | rmdir com/example/tutorial 2>/dev/null || true 17 | rmdir com/example 2>/dev/null || true 18 | rmdir com 2>/dev/null || true 19 | 20 | protoc_middleman: addressbook.proto 21 | protoc --cpp_out=. --java_out=. --python_out=. addressbook.proto 22 | @touch protoc_middleman 23 | 24 | add_person_cpp: add_person.cc protoc_middleman 25 | pkg-config --cflags protobuf # fails if protobuf is not installed 26 | c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` 27 | 28 | list_people_cpp: list_people.cc protoc_middleman 29 | pkg-config --cflags protobuf # fails if protobuf is not installed 30 | c++ list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf` 31 | 32 | javac_middleman: AddPerson.java ListPeople.java protoc_middleman 33 | javac AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java 34 | @touch javac_middleman 35 | 36 | add_person_java: javac_middleman 37 | @echo "Writing shortcut script add_person_java..." 38 | @echo '#! /bin/sh' > add_person_java 39 | @echo 'java -classpath .:$$CLASSPATH AddPerson "$$@"' >> add_person_java 40 | @chmod +x add_person_java 41 | 42 | list_people_java: javac_middleman 43 | @echo "Writing shortcut script list_people_java..." 44 | @echo '#! /bin/sh' > list_people_java 45 | @echo 'java -classpath .:$$CLASSPATH ListPeople "$$@"' >> list_people_java 46 | @chmod +x list_people_java 47 | 48 | add_person_python: add_person.py protoc_middleman 49 | @echo "Writing shortcut script add_person_python..." 50 | @echo '#! /bin/sh' > add_person_python 51 | @echo './add_person.py "$$@"' >> add_person_python 52 | @chmod +x add_person_python 53 | 54 | list_people_python: list_people.py protoc_middleman 55 | @echo "Writing shortcut script list_people_python..." 56 | @echo '#! /bin/sh' > list_people_python 57 | @echo './list_people.py "$$@"' >> list_people_python 58 | @chmod +x list_people_python 59 | -------------------------------------------------------------------------------- /compiler/examples/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains example code that uses Protocol Buffers to manage an 2 | address book. Two programs are provided, each with three different 3 | implementations, one written in each of C++, Java, and Python. The add_person 4 | example adds a new person to an address book, prompting the user to input 5 | the person's information. The list_people example lists people already in the 6 | address book. The examples use the exact same format in all three languages, 7 | so you can, for example, use add_person_java to create an address book and then 8 | use list_people_python to read it. 9 | 10 | You must install the protobuf package before you can build these. 11 | 12 | To build all the examples (on a unix-like system), simply run "make". This 13 | creates the following executable files in the current directory: 14 | add_person_cpp list_people_cpp 15 | add_person_java list_people_java 16 | add_person_python list_people_python 17 | 18 | If you only want to compile examples in one language, use "make cpp"*, 19 | "make java", or "make python". 20 | 21 | All of these programs simply take an address book file as their parameter. 22 | The add_person programs will create the file if it doesn't already exist. 23 | 24 | These examples are part of the Protocol Buffers tutorial, located at: 25 | http://code.google.com/apis/protocolbuffers/docs/tutorials.html 26 | 27 | * Note that on some platforms you may have to edit the Makefile and remove 28 | "-lpthread" from the linker commands (perhaps replacing it with something else). 29 | We didn't do this automatically because we wanted to keep the example simple. 30 | -------------------------------------------------------------------------------- /compiler/examples/add_person.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # See README.txt for information and build instructions. 4 | 5 | import addressbook_pb2 6 | import sys 7 | 8 | # This function fills in a Person message based on user input. 9 | def PromptForAddress(person): 10 | person.id = int(raw_input("Enter person ID number: ")) 11 | person.name = raw_input("Enter name: ") 12 | 13 | email = raw_input("Enter email address (blank for none): ") 14 | if email != "": 15 | person.email = email 16 | 17 | while True: 18 | number = raw_input("Enter a phone number (or leave blank to finish): ") 19 | if number == "": 20 | break 21 | 22 | phone_number = person.phone.add() 23 | phone_number.number = number 24 | 25 | type = raw_input("Is this a mobile, home, or work phone? ") 26 | if type == "mobile": 27 | phone_number.type = addressbook_pb2.Person.MOBILE 28 | elif type == "home": 29 | phone_number.type = addressbook_pb2.Person.HOME 30 | elif type == "work": 31 | phone_number.type = addressbook_pb2.Person.WORK 32 | else: 33 | print "Unknown phone type; leaving as default value." 34 | 35 | # Main procedure: Reads the entire address book from a file, 36 | # adds one person based on user input, then writes it back out to the same 37 | # file. 38 | if len(sys.argv) != 2: 39 | print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE" 40 | sys.exit(-1) 41 | 42 | address_book = addressbook_pb2.AddressBook() 43 | 44 | # Read the existing address book. 45 | try: 46 | f = open(sys.argv[1], "rb") 47 | address_book.ParseFromString(f.read()) 48 | f.close() 49 | except IOError: 50 | print sys.argv[1] + ": File not found. Creating a new file." 51 | 52 | # Add an address. 53 | PromptForAddress(address_book.person.add()) 54 | 55 | # Write the new address book back to disk. 56 | f = open(sys.argv[1], "wb") 57 | f.write(address_book.SerializeToString()) 58 | f.close() 59 | -------------------------------------------------------------------------------- /compiler/examples/addressbook.proto: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | package tutorial; 4 | 5 | option java_package = "com.example.tutorial"; 6 | option java_outer_classname = "AddressBookProtos"; 7 | 8 | message Person { 9 | required string name = 1; 10 | required int32 id = 2; // Unique ID number for this person. 11 | optional string email = 3; 12 | 13 | enum PhoneType { 14 | MOBILE = 0; 15 | HOME = 1; 16 | WORK = 2; 17 | } 18 | 19 | message PhoneNumber { 20 | required string number = 1; 21 | optional PhoneType type = 2 [default = HOME]; 22 | } 23 | 24 | repeated PhoneNumber phone = 4; 25 | } 26 | 27 | // Our address book file is just one of these. 28 | message AddressBook { 29 | repeated Person person = 1; 30 | } 31 | -------------------------------------------------------------------------------- /compiler/examples/list_people.cc: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | 3 | #include 4 | #include 5 | #include 6 | #include "addressbook.pb.h" 7 | using namespace std; 8 | 9 | // Iterates though all people in the AddressBook and prints info about them. 10 | void ListPeople(const tutorial::AddressBook& address_book) { 11 | for (int i = 0; i < address_book.person_size(); i++) { 12 | const tutorial::Person& person = address_book.person(i); 13 | 14 | cout << "Person ID: " << person.id() << endl; 15 | cout << " Name: " << person.name() << endl; 16 | if (person.has_email()) { 17 | cout << " E-mail address: " << person.email() << endl; 18 | } 19 | 20 | for (int j = 0; j < person.phone_size(); j++) { 21 | const tutorial::Person::PhoneNumber& phone_number = person.phone(j); 22 | 23 | switch (phone_number.type()) { 24 | case tutorial::Person::MOBILE: 25 | cout << " Mobile phone #: "; 26 | break; 27 | case tutorial::Person::HOME: 28 | cout << " Home phone #: "; 29 | break; 30 | case tutorial::Person::WORK: 31 | cout << " Work phone #: "; 32 | break; 33 | } 34 | cout << phone_number.number() << endl; 35 | } 36 | } 37 | } 38 | 39 | // Main function: Reads the entire address book from a file and prints all 40 | // the information inside. 41 | int main(int argc, char* argv[]) { 42 | // Verify that the version of the library that we linked against is 43 | // compatible with the version of the headers we compiled against. 44 | GOOGLE_PROTOBUF_VERIFY_VERSION; 45 | 46 | if (argc != 2) { 47 | cerr << "Usage: " << argv[0] << " ADDRESS_BOOK_FILE" << endl; 48 | return -1; 49 | } 50 | 51 | tutorial::AddressBook address_book; 52 | 53 | { 54 | // Read the existing address book. 55 | fstream input(argv[1], ios::in | ios::binary); 56 | if (!address_book.ParseFromIstream(&input)) { 57 | cerr << "Failed to parse address book." << endl; 58 | return -1; 59 | } 60 | } 61 | 62 | ListPeople(address_book); 63 | 64 | // Optional: Delete all global objects allocated by libprotobuf. 65 | google::protobuf::ShutdownProtobufLibrary(); 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /compiler/examples/list_people.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # See README.txt for information and build instructions. 4 | 5 | import addressbook_pb2 6 | import sys 7 | 8 | # Iterates though all people in the AddressBook and prints info about them. 9 | def ListPeople(address_book): 10 | for person in address_book.person: 11 | print "Person ID:", person.id 12 | print " Name:", person.name 13 | if person.HasField('email'): 14 | print " E-mail address:", person.email 15 | 16 | for phone_number in person.phone: 17 | if phone_number.type == addressbook_pb2.Person.MOBILE: 18 | print " Mobile phone #:", 19 | elif phone_number.type == addressbook_pb2.Person.HOME: 20 | print " Home phone #:", 21 | elif phone_number.type == addressbook_pb2.Person.WORK: 22 | print " Work phone #:", 23 | print phone_number.number 24 | 25 | # Main procedure: Reads the entire address book from a file and prints all 26 | # the information inside. 27 | if len(sys.argv) != 2: 28 | print "Usage:", sys.argv[0], "ADDRESS_BOOK_FILE" 29 | sys.exit(-1) 30 | 31 | address_book = addressbook_pb2.AddressBook() 32 | 33 | # Read the existing address book. 34 | f = open(sys.argv[1], "rb") 35 | address_book.ParseFromString(f.read()) 36 | f.close() 37 | 38 | ListPeople(address_book) 39 | -------------------------------------------------------------------------------- /compiler/generate_descriptor_proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script to regenerate descriptor.pb.{h,cc} after the protocol 4 | # compiler changes. Since these files are compiled into the protocol compiler 5 | # itself, they cannot be generated automatically by a make rule. "make check" 6 | # will fail if these files do not match what the protocol compiler would 7 | # generate. 8 | # 9 | # HINT: Flags passed to generate_descriptor_proto.sh will be passed directly 10 | # to make when building protoc. This is particularly useful for passing 11 | # -j4 to run 4 jobs simultaneously. 12 | 13 | if test ! -e src/google/protobuf/stubs/common.h; then 14 | cat >&2 << __EOF__ 15 | Could not find source code. Make sure you are running this script from the 16 | root of the distribution tree. 17 | __EOF__ 18 | exit 1 19 | fi 20 | 21 | if test ! -e src/Makefile; then 22 | cat >&2 << __EOF__ 23 | Could not find src/Makefile. You must run ./configure (and perhaps 24 | ./autogen.sh) first. 25 | __EOF__ 26 | exit 1 27 | fi 28 | 29 | cd src 30 | make $@ protoc && ./protoc --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:. google/protobuf/descriptor.proto 31 | cd .. 32 | -------------------------------------------------------------------------------- /compiler/gtest/CHANGES: -------------------------------------------------------------------------------- 1 | Changes for 1.3.0: 2 | 3 | * New feature: death tests on Windows, Cygwin, and Mac. 4 | * New feature: ability to use Google Test assertions in other testing 5 | frameworks. 6 | * New feature: ability to run disabled test via 7 | --gtest_also_run_disabled_tests. 8 | * New feature: the --help flag for printing the usage. 9 | * New feature: access to Google Test flag values in user code. 10 | * New feature: a script that packs Google Test into one .h and one 11 | .cc file for easy deployment. 12 | * New feature: support for distributing test functions to multiple 13 | machines (requires support from the test runner). 14 | * Bug fixes and implementation clean-up. 15 | 16 | Changes for 1.2.1: 17 | 18 | * Compatibility fixes for Linux IA-64 and IBM z/OS. 19 | * Added support for using Boost and other TR1 implementations. 20 | * Changes to the build scripts to support upcoming release of Google C++ 21 | Mocking Framework. 22 | * Added Makefile to the distribution package. 23 | * Improved build instructions in README. 24 | 25 | Changes for 1.2.0: 26 | 27 | * New feature: value-parameterized tests. 28 | * New feature: the ASSERT/EXPECT_(NON)FATAL_FAILURE(_ON_ALL_THREADS) 29 | macros. 30 | * Changed the XML report format to match JUnit/Ant's. 31 | * Added tests to the Xcode project. 32 | * Added scons/SConscript for building with SCons. 33 | * Added src/gtest-all.cc for building Google Test from a single file. 34 | * Fixed compatibility with Solaris and z/OS. 35 | * Enabled running Python tests on systems with python 2.3 installed, 36 | e.g. Mac OS X 10.4. 37 | * Bug fixes. 38 | 39 | Changes for 1.1.0: 40 | 41 | * New feature: type-parameterized tests. 42 | * New feature: exception assertions. 43 | * New feature: printing elapsed time of tests. 44 | * Improved the robustness of death tests. 45 | * Added an Xcode project and samples. 46 | * Adjusted the output format on Windows to be understandable by Visual Studio. 47 | * Minor bug fixes. 48 | 49 | Changes for 1.0.1: 50 | 51 | * Added project files for Visual Studio 7.1. 52 | * Fixed issues with compiling on Mac OS X. 53 | * Fixed issues with compiling on Cygwin. 54 | 55 | Changes for 1.0.0: 56 | 57 | * Initial Open Source release of Google Test 58 | -------------------------------------------------------------------------------- /compiler/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Jeffrey Yasskin 15 | Jói Sigurðsson 16 | Keir Mierle 17 | Keith Ray 18 | Kenton Varda 19 | Markus Heule 20 | Mika Raento 21 | Patrick Hanna 22 | Patrick Riley 23 | Peter Kaminski 24 | Preston Jackson 25 | Rainer Klaffenboeck 26 | Russ Cox 27 | Russ Rufer 28 | Sean Mcafee 29 | Sigurður Ásgeirsson 30 | Tracy Bialik 31 | Vadim Berman 32 | Vlad Losev 33 | Zhanyong Wan 34 | -------------------------------------------------------------------------------- /compiler/gtest/COPYING: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /compiler/gtest/build-aux/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for build-aux/config.h 2 | -------------------------------------------------------------------------------- /compiler/gtest/codegear/gtest.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {c1d923e0-6cba-4332-9b6f-3420acbf5091} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Default.Personality 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /compiler/gtest/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /compiler/gtest/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /compiler/gtest/configure.ac: -------------------------------------------------------------------------------- 1 | m4_include(m4/acx_pthread.m4) 2 | 3 | # At this point, the Xcode project assumes the version string will be three 4 | # integers separated by periods and surrounded by square brackets (e.g. 5 | # "[1.0.1]"). It also asumes that there won't be any closing parenthesis 6 | # between "AC_INIT(" and the closing ")" including comments and strings. 7 | AC_INIT([Google C++ Testing Framework], 8 | [1.3.0], 9 | [googletestframework@googlegroups.com], 10 | [gtest]) 11 | 12 | # Provide various options to initialize the Autoconf and configure processes. 13 | AC_PREREQ([2.59]) 14 | AC_CONFIG_SRCDIR([./COPYING]) 15 | AC_CONFIG_AUX_DIR([build-aux]) 16 | AC_CONFIG_HEADERS([build-aux/config.h]) 17 | AC_CONFIG_FILES([Makefile]) 18 | AC_CONFIG_FILES([scripts/gtest-config], [chmod +x scripts/gtest-config]) 19 | 20 | # Initialize Automake with various options. We require at least v1.9, prevent 21 | # pedantic complaints about package files, and enable various distribution 22 | # targets. 23 | AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects]) 24 | 25 | # Check for programs used in building Google Test. 26 | AC_PROG_CC 27 | AC_PROG_CXX 28 | AC_LANG([C++]) 29 | AC_PROG_LIBTOOL 30 | 31 | # TODO(chandlerc@google.com): Currently we aren't running the Python tests 32 | # against the interpreter detected by AM_PATH_PYTHON, and so we condition 33 | # HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's 34 | # version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env" 35 | # hashbang. 36 | PYTHON= # We *do not* allow the user to specify a python interpreter 37 | AC_PATH_PROG([PYTHON],[python],[:]) 38 | AS_IF([test "$PYTHON" != ":"], 39 | [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])]) 40 | AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"]) 41 | 42 | # Check for pthreads. 43 | ACX_PTHREAD 44 | 45 | # TODO(chandlerc@google.com) Check for the necessary system headers. 46 | 47 | # TODO(chandlerc@google.com) Check the types, structures, and other compiler 48 | # and architecture characteristics. 49 | 50 | # Output the generated files. No further autoconf macros may be used. 51 | AC_OUTPUT 52 | -------------------------------------------------------------------------------- /compiler/gtest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample1.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample1_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample2.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample2_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample3_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample4.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample4_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample5_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample6_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample7_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/.deps/sample8_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 35 | #define GTEST_SAMPLES_SAMPLE1_H_ 36 | 37 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 38 | int Factorial(int n); 39 | 40 | // Returns true iff n is a prime number. 41 | bool IsPrime(int n); 42 | 43 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 44 | -------------------------------------------------------------------------------- /compiler/gtest/samples/sample2.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include "sample2.h" 35 | 36 | #include 37 | 38 | // Clones a 0-terminated C string, allocating memory using new. 39 | const char * MyString::CloneCString(const char * c_string) { 40 | if (c_string == NULL) return NULL; 41 | 42 | const size_t len = strlen(c_string); 43 | char * const clone = new char[ len + 1 ]; 44 | memcpy(clone, c_string, len + 1); 45 | 46 | return clone; 47 | } 48 | 49 | // Sets the 0-terminated C string this MyString object 50 | // represents. 51 | void MyString::Set(const char * c_string) { 52 | // Makes sure this works when c_string == c_string_ 53 | const char * const temp = MyString::CloneCString(c_string); 54 | delete[] c_string_; 55 | c_string_ = temp; 56 | } 57 | -------------------------------------------------------------------------------- /compiler/gtest/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include 35 | 36 | #include "sample4.h" 37 | 38 | // Returns the current counter value, and increments it. 39 | int Counter::Increment() { 40 | return counter_++; 41 | } 42 | 43 | // Prints the current counter value to STDOUT. 44 | void Counter::Print() const { 45 | printf("%d", counter_); 46 | } 47 | -------------------------------------------------------------------------------- /compiler/gtest/samples/sample4.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 35 | #define GTEST_SAMPLES_SAMPLE4_H_ 36 | 37 | // A simple monotonic counter. 38 | class Counter { 39 | private: 40 | int counter_; 41 | 42 | public: 43 | // Creates a counter that starts at 0. 44 | Counter() : counter_(0) {} 45 | 46 | // Returns the current counter value, and increments it. 47 | int Increment(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /compiler/gtest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | #include "sample4.h" 34 | 35 | // Tests the Increment() method. 36 | TEST(Counter, Increment) { 37 | Counter c; 38 | 39 | // EXPECT_EQ() evaluates its arguments exactly once, so they 40 | // can have side effects. 41 | 42 | EXPECT_EQ(0, c.Increment()); 43 | EXPECT_EQ(1, c.Increment()); 44 | EXPECT_EQ(2, c.Increment()); 45 | } 46 | -------------------------------------------------------------------------------- /compiler/gtest/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | CPPFLAGS += -I$(FUSED_GTEST_DIR) 25 | 26 | # Flags passed to the C++ compiler. 27 | CXXFLAGS += -g 28 | 29 | all : sample1_unittest 30 | 31 | check : all 32 | ./sample1_unittest 33 | 34 | clean : 35 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 36 | 37 | $(FUSED_GTEST_H) : 38 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 39 | 40 | $(FUSED_GTEST_ALL_CC) : 41 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 42 | 43 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 44 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 45 | 46 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 47 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 48 | 49 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 50 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 51 | 52 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 53 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 54 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 55 | 56 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 57 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 58 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest-death-test.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest-filepath.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest-port.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest-test-part.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest-typed-test.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/gtest_main.Plo: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_no_rtti_test-gtest-all.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_no_rtti_test-gtest_main.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_throw_on_failure_ex_test-gtest-all.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_throw_on_failure_test_-gtest-all.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_tuple_test-gtest-all.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_tuple_test-gtest_main.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/.deps/test_gtest_use_own_tuple_test-gtest-all.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | #include "src/gtest.cc" 37 | #include "src/gtest-death-test.cc" 38 | #include "src/gtest-filepath.cc" 39 | #include "src/gtest-port.cc" 40 | #include "src/gtest-test-part.cc" 41 | #include "src/gtest-typed-test.cc" 42 | -------------------------------------------------------------------------------- /compiler/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include 33 | 34 | int main(int argc, char **argv) { 35 | std::cout << "Running main() from gtest_main.cc\n"; 36 | 37 | testing::InitGoogleTest(&argc, argv); 38 | return RUN_ALL_TESTS(); 39 | } 40 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-filepath_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-linked_ptr_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-message_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-options_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-param-test2_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-param-test_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-port_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-test-part_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-typed-test2_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-typed-test_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest-unittest-api_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_break_on_failure_unittest_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_color_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_env_var_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_environment_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_filter_unittest_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_help_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_list_tests_unittest_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_main_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_no_test_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_output_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_pred_impl_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_prod_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_repeat_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_sole_header_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_stress_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_uninitialized_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_xml_outfile1_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_xml_outfile2_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/gtest_xml_output_unittest_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/production.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_death_test_test-gtest-death-test_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_no_rtti_test-gtest_unittest.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_throw_on_failure_ex_test-gtest_throw_on_failure_ex_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_throw_on_failure_test_-gtest_throw_on_failure_test_.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_tuple_test-gtest-tuple_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_use_own_tuple_test-gtest-param-test2_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/.deps/test_gtest_use_own_tuple_test-gtest-param-test_test.Po: -------------------------------------------------------------------------------- 1 | # dummy 2 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest-param-test_test.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Authors: vladl@google.com (Vlad Losev) 31 | // 32 | // The Google C++ Testing Framework (Google Test) 33 | // 34 | // This header file provides classes and functions used internally 35 | // for testing Google Test itself. 36 | 37 | #ifndef GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 38 | #define GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 39 | 40 | #include 41 | 42 | #if GTEST_HAS_PARAM_TEST 43 | 44 | // Test fixture for testing definition and instantiation of a test 45 | // in separate translation units. 46 | class ExternalInstantiationTest : public ::testing::TestWithParam {}; 47 | 48 | // Test fixture for testing instantiation of a test in multiple 49 | // translation units. 50 | class InstantiationInMultipleTranslaionUnitsTest 51 | : public ::testing::TestWithParam {}; 52 | 53 | #endif // GTEST_HAS_PARAM_TEST 54 | 55 | #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ 56 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | 34 | #include "test/gtest-typed-test_test.h" 35 | #include 36 | 37 | #if GTEST_HAS_TYPED_TEST_P 38 | 39 | // Tests that the same type-parameterized test case can be 40 | // instantiated in different translation units linked together. 41 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 42 | INSTANTIATE_TYPED_TEST_CASE_P(Vector, ContainerTest, 43 | testing::Types >); 44 | 45 | #endif // GTEST_HAS_TYPED_TEST_P 46 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_all_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Tests for Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build most of Google Test's own tests 35 | // by compiling a single file. This file serves this purpose. 36 | #include "test/gtest-filepath_test.cc" 37 | #include "test/gtest-linked_ptr_test.cc" 38 | #include "test/gtest-message_test.cc" 39 | #include "test/gtest-options_test.cc" 40 | #include "test/gtest-port_test.cc" 41 | #include "test/gtest_pred_impl_unittest.cc" 42 | #include "test/gtest_prod_test.cc" 43 | #include "test/gtest-test-part_test.cc" 44 | #include "test/gtest-typed-test_test.cc" 45 | #include "test/gtest-typed-test2_test.cc" 46 | #include "test/gtest_unittest.cc" 47 | #include "test/production.cc" 48 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | // This program is meant to be run by gtest_help_test.py. Do not run 33 | // it directly. 34 | 35 | #include 36 | 37 | // When a help flag is specified, this program should skip the tests 38 | // and exit with 0; otherwise the following test will be executed, 39 | // causing this program to exit with a non-zero code. 40 | TEST(HelpFlagTest, ShouldNotBeRun) { 41 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 42 | } 43 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | 34 | // Tests that we don't have to define main() when we link to 35 | // gtest_main instead of gtest. 36 | 37 | namespace { 38 | 39 | TEST(GTestMainTest, ShouldSucceed) { 40 | } 41 | 42 | } // namespace 43 | 44 | // We are using the main() function defined in src/gtest_main.cc, so 45 | // we don't define it here. 46 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_no_test_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Tests that a Google Test program that has no test defined can run 31 | // successfully. 32 | // 33 | // Author: wan@google.com (Zhanyong Wan) 34 | 35 | #include 36 | 37 | 38 | int main(int argc, char **argv) { 39 | testing::InitGoogleTest(&argc, argv); 40 | 41 | // An ad-hoc assertion outside of all tests. 42 | // 43 | // This serves two purposes: 44 | // 45 | // 1. It verifies that an ad-hoc assertion can be executed even if 46 | // no test is defined. 47 | // 2. We had a bug where the XML output won't be generated if an 48 | // assertion is executed before RUN_ALL_TESTS() is called, even 49 | // though --gtest_output=xml is specified. This makes sure the 50 | // bug is fixed and doesn't regress. 51 | EXPECT_EQ(1, 1); 52 | 53 | return RUN_ALL_TESTS(); 54 | } 55 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_prod_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Unit test for include/gtest/gtest_prod.h. 33 | 34 | #include 35 | #include "test/production.h" 36 | 37 | // Tests that private members can be accessed from a TEST declared as 38 | // a friend of the class. 39 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 40 | PrivateCode a; 41 | EXPECT_EQ(0, a.x_); 42 | 43 | a.set_x(1); 44 | EXPECT_EQ(1, a.x_); 45 | } 46 | 47 | typedef testing::Test PrivateCodeFixtureTest; 48 | 49 | // Tests that private members can be accessed from a TEST_F declared 50 | // as a friend of the class. 51 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 52 | PrivateCode a; 53 | EXPECT_EQ(0, a.x_); 54 | 55 | a.set_x(2); 56 | EXPECT_EQ(2, a.x_); 57 | } 58 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_sole_header_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // This test verifies that it's possible to use Google Test by including 33 | // the gtest.h header file alone. 34 | 35 | #include 36 | 37 | namespace { 38 | 39 | void Subroutine() { 40 | EXPECT_EQ(42, 42); 41 | } 42 | 43 | TEST(NoFatalFailureTest, ExpectNoFatalFailure) { 44 | EXPECT_NO_FATAL_FAILURE(;); 45 | EXPECT_NO_FATAL_FAILURE(SUCCEED()); 46 | EXPECT_NO_FATAL_FAILURE(Subroutine()); 47 | EXPECT_NO_FATAL_FAILURE({ SUCCEED(); }); 48 | } 49 | 50 | TEST(NoFatalFailureTest, AssertNoFatalFailure) { 51 | ASSERT_NO_FATAL_FAILURE(;); 52 | ASSERT_NO_FATAL_FAILURE(SUCCEED()); 53 | ASSERT_NO_FATAL_FAILURE(Subroutine()); 54 | ASSERT_NO_FATAL_FAILURE({ SUCCEED(); }); 55 | } 56 | 57 | } // namespace 58 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_uninitialized_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include 33 | 34 | TEST(DummyTest, Dummy) { 35 | // This test doesn't verify anything. We just need it to create a 36 | // realistic stage for testing the behavior of Google Test when 37 | // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being 38 | // called first. 39 | } 40 | 41 | int main() { 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include 36 | 37 | class PropertyOne : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 1); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 1); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyOne, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 1); 49 | } 50 | -------------------------------------------------------------------------------- /compiler/gtest/test/gtest_xml_outfile2_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: keith.ray@gmail.com (Keith Ray) 31 | // 32 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 33 | // gtest_xml_outfiles_test.py 34 | 35 | #include 36 | 37 | class PropertyTwo : public testing::Test { 38 | protected: 39 | virtual void SetUp() { 40 | RecordProperty("SetUpProp", 2); 41 | } 42 | virtual void TearDown() { 43 | RecordProperty("TearDownProp", 2); 44 | } 45 | }; 46 | 47 | TEST_F(PropertyTwo, TestSomeProperties) { 48 | RecordProperty("TestSomeProperty", 2); 49 | } 50 | -------------------------------------------------------------------------------- /compiler/gtest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /compiler/gtest/test/production.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #ifndef GTEST_TEST_PRODUCTION_H_ 35 | #define GTEST_TEST_PRODUCTION_H_ 36 | 37 | #include 38 | 39 | class PrivateCode { 40 | public: 41 | // Declares a friend test that does not use a fixture. 42 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 43 | 44 | // Declares a friend test that uses a fixture. 45 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 46 | 47 | PrivateCode(); 48 | 49 | int x() const { return x_; } 50 | private: 51 | void set_x(int x) { x_ = x; } 52 | int x_; 53 | }; 54 | 55 | #endif // GTEST_TEST_PRODUCTION_H_ 56 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Installation Directory 17 | INSTALL_PATH = @loader_path/../Frameworks 18 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/InternalPythonTestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // InternalPythonTestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME)_ 8 | HEADER_SEARCH_PATHS = ../ ../include 9 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/InternalTestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // InternalTestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../ ../include 9 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Samples/FrameworkSample/widget.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.cc 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest 37 | 38 | #include "widget.h" 39 | 40 | Widget::Widget(int number, const std::string& name) 41 | : number_(number), 42 | name_(name) {} 43 | 44 | Widget::~Widget() {} 45 | 46 | float Widget::GetFloatValue() const { 47 | return number_; 48 | } 49 | 50 | int Widget::GetIntValue() const { 51 | return static_cast(number_); 52 | } 53 | 54 | std::string Widget::GetStringValue() const { 55 | return name_; 56 | } 57 | 58 | void Widget::GetCharPtrValue(char* buffer, size_t max_size) const { 59 | // Copy the char* representation of name_ into buffer, up to max_size. 60 | strncpy(buffer, name_.c_str(), max_size-1); 61 | buffer[max_size-1] = '\0'; 62 | return; 63 | } 64 | -------------------------------------------------------------------------------- /compiler/gtest/xcode/Samples/FrameworkSample/widget.h: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: preston.jackson@gmail.com (Preston Jackson) 31 | // 32 | // Google Test - FrameworkSample 33 | // widget.h 34 | // 35 | 36 | // Widget is a very simple class used for demonstrating the use of gtest. It 37 | // simply stores two values a string and an integer, which are returned via 38 | // public accessors in multiple forms. 39 | 40 | #import 41 | 42 | class Widget { 43 | public: 44 | Widget(int number, const std::string& name); 45 | ~Widget(); 46 | 47 | // Public accessors to number data 48 | float GetFloatValue() const; 49 | int GetIntValue() const; 50 | 51 | // Public accessors to the string data 52 | std::string GetStringValue() const; 53 | void GetCharPtrValue(char* buffer, size_t max_size) const; 54 | 55 | private: 56 | // Data members 57 | float number_; 58 | std::string name_; 59 | }; 60 | -------------------------------------------------------------------------------- /compiler/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package com.google.protobuf; 32 | 33 | /** 34 | *

Abstract interface for a blocking RPC channel. {@code BlockingRpcChannel} 35 | * is the blocking equivalent to {@link RpcChannel}. 36 | * 37 | * @author kenton@google.com Kenton Varda 38 | * @author cpovirk@google.com Chris Povirk 39 | */ 40 | public interface BlockingRpcChannel { 41 | /** 42 | * Call the given method of the remote service and blocks until it returns. 43 | * {@code callBlockingMethod()} is the blocking equivalent to 44 | * {@link RpcChannel#callMethod}. 45 | */ 46 | Message callBlockingMethod( 47 | Descriptors.MethodDescriptor method, 48 | RpcController controller, 49 | Message request, 50 | Message responsePrototype) throws ServiceException; 51 | } 52 | -------------------------------------------------------------------------------- /compiler/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package com.google.protobuf; 32 | 33 | import com.google.protobuf.Descriptors.EnumDescriptor; 34 | import com.google.protobuf.Descriptors.EnumValueDescriptor; 35 | 36 | /** 37 | * Interface of useful methods added to all enums generated by the protocol 38 | * compiler. 39 | */ 40 | public interface ProtocolMessageEnum extends Internal.EnumLite { 41 | 42 | /** 43 | * Return the value's numeric value as defined in the .proto file. 44 | */ 45 | int getNumber(); 46 | 47 | /** 48 | * Return the value's descriptor, which contains information such as 49 | * value name, number, and type. 50 | */ 51 | EnumValueDescriptor getValueDescriptor(); 52 | 53 | /** 54 | * Return the enum type's descriptor, which contains information 55 | * about each defined value, etc. 56 | */ 57 | EnumDescriptor getDescriptorForType(); 58 | } 59 | -------------------------------------------------------------------------------- /compiler/java/src/main/java/com/google/protobuf/RpcCallback.java: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package com.google.protobuf; 32 | 33 | /** 34 | * Interface for an RPC callback, normally called when an RPC completes. 35 | * {@code ParameterType} is normally the method's response message type. 36 | * 37 | * @author kenton@google.com Kenton Varda 38 | */ 39 | public interface RpcCallback { 40 | void run(ParameterType parameter); 41 | } 42 | -------------------------------------------------------------------------------- /compiler/java/src/main/java/com/google/protobuf/ServiceException.java: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package com.google.protobuf; 32 | 33 | /** 34 | * Thrown by blocking RPC methods when a failure occurs. 35 | * 36 | * @author cpovirk@google.com (Chris Povirk) 37 | */ 38 | public final class ServiceException extends Exception { 39 | private static final long serialVersionUID = -1219262335729891920L; 40 | 41 | public ServiceException(final String message) { 42 | super(message); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /compiler/java/src/test/java/com/google/protobuf/multiple_files_test.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // 33 | // A proto file which tests the java_multiple_files option. 34 | 35 | 36 | import "google/protobuf/unittest.proto"; 37 | 38 | package protobuf_unittest; 39 | 40 | option java_multiple_files = true; 41 | option java_outer_classname = "MultipleFilesTestProto"; 42 | 43 | message MessageWithNoOuter { 44 | message NestedMessage { 45 | optional int32 i = 1; 46 | } 47 | enum NestedEnum { 48 | BAZ = 3; 49 | } 50 | optional NestedMessage nested = 1; 51 | repeated TestAllTypes foreign = 2; 52 | optional NestedEnum nested_enum = 3; 53 | optional EnumWithNoOuter foreign_enum = 4; 54 | } 55 | 56 | enum EnumWithNoOuter { 57 | FOO = 1; 58 | BAR = 2; 59 | } 60 | 61 | service ServiceWithNoOuter { 62 | rpc Foo(MessageWithNoOuter) returns(TestAllTypes); 63 | } 64 | 65 | extend TestAllExtensions { 66 | optional int32 extension_with_outer = 1234567; 67 | } 68 | -------------------------------------------------------------------------------- /compiler/m4/ac_system_extensions.m4: -------------------------------------------------------------------------------- 1 | dnl Provide AC_USE_SYSTEM_EXTENSIONS for old autoconf machines. 2 | AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],[ 3 | ifdef([AC_USE_SYSTEM_EXTENSIONS],[ 4 | AC_USE_SYSTEM_EXTENSIONS 5 | ],[ 6 | AC_BEFORE([$0], [AC_COMPILE_IFELSE]) 7 | AC_BEFORE([$0], [AC_RUN_IFELSE]) 8 | 9 | AC_REQUIRE([AC_GNU_SOURCE]) 10 | AC_REQUIRE([AC_AIX]) 11 | AC_REQUIRE([AC_MINIX]) 12 | 13 | AH_VERBATIM([__EXTENSIONS__], 14 | [/* Enable extensions on Solaris. */ 15 | #ifndef __EXTENSIONS__ 16 | # undef __EXTENSIONS__ 17 | #endif 18 | #ifndef _POSIX_PTHREAD_SEMANTICS 19 | # undef _POSIX_PTHREAD_SEMANTICS 20 | #endif 21 | #ifndef _TANDEM_SOURCE 22 | # undef _TANDEM_SOURCE 23 | #endif]) 24 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 25 | [ac_cv_safe_to_define___extensions__], 26 | [AC_COMPILE_IFELSE( 27 | [AC_LANG_PROGRAM([ 28 | # define __EXTENSIONS__ 1 29 | AC_INCLUDES_DEFAULT])], 30 | [ac_cv_safe_to_define___extensions__=yes], 31 | [ac_cv_safe_to_define___extensions__=no])]) 32 | test $ac_cv_safe_to_define___extensions__ = yes && 33 | AC_DEFINE([__EXTENSIONS__]) 34 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 35 | AC_DEFINE([_TANDEM_SOURCE]) 36 | ]) 37 | ]) 38 | -------------------------------------------------------------------------------- /compiler/m4/stl_hash.m4: -------------------------------------------------------------------------------- 1 | # We check two things: where the include file is for hash_map, and 2 | # what namespace hash_map lives in within that include file. We 3 | # include AC_TRY_COMPILE for all the combinations we've seen in the 4 | # wild. We define one of HAVE_HASH_MAP or HAVE_EXT_HASH_MAP depending 5 | # on location, and HASH_NAMESPACE to be the namespace hash_map is 6 | # defined in. 7 | # 8 | # Ideally we'd use AC_CACHE_CHECK, but that only lets us store one value 9 | # at a time, and we need to store two (filename and namespace). 10 | # prints messages itself, so we have to do the message-printing ourselves 11 | # via AC_MSG_CHECKING + AC_MSG_RESULT. (TODO(csilvers): can we cache?) 12 | 13 | AC_DEFUN([AC_CXX_STL_HASH], 14 | [AC_MSG_CHECKING(the location of hash_map) 15 | AC_LANG_SAVE 16 | AC_LANG_CPLUSPLUS 17 | ac_cv_cxx_hash_map="" 18 | for location in ext/hash_map hash_map; do 19 | for namespace in __gnu_cxx "" std stdext; do 20 | if test -z "$ac_cv_cxx_hash_map"; then 21 | AC_TRY_COMPILE([#include <$location>], 22 | [${namespace}::hash_map t], 23 | [ac_cv_cxx_hash_map="<$location>"; 24 | ac_cv_cxx_hash_namespace="$namespace";]) 25 | fi 26 | done 27 | done 28 | ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`; 29 | if test -n "$ac_cv_cxx_hash_map"; then 30 | AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map]) 31 | AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set]) 32 | AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map, 33 | [the location of ]) 34 | AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set, 35 | [the location of ]) 36 | AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace, 37 | [the namespace of hash_map/hash_set]) 38 | AC_MSG_RESULT([$ac_cv_cxx_hash_map]) 39 | else 40 | AC_MSG_RESULT() 41 | AC_MSG_WARN([could not find an STL hash_map]) 42 | fi 43 | ]) 44 | -------------------------------------------------------------------------------- /compiler/protobuf-lite.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: 2.2.0 9 | Libs: -L${libdir} -lprotobuf-lite -D_THREAD_SAFE 10 | Cflags: -I${includedir} -D_THREAD_SAFE 11 | # Commented out because it crashes pkg-config *sigh*: 12 | # http://bugs.freedesktop.org/show_bug.cgi?id=13265 13 | # Conflicts: protobuf 14 | -------------------------------------------------------------------------------- /compiler/protobuf-lite.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lprotobuf-lite @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 10 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 11 | # Commented out because it crashes pkg-config *sigh*: 12 | # http://bugs.freedesktop.org/show_bug.cgi?id=13265 13 | # Conflicts: protobuf 14 | -------------------------------------------------------------------------------- /compiler/protobuf.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: 2.2.0 9 | Libs: -L${libdir} -lprotobuf -lz -D_THREAD_SAFE 10 | Cflags: -I${includedir} -D_THREAD_SAFE 11 | # Commented out because it crashes pkg-config *sigh*: 12 | # http://bugs.freedesktop.org/show_bug.cgi?id=13265 13 | # Conflicts: protobuf-lite 14 | -------------------------------------------------------------------------------- /compiler/protobuf.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Protocol Buffers 7 | Description: Google's Data Interchange Format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lprotobuf @LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ 10 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 11 | # Commented out because it crashes pkg-config *sigh*: 12 | # http://bugs.freedesktop.org/show_bug.cgi?id=13265 13 | # Conflicts: protobuf-lite 14 | -------------------------------------------------------------------------------- /compiler/python/README.txt: -------------------------------------------------------------------------------- 1 | Protocol Buffers - Google's data interchange format 2 | Copyright 2008 Google Inc. 3 | 4 | This directory contains the Python Protocol Buffers runtime library. 5 | 6 | Normally, this directory comes as part of the protobuf package, available 7 | from: 8 | 9 | http://code.google.com/p/protobuf 10 | 11 | The complete package includes the C++ source code, which includes the 12 | Protocol Compiler (protoc). If you downloaded this package from PyPI 13 | or some other Python-specific source, you may have received only the 14 | Python part of the code. In this case, you will need to obtain the 15 | Protocol Compiler from some other source before you can use this 16 | package. 17 | 18 | Development Warning 19 | =================== 20 | 21 | The Python implementation of Protocol Buffers is not as mature as the C++ 22 | and Java implementations. It may be more buggy, and it is known to be 23 | pretty slow at this time. If you would like to help fix these issues, 24 | join the Protocol Buffers discussion list and let us know! 25 | 26 | Installation 27 | ============ 28 | 29 | 1) Make sure you have Python 2.4 or newer. If in doubt, run: 30 | 31 | $ python -V 32 | 33 | 2) If you do not have setuptools installed, note that it will be 34 | downloaded and installed automatically as soon as you run setup.py. 35 | If you would rather install it manually, you may do so by following 36 | the instructions on this page: 37 | 38 | http://peak.telecommunity.com/DevCenter/EasyInstall#installation-instructions 39 | 40 | 3) Build the C++ code, or install a binary distribution of protoc. If 41 | you install a binary distribution, make sure that it is the same 42 | version as this package. If in doubt, run: 43 | 44 | $ protoc --version 45 | 46 | 4) Run the tests: 47 | 48 | $ python setup.py test 49 | 50 | If some tests fail, this library may not work correctly on your 51 | system. Continue at your own risk. 52 | 53 | Please note that there is a known problem with some versions of 54 | Python on Cygwin which causes the tests to fail after printing the 55 | error: "sem_init: Resource temporarily unavailable". This appears 56 | to be a bug either in Cygwin or in Python: 57 | http://www.cygwin.com/ml/cygwin/2005-07/msg01378.html 58 | We do not know if or when it might me fixed. We also do not know 59 | how likely it is that this bug will affect users in practice. 60 | 61 | 5) Install: 62 | 63 | $ python setup.py install 64 | 65 | This step may require superuser privileges. 66 | 67 | Usage 68 | ===== 69 | 70 | The complete documentation for Protocol Buffers is available via the 71 | web at: 72 | 73 | http://code.google.com/apis/protocolbuffers/ 74 | -------------------------------------------------------------------------------- /compiler/python/google/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /compiler/python/google/protobuf/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mingchen/protobuf-ios/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/__init__.py -------------------------------------------------------------------------------- /compiler/python/google/protobuf/internal/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mingchen/protobuf-ios/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/internal/__init__.py -------------------------------------------------------------------------------- /compiler/python/google/protobuf/internal/message_test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | # 3 | # Protocol Buffers - Google's data interchange format 4 | # Copyright 2008 Google Inc. All rights reserved. 5 | # http://code.google.com/p/protobuf/ 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above 14 | # copyright notice, this list of conditions and the following disclaimer 15 | # in the documentation and/or other materials provided with the 16 | # distribution. 17 | # * Neither the name of Google Inc. nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | """Tests python protocol buffers against the golden message.""" 34 | 35 | __author__ = 'gps@google.com (Gregory P. Smith)' 36 | 37 | import unittest 38 | from google.protobuf import unittest_import_pb2 39 | from google.protobuf import unittest_pb2 40 | from google.protobuf.internal import test_util 41 | 42 | 43 | class MessageTest(test_util.GoldenMessageTestCase): 44 | 45 | def testGoldenMessage(self): 46 | golden_data = test_util.GoldenFile('golden_message').read() 47 | golden_message = unittest_pb2.TestAllTypes() 48 | golden_message.ParseFromString(golden_data) 49 | self.ExpectAllFieldsSet(golden_message) 50 | 51 | 52 | if __name__ == '__main__': 53 | unittest.main() 54 | -------------------------------------------------------------------------------- /compiler/python/google/protobuf/internal/more_extensions.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: robinson@google.com (Will Robinson) 32 | 33 | 34 | package google.protobuf.internal; 35 | 36 | 37 | message TopLevelMessage { 38 | optional ExtendedMessage submessage = 1; 39 | } 40 | 41 | 42 | message ExtendedMessage { 43 | extensions 1 to max; 44 | } 45 | 46 | 47 | message ForeignMessage { 48 | optional int32 foreign_message_int = 1; 49 | } 50 | 51 | 52 | extend ExtendedMessage { 53 | optional int32 optional_int_extension = 1; 54 | optional ForeignMessage optional_message_extension = 2; 55 | 56 | repeated int32 repeated_int_extension = 3; 57 | repeated ForeignMessage repeated_message_extension = 4; 58 | } 59 | -------------------------------------------------------------------------------- /compiler/python/google/protobuf/internal/more_messages.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: robinson@google.com (Will Robinson) 32 | 33 | 34 | package google.protobuf.internal; 35 | 36 | // A message where tag numbers are listed out of order, to allow us to test our 37 | // canonicalization of serialized output, which should always be in tag order. 38 | // We also mix in some extensions for extra fun. 39 | message OutOfOrderFields { 40 | optional sint32 optional_sint32 = 5; 41 | extensions 4 to 4; 42 | optional uint32 optional_uint32 = 3; 43 | extensions 2 to 2; 44 | optional int32 optional_int32 = 1; 45 | }; 46 | 47 | 48 | extend OutOfOrderFields { 49 | optional uint64 optional_uint64 = 4; 50 | optional int64 optional_int64 = 2; 51 | } 52 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/compiler/objectivec/objectivec_enum.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. 3 | // http://code.google.com/p/protobuf/ 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 | // Author: kenton@google.com (Kenton Varda) 18 | // Based on original Protocol Buffers design by 19 | // Sanjay Ghemawat, Jeff Dean, and others. 20 | 21 | #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__ 22 | #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace google { 30 | namespace protobuf { 31 | namespace io { 32 | class Printer; // printer.h 33 | } 34 | } 35 | 36 | namespace protobuf { 37 | namespace compiler { 38 | namespace objectivec { 39 | 40 | class EnumGenerator { 41 | public: 42 | explicit EnumGenerator(const EnumDescriptor* descriptor); 43 | ~EnumGenerator(); 44 | 45 | void GenerateHeader(io::Printer* printer); 46 | void GenerateSource(io::Printer* printer); 47 | 48 | private: 49 | const EnumDescriptor* descriptor_; 50 | vector canonical_values_; 51 | 52 | struct Alias { 53 | const EnumValueDescriptor* value; 54 | const EnumValueDescriptor* canonical_value; 55 | }; 56 | vector aliases_; 57 | 58 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); 59 | }; 60 | 61 | } // namespace objectivec 62 | } // namespace compiler 63 | } // namespace protobuf 64 | } // namespace google 65 | #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__ 66 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/compiler/objectivec/objectivec_extension.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. 3 | // http://code.google.com/p/protobuf/ 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 | // Author: kenton@google.com (Kenton Varda) 18 | // Based on original Protocol Buffers design by 19 | // Sanjay Ghemawat, Jeff Dean, and others. 20 | 21 | #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__ 22 | #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__ 23 | 24 | #include 25 | 26 | namespace google { 27 | namespace protobuf { 28 | class FieldDescriptor; // descriptor.h 29 | namespace io { 30 | class Printer; // printer.h 31 | } 32 | } 33 | 34 | namespace protobuf { 35 | namespace compiler { 36 | namespace objectivec { 37 | 38 | class ExtensionGenerator { 39 | public: 40 | explicit ExtensionGenerator(string classname, const FieldDescriptor* descriptor); 41 | ~ExtensionGenerator(); 42 | 43 | void GenerateMembersHeader(io::Printer* printer); 44 | void GenerateMembersSource(io::Printer* printer); 45 | void GenerateFieldsSource(io::Printer* printer); 46 | void GenerateInitializationSource(io::Printer* printer); 47 | void GenerateRegistrationSource(io::Printer* printer); 48 | 49 | private: 50 | string classname_; 51 | const FieldDescriptor* descriptor_; 52 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); 53 | }; 54 | } // namespace objectivec 55 | } // namespace compiler 56 | } // namespace protobuf 57 | } // namespace google 58 | #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__ 59 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/compiler/objectivec/objectivec_file.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. 3 | // http://code.google.com/p/protobuf/ 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 | // Author: kenton@google.com (Kenton Varda) 18 | // Based on original Protocol Buffers design by 19 | // Sanjay Ghemawat, Jeff Dean, and others. 20 | 21 | #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ 22 | #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace google { 30 | namespace protobuf { 31 | class FileDescriptor; // descriptor.h 32 | namespace io { 33 | class Printer; // printer.h 34 | } 35 | namespace compiler { 36 | class OutputDirectory; // code_generator.h 37 | } 38 | } 39 | 40 | namespace protobuf { 41 | namespace compiler { 42 | namespace objectivec { 43 | 44 | class FileGenerator { 45 | public: 46 | explicit FileGenerator(const FileDescriptor* file); 47 | ~FileGenerator(); 48 | 49 | void GenerateSource(io::Printer* printer); 50 | void GenerateHeader(io::Printer* printer); 51 | void DetermineDependencies(set* dependencies); 52 | 53 | const string& classname() { return classname_; } 54 | 55 | private: 56 | const FileDescriptor* file_; 57 | string classname_; 58 | 59 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); 60 | }; 61 | } // namespace objectivec 62 | } // namespace compiler 63 | } // namespace protobuf 64 | } // namespace google 65 | #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ 66 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/compiler/objectivec/objectivec_generator.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. 3 | // http://code.google.com/p/protobuf/ 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 | // Author: kenton@google.com (Kenton Varda) 18 | // Based on original Protocol Buffers design by 19 | // Sanjay Ghemawat, Jeff Dean, and others. 20 | // 21 | // Generates ObjectiveC code for a given .proto file. 22 | 23 | #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__ 24 | #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__ 25 | 26 | #include 27 | #include 28 | 29 | namespace google { 30 | namespace protobuf { 31 | namespace compiler { 32 | namespace objectivec { 33 | 34 | class LIBPROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator { 35 | public: 36 | ObjectiveCGenerator(); 37 | ~ObjectiveCGenerator(); 38 | 39 | bool Generate(const FileDescriptor* file, 40 | const string& parameter, 41 | OutputDirectory* output_directory, 42 | string* error) const; 43 | 44 | private: 45 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjectiveCGenerator); 46 | }; 47 | } // namespace objectivec 48 | } // namespace compiler 49 | } // namespace protobuf 50 | } // namespace google 51 | #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__ 52 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/generated_message_util.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | 35 | #include 36 | 37 | namespace google { 38 | namespace protobuf { 39 | namespace internal { 40 | 41 | 42 | } // namespace internal 43 | } // namespace protobuf 44 | } // namespace google 45 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/io/gzip_stream_unittest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | # 3 | # Protocol Buffers - Google's data interchange format 4 | # Copyright 2009 Google Inc. All rights reserved. 5 | # http://code.google.com/p/protobuf/ 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are 9 | # met: 10 | # 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above 14 | # copyright notice, this list of conditions and the following disclaimer 15 | # in the documentation and/or other materials provided with the 16 | # distribution. 17 | # * Neither the name of Google Inc. nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | # Author: brianolson@google.com (Brian Olson) 34 | # 35 | # Test compatibility between command line gzip/gunzip binaries and 36 | # ZeroCopyStream versions. 37 | 38 | TESTFILE=Makefile 39 | 40 | (./zcgzip < ${TESTFILE} | gunzip | cmp - ${TESTFILE}) && \ 41 | (gzip < ${TESTFILE} | ./zcgunzip | cmp - ${TESTFILE}) 42 | 43 | # Result of "(cmd) && (cmd)" implicitly becomes result of this script 44 | # and thus the test. 45 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/io/package_info.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // This file exists solely to document the google::protobuf::io namespace. 36 | // It is not compiled into anything, but it may be read by an automated 37 | // documentation generator. 38 | 39 | namespace google { 40 | 41 | namespace protobuf { 42 | 43 | // Auxiliary classes used for I/O. 44 | // 45 | // The Protocol Buffer library uses the classes in this package to deal with 46 | // I/O and encoding/decoding raw bytes. Most users will not need to 47 | // deal with this package. However, users who want to adapt the system to 48 | // work with their own I/O abstractions -- e.g., to allow Protocol Buffers 49 | // to be read from a different kind of input stream without the need for a 50 | // temporary buffer -- should take a closer look. 51 | namespace io {} 52 | 53 | } // namespace protobuf 54 | } // namespace google 55 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/io/zero_copy_stream.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | 35 | #include 36 | 37 | 38 | namespace google { 39 | namespace protobuf { 40 | namespace io { 41 | 42 | ZeroCopyInputStream::~ZeroCopyInputStream() {} 43 | ZeroCopyOutputStream::~ZeroCopyOutputStream() {} 44 | 45 | 46 | } // namespace io 47 | } // namespace protobuf 48 | } // namespace google 49 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/objectivec-descriptor.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. 3 | // http://code.google.com/p/protobuf/ 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 | // Author: cyrusn@google.com (Cyrus Najmabadi) 18 | 19 | import "google/protobuf/descriptor.proto"; 20 | 21 | package google.protobuf; 22 | 23 | message ObjectiveCFileOptions { 24 | // Sets the ObjectiveC package where classes generated from this .proto 25 | // will be placed. This is typically used since Objective C libraries output 26 | // all their headers into a single directory. i.e. Foundation\* 27 | // AddressBook\* UIKit\* etc. etc. 28 | optional string package = 1; 29 | 30 | // The string to be prefixed in front of all classes in order to make them 31 | // 'cocoa-y'. i.e. 'NS/AB/CF/PB' for the 32 | // NextStep/AddressBook/CoreFoundation/ProtocolBuffer libraries respectively. 33 | // This will commonly be the capitalized letters from the above defined 34 | // 'objectivec_directory' 35 | optional string class_prefix = 2; 36 | } 37 | 38 | extend google.protobuf.FileOptions { 39 | 40 | // The extension #1002 has been reserved for us and is registered with 41 | 42 | // Google as being 'in use'. 43 | optional ObjectiveCFileOptions objectivec_file_options = 1002; 44 | } -------------------------------------------------------------------------------- /compiler/src/google/protobuf/service.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | 35 | #include 36 | 37 | namespace google { 38 | namespace protobuf { 39 | 40 | Service::~Service() {} 41 | RpcChannel::~RpcChannel() {} 42 | RpcController::~RpcController() {} 43 | 44 | } // namespace protobuf 45 | 46 | } // namespace google 47 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/stubs/hash.cc: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | 33 | #include 34 | 35 | namespace google { 36 | namespace protobuf { 37 | 38 | // Nothing needed here right now. 39 | 40 | } // namespace protobuf 41 | } // namespace google 42 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/stubs/structurally_valid_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. All Rights Reserved. 2 | // Author: xpeng@google.com (Peter Peng) 3 | 4 | #include 5 | #include 6 | 7 | namespace google { 8 | namespace protobuf { 9 | namespace internal { 10 | namespace { 11 | 12 | TEST(StructurallyValidTest, ValidUTF8String) { 13 | // On GCC, this string can be written as: 14 | // "abcd 1234 - \u2014\u2013\u2212" 15 | // MSVC seems to interpret \u differently. 16 | string valid_str("abcd 1234 - \342\200\224\342\200\223\342\210\222"); 17 | EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(), 18 | valid_str.size())); 19 | } 20 | 21 | TEST(StructurallyValidTest, InvalidUTF8String) { 22 | string invalid_str("\xA0\xB0"); 23 | EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(), 24 | invalid_str.size())); 25 | } 26 | 27 | } // namespace 28 | } // namespace internal 29 | } // namespace protobuf 30 | } // namespace google 31 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/testdata/golden_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mingchen/protobuf-ios/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/src/google/protobuf/testdata/golden_message -------------------------------------------------------------------------------- /compiler/src/google/protobuf/testdata/golden_packed_fields_message: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mingchen/protobuf-ios/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/src/google/protobuf/testdata/golden_packed_fields_message -------------------------------------------------------------------------------- /compiler/src/google/protobuf/unittest_embed_optimize_for.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // A proto file which imports a proto file that uses optimize_for = CODE_SIZE. 36 | 37 | import "google/protobuf/unittest_optimize_for.proto"; 38 | 39 | package protobuf_unittest; 40 | 41 | // We optimize for speed here, but we are importing a proto that is optimized 42 | // for code size. 43 | option optimize_for = SPEED; 44 | 45 | message TestEmbedOptimizedForSize { 46 | // Test that embedding a message which has optimize_for = CODE_SIZE into 47 | // one optimized for speed works. 48 | optional TestOptimizedForSize optional_message = 1; 49 | repeated TestOptimizedForSize repeated_message = 2; 50 | } 51 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/unittest_empty.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // This file intentionally left blank. (At one point this wouldn't compile 36 | // correctly.) 37 | 38 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/unittest_import.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // A proto file which is imported by unittest.proto to test importing. 36 | 37 | 38 | // We don't put this in a package within proto2 because we need to make sure 39 | // that the generated code doesn't depend on being in the proto2 namespace. 40 | // In test_util.h we do 41 | // "using namespace unittest_import = protobuf_unittest_import". 42 | package protobuf_unittest_import; 43 | 44 | option optimize_for = SPEED; 45 | 46 | // Excercise the java_package option. 47 | option java_package = "com.google.protobuf.test"; 48 | 49 | // Do not set a java_outer_classname here to verify that Proto2 works without 50 | // one. 51 | 52 | message ImportMessage { 53 | optional int32 d = 1; 54 | } 55 | 56 | enum ImportEnum { 57 | IMPORT_FOO = 7; 58 | IMPORT_BAR = 8; 59 | IMPORT_BAZ = 9; 60 | } 61 | 62 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/unittest_import_lite.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // 33 | // This is like unittest_import.proto but with optimize_for = LITE_RUNTIME. 34 | 35 | package protobuf_unittest_import; 36 | 37 | option optimize_for = LITE_RUNTIME; 38 | 39 | option java_package = "com.google.protobuf"; 40 | 41 | message ImportMessageLite { 42 | optional int32 d = 1; 43 | } 44 | 45 | enum ImportEnumLite { 46 | IMPORT_LITE_FOO = 7; 47 | IMPORT_LITE_BAR = 8; 48 | IMPORT_LITE_BAZ = 9; 49 | } 50 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/unittest_lite_imports_nonlite.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // 33 | // Tests that a "lite" message can import a regular message. 34 | 35 | package protobuf_unittest; 36 | 37 | import "google/protobuf/unittest.proto"; 38 | 39 | option optimize_for = LITE_RUNTIME; 40 | 41 | message TestLiteImportsNonlite { 42 | optional TestAllTypes message = 1; 43 | } 44 | -------------------------------------------------------------------------------- /compiler/src/google/protobuf/unittest_optimize_for.proto: -------------------------------------------------------------------------------- 1 | // Protocol Buffers - Google's data interchange format 2 | // Copyright 2008 Google Inc. All rights reserved. 3 | // http://code.google.com/p/protobuf/ 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright 10 | // notice, this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following disclaimer 13 | // in the documentation and/or other materials provided with the 14 | // distribution. 15 | // * Neither the name of Google Inc. nor the names of its 16 | // contributors may be used to endorse or promote products derived from 17 | // this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | // Author: kenton@google.com (Kenton Varda) 32 | // Based on original Protocol Buffers design by 33 | // Sanjay Ghemawat, Jeff Dean, and others. 34 | // 35 | // A proto file which uses optimize_for = CODE_SIZE. 36 | 37 | import "google/protobuf/unittest.proto"; 38 | 39 | package protobuf_unittest; 40 | 41 | option optimize_for = CODE_SIZE; 42 | 43 | message TestOptimizedForSize { 44 | optional int32 i = 1; 45 | optional ForeignMessage msg = 19; 46 | 47 | extensions 1000 to max; 48 | 49 | extend TestOptimizedForSize { 50 | optional int32 test_extension = 1234; 51 | optional TestRequiredOptimizedForSize test_extension2 = 1235; 52 | } 53 | } 54 | 55 | message TestRequiredOptimizedForSize { 56 | required int32 x = 1; 57 | } 58 | 59 | message TestOptionalOptimizedForSize { 60 | optional TestRequiredOptimizedForSize o = 1; 61 | } 62 | -------------------------------------------------------------------------------- /compiler/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for config.h 2 | -------------------------------------------------------------------------------- /compiler/vsprojects/config.h: -------------------------------------------------------------------------------- 1 | /* protobuf config.h for MSVC. On other platforms, this is generated 2 | * automatically by autoheader / autoconf / configure. */ 3 | 4 | /* the location of */ 5 | #define HASH_MAP_H 6 | 7 | /* the namespace of hash_map/hash_set */ 8 | #if _MSC_VER < 1310 9 | #define HASH_NAMESPACE std 10 | #else 11 | #define HASH_NAMESPACE stdext 12 | #endif 13 | 14 | /* the location of */ 15 | #define HASH_SET_H 16 | 17 | /* define if the compiler has hash_map */ 18 | #define HAVE_HASH_MAP 1 19 | 20 | /* define if the compiler has hash_set */ 21 | #define HAVE_HASH_SET 1 22 | 23 | /* define if you want to use zlib. See readme.txt for additional 24 | * requirements. */ 25 | // #define HAVE_ZLIB 1 26 | -------------------------------------------------------------------------------- /compiler/vsprojects/convert2008to2005.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh -e 2 | 3 | # This script downgrades MSVC 2008 projects to MSVC 2005 projects, allowing 4 | # people with MSVC 2005 to open them. Otherwise, MSVC 2005 simply refuses to 5 | # open projects created with 2008. We run this as part of our release process. 6 | # If you obtained the code direct from version control and you want to use 7 | # MSVC 2005, you may have to run this manually. (Hint: Use Cygwin or MSYS.) 8 | 9 | for file in *.sln; do 10 | echo "downgrading $file..." 11 | sed -i -re 's/Format Version 10.00/Format Version 9.00/g; 12 | s/Visual Studio 2008/Visual Studio 2005/g;' $file 13 | done 14 | 15 | for file in *.vcproj; do 16 | echo "downgrading $file..." 17 | sed -i -re 's/Version="9.00"/Version="8.00"/g;' $file 18 | done 19 | 20 | # Yes, really, that's it. 21 | -------------------------------------------------------------------------------- /protobuf-ios.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint NAME.podspec' to ensure this is a 3 | # valid spec and remove all comments before submitting the spec. 4 | # 5 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 6 | # 7 | Pod::Spec.new do |s| 8 | s.name = "protobuf-ios" 9 | # s.version = File.read('VERSION') 10 | s.version = "2.3.2" 11 | s.summary = "An Objective-C implementation of Google proto buffer for iOS" 12 | s.description = <<-DESC 13 | An Objective-C implementation of Google proto buffer for iOS 14 | 15 | * Support write to / parse from delimited stream (protobuf 2.3 feature). 16 | DESC 17 | s.homepage = "https://github.com/mingchen/protobuf-ios" 18 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 19 | s.license = 'MIT' 20 | s.author = { "Ming Chen" => "mockey.chen@gmail.com" } 21 | s.source = { :git => "https://github.com/mingchen/protobuf-ios.git", :tag => s.version.to_s } 22 | s.social_media_url = 'https://github.com/mingchen/protobuf-ios' 23 | 24 | s.platform = :ios, '5.0' 25 | # s.ios.deployment_target = '5.0' 26 | # s.osx.deployment_target = '10.7' 27 | s.requires_arc = false 28 | 29 | s.source_files = 'runtime/protobuf-ios/Classes' 30 | # s.resources = 'Assets/*.png' 31 | 32 | s.ios.exclude_files = '' 33 | s.osx.exclude_files = '' 34 | # s.public_header_files = 'Classes/**/*.h' 35 | # s.frameworks = 'SomeFramework', 'AnotherFramework' 36 | # s.dependency 'JSONKit', '~> 1.4' 37 | end 38 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/AbstractMessage.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "Message.h" 19 | 20 | /** 21 | * A partial implementation of the {@link Message} interface which implements 22 | * as many methods of that interface as possible in terms of other methods. 23 | * 24 | * @author Cyrus Najmabadi 25 | */ 26 | @interface PBAbstractMessage : NSObject { 27 | @private 28 | } 29 | 30 | /** 31 | * Writes a string description of the message into the given mutable string 32 | * respecting a given indent. 33 | */ 34 | - (void)writeDescriptionTo:(NSMutableString*) output 35 | withIndent:(NSString*) indent; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/AbstractMessage_Builder.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "Message_Builder.h" 19 | 20 | /** 21 | * A partial implementation of the {@link Message.Builder} interface which 22 | * implements as many methods of that interface as possible in terms of 23 | * other methods. 24 | */ 25 | @interface PBAbstractMessage_Builder : NSObject { 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/Bootstrap.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "ForwardDeclarations.h" 19 | 20 | #import "CodedInputStream.h" 21 | #import "CodedOutputStream.h" 22 | #import "ExtendableMessage.h" 23 | #import "ExtendableMessage_Builder.h" 24 | #import "ExtensionRegistry.h" 25 | #import "GeneratedMessage.h" 26 | #import "GeneratedMessage_Builder.h" 27 | #import "Message_Builder.h" 28 | #import "UnknownFieldSet.h" 29 | #import "UnknownFieldSet_Builder.h" 30 | #import "Utilities.h" 31 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/ConcreteExtensionField.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "ExtensionField.h" 19 | 20 | typedef enum { 21 | PBExtensionTypeBool, 22 | PBExtensionTypeFixed32, 23 | PBExtensionTypeSFixed32, 24 | PBExtensionTypeFloat, 25 | PBExtensionTypeFixed64, 26 | PBExtensionTypeSFixed64, 27 | PBExtensionTypeDouble, 28 | PBExtensionTypeInt32, 29 | PBExtensionTypeInt64, 30 | PBExtensionTypeSInt32, 31 | PBExtensionTypeSInt64, 32 | PBExtensionTypeUInt32, 33 | PBExtensionTypeUInt64, 34 | PBExtensionTypeBytes, 35 | PBExtensionTypeString, 36 | PBExtensionTypeMessage, 37 | PBExtensionTypeGroup, 38 | PBExtensionTypeEnum 39 | } PBExtensionType; 40 | 41 | @interface PBConcreteExtensionField : NSObject { 42 | @private 43 | PBExtensionType type; 44 | 45 | Class extendedClass; 46 | int32_t fieldNumber; 47 | id defaultValue; 48 | 49 | Class messageOrGroupClass; 50 | 51 | BOOL isRepeated; 52 | BOOL isPacked; 53 | BOOL isMessageSetWireFormat; 54 | } 55 | 56 | + (PBConcreteExtensionField*) extensionWithType:(PBExtensionType) type 57 | extendedClass:(Class) extendedClass 58 | fieldNumber:(int32_t) fieldNumber 59 | defaultValue:(id) defaultValue 60 | messageOrGroupClass:(Class) messageOrGroupClass 61 | isRepeated:(BOOL) isRepeated 62 | isPacked:(BOOL) isPacked 63 | isMessageSetWireFormat:(BOOL) isMessageSetWireFormat; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/ExtensionField.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "WireFormat.h" 19 | 20 | @class PBCodedInputStream; 21 | @class PBCodedOutputStream; 22 | @class PBExtendableMessage_Builder; 23 | @class PBExtensionRegistry; 24 | @class PBUnknownFieldSet_Builder; 25 | 26 | @protocol PBExtensionField 27 | - (int32_t) fieldNumber; 28 | - (PBWireFormat) wireType; 29 | - (BOOL) isRepeated; 30 | - (Class) extendedClass; 31 | - (id) defaultValue; 32 | 33 | - (void) mergeFromCodedInputStream:(PBCodedInputStream*) input 34 | unknownFields:(PBUnknownFieldSet_Builder*) unknownFields 35 | extensionRegistry:(PBExtensionRegistry*) extensionRegistry 36 | builder:(PBExtendableMessage_Builder*) builder 37 | tag:(int32_t) tag; 38 | - (void) writeValue:(id) value includingTagToCodedOutputStream:(PBCodedOutputStream*) output; 39 | - (int32_t) computeSerializedSizeIncludingTag:(id) value; 40 | - (void) writeDescriptionOf:(id) value 41 | to:(NSMutableString*) output 42 | withIndent:(NSString*) indent; 43 | @end 44 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/ExtensionRegistry.m: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "ExtensionRegistry.h" 19 | 20 | @interface PBExtensionRegistry() 21 | @property (retain) NSDictionary* classMap; 22 | @end 23 | 24 | @implementation PBExtensionRegistry 25 | 26 | @synthesize classMap; 27 | 28 | - (void) dealloc { 29 | self.classMap = nil; 30 | [super dealloc]; 31 | } 32 | 33 | static PBExtensionRegistry* emptyRegistry = nil; 34 | 35 | + (void) initialize { 36 | if (self == [PBExtensionRegistry class]) { 37 | emptyRegistry = [[PBExtensionRegistry alloc] initWithClassMap:[NSDictionary dictionary]]; 38 | } 39 | } 40 | 41 | 42 | - (id) initWithClassMap:(NSDictionary*) map_{ 43 | if ((self = [super init])) { 44 | self.classMap = map_; 45 | } 46 | 47 | return self; 48 | } 49 | 50 | 51 | - (id) keyForClass:(Class) clazz { 52 | return NSStringFromClass(clazz); 53 | } 54 | 55 | 56 | + (PBExtensionRegistry*) emptyRegistry { 57 | return emptyRegistry; 58 | } 59 | 60 | 61 | - (id) getExtension:(Class) clazz fieldNumber:(NSInteger) fieldNumber { 62 | NSDictionary* extensionMap = [classMap objectForKey:[self keyForClass:clazz]]; 63 | return [extensionMap objectForKey:[NSNumber numberWithInteger:fieldNumber]]; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/Field.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import 19 | 20 | @class PBArray; 21 | @class PBAppendableArray; 22 | @class PBCodedOutputStream; 23 | 24 | @interface PBField : NSObject 25 | { 26 | @protected 27 | PBAppendableArray * _varintArray; 28 | PBAppendableArray * _fixed32Array; 29 | PBAppendableArray * _fixed64Array; 30 | PBAppendableArray * _lengthDelimitedArray; 31 | PBAppendableArray * _groupArray; 32 | } 33 | 34 | @property (nonatomic,retain,readonly) PBArray * varintArray; 35 | @property (nonatomic,retain,readonly) PBArray * fixed32Array; 36 | @property (nonatomic,retain,readonly) PBArray * fixed64Array; 37 | @property (nonatomic,retain,readonly) PBArray * lengthDelimitedArray; 38 | @property (nonatomic,retain,readonly) PBArray * groupArray; 39 | 40 | + (PBField *)defaultInstance; 41 | 42 | - (int32_t)getSerializedSize:(int32_t)fieldNumber; 43 | - (int32_t)getSerializedSizeAsMessageSetExtension:(int32_t)fieldNumber; 44 | 45 | - (void)writeTo:(int32_t) fieldNumber output:(PBCodedOutputStream *)output; 46 | - (void)writeAsMessageSetExtensionTo:(int32_t)fieldNumber output:(PBCodedOutputStream *)output; 47 | - (void)writeDescriptionFor:(int32_t) fieldNumber 48 | to:(NSMutableString*) output 49 | withIndent:(NSString*) indent; 50 | @end 51 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/ForwardDeclarations.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | @protocol PBMessage; 19 | @protocol PBMessage_Builder; 20 | @protocol PBExtensionField; 21 | 22 | @class PBAbstractMessage; 23 | @class PBCodedInputStream; 24 | @class PBCodedOutputStream; 25 | @class PBConcreteExtensionField; 26 | @class PBExtendableMessage_Builder; 27 | @class PBExtendableMessage; 28 | @class PBExtensionRegistry; 29 | @class PBField; 30 | @class PBGeneratedMessage; 31 | @class PBGeneratedMessage_Builder; 32 | @class PBMutableExtensionRegistry; 33 | @class PBMutableField; 34 | @class PBUnknownFieldSet; 35 | @class PBUnknownFieldSet_Builder; 36 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/GeneratedMessage.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "AbstractMessage.h" 19 | 20 | /** 21 | * All generated protocol message classes extend this class. This class 22 | * implements most of the Message and Builder interfaces using Java reflection. 23 | * Users can ignore this class and pretend that generated messages implement 24 | * the Message interface directly. 25 | * 26 | * @author Cyrus Najmabadi 27 | */ 28 | @interface PBGeneratedMessage : PBAbstractMessage { 29 | @private 30 | PBUnknownFieldSet* unknownFields; 31 | 32 | @protected 33 | int32_t memoizedSerializedSize; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/GeneratedMessage.m: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "GeneratedMessage.h" 19 | 20 | #import "UnknownFieldSet.h" 21 | 22 | @interface PBGeneratedMessage () 23 | @property (retain) PBUnknownFieldSet* unknownFields; 24 | @end 25 | 26 | 27 | @implementation PBGeneratedMessage 28 | 29 | @synthesize unknownFields; 30 | 31 | - (void) dealloc { 32 | self.unknownFields = nil; 33 | [super dealloc]; 34 | } 35 | 36 | 37 | - (id) init { 38 | if ((self = [super init])) { 39 | self.unknownFields = [PBUnknownFieldSet defaultInstance]; 40 | memoizedSerializedSize = -1; 41 | } 42 | 43 | return self; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/GeneratedMessage_Builder.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "AbstractMessage_Builder.h" 19 | 20 | @class PBUnknownFieldSet_Builder; 21 | 22 | @interface PBGeneratedMessage_Builder : PBAbstractMessage_Builder { 23 | } 24 | 25 | /* @protected */ 26 | - (BOOL) parseUnknownField:(PBCodedInputStream*) input 27 | unknownFields:(PBUnknownFieldSet_Builder*) unknownFields 28 | extensionRegistry:(PBExtensionRegistry*) extensionRegistry 29 | tag:(int32_t) tag; 30 | 31 | - (void) checkInitialized; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/MutableExtensionRegistry.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "ExtensionRegistry.h" 19 | 20 | @interface PBMutableExtensionRegistry : PBExtensionRegistry { 21 | @private 22 | NSMutableDictionary* mutableClassMap; 23 | } 24 | 25 | + (PBMutableExtensionRegistry*) registry; 26 | 27 | - (void) addExtension:(id) extension; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/MutableExtensionRegistry.m: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "MutableExtensionRegistry.h" 19 | 20 | #import "ExtensionField.h" 21 | 22 | @interface PBMutableExtensionRegistry() 23 | @property (retain) NSMutableDictionary* mutableClassMap; 24 | @end 25 | 26 | @implementation PBMutableExtensionRegistry 27 | 28 | @synthesize mutableClassMap; 29 | 30 | - (void) dealloc { 31 | self.mutableClassMap = nil; 32 | [super dealloc]; 33 | } 34 | 35 | 36 | - (id) initWithClassMap:(NSMutableDictionary*) mutableClassMap_ { 37 | if ((self = [super initWithClassMap:mutableClassMap_])) { 38 | self.mutableClassMap = mutableClassMap_; 39 | } 40 | 41 | return self; 42 | } 43 | 44 | 45 | + (PBMutableExtensionRegistry*) registry { 46 | return [[[PBMutableExtensionRegistry alloc] initWithClassMap:[NSMutableDictionary dictionary]] autorelease]; 47 | } 48 | 49 | 50 | - (void) addExtension:(id) extension { 51 | if (extension == nil) { 52 | return; 53 | } 54 | 55 | Class extendedClass = [extension extendedClass]; 56 | id key = [self keyForClass:extendedClass]; 57 | 58 | NSMutableDictionary* extensionMap = [classMap objectForKey:key]; 59 | if (extensionMap == nil) { 60 | extensionMap = [NSMutableDictionary dictionary]; 61 | [mutableClassMap setObject:extensionMap forKey:key]; 62 | } 63 | 64 | [extensionMap setObject:extension 65 | forKey:[NSNumber numberWithInteger:[extension fieldNumber]]]; 66 | } 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/MutableField.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "Field.h" 19 | 20 | @class PBUnknownFieldSet; 21 | 22 | @interface PBMutableField : PBField 23 | 24 | + (PBMutableField *)field; 25 | 26 | - (PBMutableField *)mergeFromField:(PBField *)other; 27 | 28 | - (PBMutableField *)clear; 29 | - (PBMutableField *)addVarint:(int64_t)value; 30 | - (PBMutableField *)addFixed32:(int32_t)value; 31 | - (PBMutableField *)addFixed64:(int64_t)value; 32 | - (PBMutableField *)addLengthDelimited:(NSData *)value; 33 | - (PBMutableField *)addGroup:(PBUnknownFieldSet *)value; 34 | 35 | @end -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/ProtocolBuffers.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "Bootstrap.h" 19 | 20 | #import "AbstractMessage.h" 21 | #import "AbstractMessage_Builder.h" 22 | #import "CodedInputStream.h" 23 | #import "CodedOutputStream.h" 24 | #import "ConcreteExtensionField.h" 25 | #import "ExtendableMessage.h" 26 | #import "ExtendableMessage_Builder.h" 27 | #import "ExtensionField.h" 28 | #import "ExtensionRegistry.h" 29 | #import "Field.h" 30 | #import "GeneratedMessage.h" 31 | #import "GeneratedMessage_Builder.h" 32 | #import "Message.h" 33 | #import "Message_Builder.h" 34 | #import "MutableExtensionRegistry.h" 35 | #import "MutableField.h" 36 | #import "PBArray.h" 37 | #import "UnknownFieldSet.h" 38 | #import "UnknownFieldSet_Builder.h" 39 | #import "Utilities.h" 40 | #import "WireFormat.h" 41 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/RingBuffer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface RingBuffer : NSObject { 4 | NSMutableData *buffer; 5 | NSInteger position; 6 | NSInteger tail; 7 | } 8 | @property (nonatomic, readonly) NSUInteger freeSpace; 9 | 10 | - (id)initWithData:(NSMutableData*)data; 11 | 12 | // Returns false if there is not enough free space in buffer 13 | - (BOOL)appendByte:(uint8_t)byte; 14 | 15 | // Returns number of bytes written 16 | - (NSInteger)appendData:(const NSData*)value offset:(NSInteger)offset length:(NSInteger)length; 17 | 18 | // Returns number of bytes written 19 | - (NSInteger)flushToOutputStream:(NSOutputStream*)stream; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/RingBuffer.m: -------------------------------------------------------------------------------- 1 | #import "RingBuffer.h" 2 | 3 | @implementation RingBuffer 4 | 5 | - (id)initWithData:(NSMutableData*)data { 6 | if ((self = [super init])) { 7 | buffer = [data retain]; 8 | } 9 | return self; 10 | } 11 | 12 | 13 | - (NSUInteger)freeSpace { 14 | return (position < tail ? tail - position : (buffer.length - position) + tail) - (tail ? 1 : 0); 15 | } 16 | 17 | 18 | - (BOOL)appendByte:(uint8_t)byte { 19 | if (self.freeSpace < 1) return NO; 20 | ((uint8_t*)buffer.mutableBytes)[position++] = byte; 21 | return YES; 22 | } 23 | 24 | 25 | - (NSInteger)appendData:(const NSData*)value offset:(NSInteger)offset length:(NSInteger)length { 26 | NSInteger totalWritten = 0; 27 | const uint8_t *input = value.bytes; 28 | uint8_t *data = buffer.mutableBytes; 29 | 30 | if (position >= tail) { 31 | totalWritten = MIN(buffer.length - position, length); 32 | memcpy(data + position, input + offset, totalWritten); 33 | position += totalWritten; 34 | if (totalWritten == length) return length; 35 | length -= totalWritten; 36 | offset += totalWritten; 37 | } 38 | 39 | NSUInteger freeSpace = self.freeSpace; 40 | if (!freeSpace) return totalWritten; 41 | 42 | if (position == buffer.length) { 43 | position = 0; 44 | } 45 | 46 | // position < tail 47 | int32_t written = (int32_t)MIN(freeSpace, length); 48 | memcpy(data + position, input + offset, written); 49 | position += written; 50 | totalWritten += written; 51 | 52 | return totalWritten; 53 | } 54 | 55 | 56 | - (NSInteger)flushToOutputStream:(NSOutputStream*)stream { 57 | NSInteger totalWritten = 0; 58 | const uint8_t *data = buffer.bytes; 59 | 60 | if (tail > position) { 61 | int32_t written = (int32_t)[stream write:data + tail maxLength:buffer.length - tail]; 62 | if (written <= 0) return totalWritten; 63 | totalWritten += written; 64 | tail += written; 65 | if (tail == buffer.length) { 66 | tail = 0; 67 | } 68 | } 69 | 70 | if (tail < position) { 71 | int32_t written = (int32_t)[stream write:data + tail maxLength:position - tail]; 72 | if (written <= 0) return totalWritten; 73 | totalWritten += written; 74 | tail += written; 75 | } 76 | 77 | if (tail == position) { 78 | tail = position = 0; 79 | } 80 | 81 | if (position == buffer.length && tail > 0) { 82 | position = 0; 83 | } 84 | 85 | if (tail == buffer.length) { 86 | tail = 0; 87 | } 88 | 89 | return totalWritten; 90 | } 91 | 92 | 93 | - (void)dealloc { 94 | [buffer release]; 95 | [super dealloc]; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/TextFormat.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | @interface PBTextFormat : NSObject { 19 | 20 | } 21 | 22 | + (int32_t) parseInt32:(NSString*) text; 23 | + (int32_t) parseUInt32:(NSString*) text; 24 | + (int64_t) parseInt64:(NSString*) text; 25 | + (int64_t) parseUInt64:(NSString*) text; 26 | 27 | + (NSData*) unescapeBytes:(NSString*) input; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/UnknownFieldSet.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | @class PBCodedOutputStream; 19 | @class PBField; 20 | @class PBUnknownFieldSet_Builder; 21 | 22 | @interface PBUnknownFieldSet : NSObject { 23 | @private 24 | NSDictionary* fields; 25 | } 26 | 27 | @property (readonly, retain) NSDictionary* fields; 28 | 29 | + (PBUnknownFieldSet*) defaultInstance; 30 | 31 | + (PBUnknownFieldSet*) setWithFields:(NSMutableDictionary*) fields; 32 | + (PBUnknownFieldSet*) parseFromData:(NSData*) data; 33 | 34 | + (PBUnknownFieldSet_Builder*) builder; 35 | + (PBUnknownFieldSet_Builder*) builderWithUnknownFields:(PBUnknownFieldSet*) other; 36 | 37 | - (void) writeAsMessageSetTo:(PBCodedOutputStream*) output; 38 | - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; 39 | - (NSData*) data; 40 | 41 | - (int32_t) serializedSize; 42 | - (int32_t) serializedSizeAsMessageSet; 43 | 44 | - (BOOL) hasField:(int32_t) number; 45 | - (PBField*) getField:(int32_t) number; 46 | 47 | - (void) writeDescriptionTo:(NSMutableString*) output 48 | withIndent:(NSString*) indent; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/UnknownFieldSet_Builder.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "Message_Builder.h" 19 | 20 | @class PBField; 21 | @class PBMutableField; 22 | 23 | @interface PBUnknownFieldSet_Builder : NSObject { 24 | @private 25 | NSMutableDictionary* fields; 26 | 27 | // Optimization: We keep around a builder for the last field that was 28 | // modified so that we can efficiently add to it multiple times in a 29 | // row (important when parsing an unknown repeated field). 30 | int32_t lastFieldNumber; 31 | 32 | PBMutableField* lastField; 33 | } 34 | 35 | + (PBUnknownFieldSet_Builder*) createBuilder:(PBUnknownFieldSet*) unknownFields; 36 | 37 | - (PBUnknownFieldSet*) build; 38 | - (PBUnknownFieldSet_Builder*) mergeUnknownFields:(PBUnknownFieldSet*) other; 39 | 40 | - (PBUnknownFieldSet_Builder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; 41 | - (PBUnknownFieldSet_Builder*) mergeFromData:(NSData*) data; 42 | - (PBUnknownFieldSet_Builder*) mergeFromInputStream:(NSInputStream*) input; 43 | - (PBUnknownFieldSet_Builder*) mergeDelimitedFromInputStream:(NSInputStream*) input; 44 | 45 | - (PBUnknownFieldSet_Builder*) mergeVarintField:(int32_t) number value:(int32_t) value; 46 | 47 | - (BOOL) mergeFieldFrom:(int32_t) tag input:(PBCodedInputStream*) input; 48 | 49 | - (PBUnknownFieldSet_Builder*) addField:(PBField*) field forNumber:(int32_t) number; 50 | 51 | - (PBUnknownFieldSet_Builder*) clear; 52 | - (PBUnknownFieldSet_Builder*) mergeField:(PBField*) field forNumber:(int32_t) number; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/WireFormat.h: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | typedef enum { 19 | PBWireFormatVarint = 0, 20 | PBWireFormatFixed64 = 1, 21 | PBWireFormatLengthDelimited = 2, 22 | PBWireFormatStartGroup = 3, 23 | PBWireFormatEndGroup = 4, 24 | PBWireFormatFixed32 = 5, 25 | 26 | PBWireFormatTagTypeBits = 3, 27 | PBWireFormatTagTypeMask = 7 /* = (1 << PBWireFormatTagTypeBits) - 1*/, 28 | 29 | PBWireFormatMessageSetItem = 1, 30 | PBWireFormatMessageSetTypeId = 2, 31 | PBWireFormatMessageSetMessage = 3 32 | } PBWireFormat; 33 | 34 | int32_t PBWireFormatMakeTag(int32_t fieldNumber, int32_t wireType); 35 | int32_t PBWireFormatGetTagWireType(int32_t tag); 36 | int32_t PBWireFormatGetTagFieldNumber(int32_t tag); 37 | 38 | #define PBWireFormatMessageSetItemTag (PBWireFormatMakeTag(PBWireFormatMessageSetItem, PBWireFormatStartGroup)) 39 | #define PBWireFormatMessageSetItemEndTag (PBWireFormatMakeTag(PBWireFormatMessageSetItem, PBWireFormatEndGroup)) 40 | #define PBWireFormatMessageSetTypeIdTag (PBWireFormatMakeTag(PBWireFormatMessageSetTypeId, PBWireFormatVarint)) 41 | #define PBWireFormatMessageSetMessageTag (PBWireFormatMakeTag(PBWireFormatMessageSetMessage, PBWireFormatLengthDelimited)) 42 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/WireFormat.m: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Objective C 2 | // 3 | // Copyright 2010 Booyah Inc. 4 | // Copyright 2008 Cyrus Najmabadi 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | #import "WireFormat.h" 19 | 20 | #import "Utilities.h" 21 | 22 | int32_t PBWireFormatMakeTag(int32_t fieldNumber, int32_t wireType) { 23 | return (fieldNumber << PBWireFormatTagTypeBits) | wireType; 24 | } 25 | 26 | 27 | int32_t PBWireFormatGetTagWireType(int32_t tag) { 28 | return tag & PBWireFormatTagTypeMask; 29 | } 30 | 31 | 32 | int32_t PBWireFormatGetTagFieldNumber(int32_t tag) { 33 | return logicalRightShift32(tag, PBWireFormatTagTypeBits); 34 | } 35 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/Classes/protobuf-ios-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'protobuf-ios' target in the 'protobuf-ios' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import "Bootstrap.h" 8 | #endif 9 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/protobuf-ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/protobuf-ios.xcodeproj/xcuserdata/chenming.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | protobuf-ios.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | protobuf-iosTests.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | D7BA74ED15E220F6001835BB 21 | 22 | primary 23 | 24 | 25 | D7BA74FD15E220F7001835BB 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/protobuf-iosTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /runtime/protobuf-ios/protobuf-iosTests/protobuf-iosTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.symantec.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | --------------------------------------------------------------------------------