Permalink
Browse files

Using protobuf 2.4.1 and changed protobuf.gyp to support that version.

1 parent c010ae5 commit b4d9f970ac15191b62b0179227bda6308f752988 @trevex trevex committed Oct 25, 2012
Showing with 53,007 additions and 2,613 deletions.
  1. +5 −4 protobuf/protobuf.gyp
  2. +0 −240 protobuf/src/google/protobuf/SEBS
  3. +80 −0 protobuf/src/google/protobuf/compiler/code_generator.cc
  4. +142 −0 protobuf/src/google/protobuf/compiler/code_generator.h
  5. +1,357 −0 protobuf/src/google/protobuf/compiler/command_line_interface.cc
  6. +318 −0 protobuf/src/google/protobuf/compiler/command_line_interface.h
  7. +1,452 −0 protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc
  8. +158 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
  9. +258 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc
  10. +99 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h
  11. +361 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
  12. +103 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h
  13. +210 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc
  14. +85 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h
  15. +139 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc
  16. +167 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_field.h
  17. +611 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc
  18. +98 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_file.h
  19. +122 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc
  20. +72 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h
  21. +347 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc
  22. +159 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h
  23. +1,933 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc
  24. +170 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_message.h
  25. +277 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc
  26. +102 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h
  27. +121 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
  28. +382 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
  29. +103 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
  30. +334 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc
  31. +118 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_service.h
  32. +453 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc
  33. +104 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h
  34. +113 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
  35. +1,281 −0 protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc
  36. +459 −0 protobuf/src/google/protobuf/compiler/importer.cc
  37. +303 −0 protobuf/src/google/protobuf/compiler/importer.h
  38. +600 −0 protobuf/src/google/protobuf/compiler/importer_unittest.cc
  39. +243 −0 protobuf/src/google/protobuf/compiler/java/java_enum.cc
  40. +84 −0 protobuf/src/google/protobuf/compiler/java/java_enum.h
  41. +537 −0 protobuf/src/google/protobuf/compiler/java/java_enum_field.cc
  42. +121 −0 protobuf/src/google/protobuf/compiler/java/java_enum_field.h
  43. +216 −0 protobuf/src/google/protobuf/compiler/java/java_extension.cc
  44. +77 −0 protobuf/src/google/protobuf/compiler/java/java_extension.h
  45. +137 −0 protobuf/src/google/protobuf/compiler/java/java_field.cc
  46. +108 −0 protobuf/src/google/protobuf/compiler/java/java_field.h
  47. +428 −0 protobuf/src/google/protobuf/compiler/java/java_file.cc
  48. +101 −0 protobuf/src/google/protobuf/compiler/java/java_file.h
  49. +128 −0 protobuf/src/google/protobuf/compiler/java/java_generator.cc
  50. +72 −0 protobuf/src/google/protobuf/compiler/java/java_generator.h
  51. +478 −0 protobuf/src/google/protobuf/compiler/java/java_helpers.cc
  52. +213 −0 protobuf/src/google/protobuf/compiler/java/java_helpers.h
  53. +1,287 −0 protobuf/src/google/protobuf/compiler/java/java_message.cc
  54. +109 −0 protobuf/src/google/protobuf/compiler/java/java_message.h
  55. +884 −0 protobuf/src/google/protobuf/compiler/java/java_message_field.cc
  56. +134 −0 protobuf/src/google/protobuf/compiler/java/java_message_field.h
  57. +122 −0 protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc
  58. +719 −0 protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc
  59. +121 −0 protobuf/src/google/protobuf/compiler/java/java_primitive_field.h
  60. +444 −0 protobuf/src/google/protobuf/compiler/java/java_service.cc
  61. +113 −0 protobuf/src/google/protobuf/compiler/java/java_service.h
  62. +605 −0 protobuf/src/google/protobuf/compiler/java/java_string_field.cc
  63. +120 −0 protobuf/src/google/protobuf/compiler/java/java_string_field.h
  64. +28 −31 protobuf/src/google/protobuf/{stubs/platform_macros.h → compiler/main.cc}
  65. +231 −0 protobuf/src/google/protobuf/compiler/mock_code_generator.cc
  66. +113 −0 protobuf/src/google/protobuf/compiler/mock_code_generator.h
  67. +64 −0 protobuf/src/google/protobuf/compiler/package_info.h
  68. +1,473 −0 protobuf/src/google/protobuf/compiler/parser.cc
  69. +434 −0 protobuf/src/google/protobuf/compiler/parser.h
  70. +2,122 −0 protobuf/src/google/protobuf/compiler/parser_unittest.cc
  71. +163 −0 protobuf/src/google/protobuf/compiler/plugin.cc
  72. +73 −0 protobuf/src/google/protobuf/compiler/plugin.h
  73. +1,082 −0 protobuf/src/google/protobuf/compiler/plugin.pb.cc
  74. +790 −0 protobuf/src/google/protobuf/compiler/plugin.pb.h
  75. +145 −0 protobuf/src/google/protobuf/compiler/plugin.proto
  76. +1,006 −0 protobuf/src/google/protobuf/compiler/python/python_generator.cc
  77. +156 −0 protobuf/src/google/protobuf/compiler/python/python_generator.h
  78. +116 −0 protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc
  79. +460 −0 protobuf/src/google/protobuf/compiler/subprocess.cc
  80. +108 −0 protobuf/src/google/protobuf/compiler/subprocess.h
  81. +51 −0 protobuf/src/google/protobuf/compiler/test_plugin.cc
  82. +91 −0 protobuf/src/google/protobuf/compiler/zip_output_unittest.sh
  83. +218 −0 protobuf/src/google/protobuf/compiler/zip_writer.cc
  84. +93 −0 protobuf/src/google/protobuf/compiler/zip_writer.h
  85. +1 −1 protobuf/src/google/protobuf/descriptor.cc
  86. +167 −212 protobuf/src/google/protobuf/descriptor.pb.cc
  87. +19 −52 protobuf/src/google/protobuf/descriptor.pb.h
  88. +4 −15 protobuf/src/google/protobuf/descriptor.proto
  89. +748 −0 protobuf/src/google/protobuf/descriptor_database_unittest.cc
  90. +4,034 −0 protobuf/src/google/protobuf/descriptor_unittest.cc
  91. +162 −0 protobuf/src/google/protobuf/dynamic_message_unittest.cc
  92. +10 −12 protobuf/src/google/protobuf/extension_set.cc
  93. +6 −8 protobuf/src/google/protobuf/extension_set.h
  94. +8 −8 protobuf/src/google/protobuf/extension_set_heavy.cc
  95. +642 −0 protobuf/src/google/protobuf/extension_set_unittest.cc
  96. +12 −0 protobuf/src/google/protobuf/generated_message_reflection.cc
  97. +384 −0 protobuf/src/google/protobuf/generated_message_reflection_unittest.cc
  98. +3 −3 protobuf/src/google/protobuf/generated_message_util.h
  99. +1 −1 protobuf/src/google/protobuf/io/coded_stream.cc
  100. +0 −15 protobuf/src/google/protobuf/io/coded_stream.h
  101. +1,131 −0 protobuf/src/google/protobuf/io/coded_stream_unittest.cc
  102. +44 −0 protobuf/src/google/protobuf/io/gzip_stream_unittest.sh
  103. +261 −0 protobuf/src/google/protobuf/io/printer_unittest.cc
  104. +766 −0 protobuf/src/google/protobuf/io/tokenizer_unittest.cc
  105. +850 −0 protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc
  106. +281 −0 protobuf/src/google/protobuf/message_unittest.cc
  107. +405 −0 protobuf/src/google/protobuf/reflection_ops_unittest.cc
  108. +1 −1 protobuf/src/google/protobuf/repeated_field.h
  109. +1,086 −0 protobuf/src/google/protobuf/repeated_field_unittest.cc
  110. +0 −202 protobuf/src/google/protobuf/stubs/atomicops.h
  111. +0 −151 protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
  112. +0 −122 protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h
  113. +0 −224 protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h
  114. +0 −187 protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h
  115. +0 −137 protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
  116. +0 −293 protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h
  117. +0 −112 protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
  118. +0 −150 protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h
  119. +2 −2 protobuf/src/google/protobuf/stubs/common.h
  120. +357 −0 protobuf/src/google/protobuf/stubs/common_unittest.cc
  121. +34 −45 protobuf/src/google/protobuf/stubs/once.cc
  122. +29 −53 protobuf/src/google/protobuf/stubs/once.h
  123. +253 −0 protobuf/src/google/protobuf/stubs/once_unittest.cc
  124. +40 −0 protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc
  125. +0 −7 protobuf/src/google/protobuf/stubs/strutil.cc
  126. +83 −0 protobuf/src/google/protobuf/stubs/strutil_unittest.cc
  127. +2,854 −0 protobuf/src/google/protobuf/test_util.cc
  128. +174 −0 protobuf/src/google/protobuf/test_util.h
  129. +1,502 −0 protobuf/src/google/protobuf/test_util_lite.cc
  130. +101 −0 protobuf/src/google/protobuf/test_util_lite.h
  131. BIN protobuf/src/google/protobuf/testdata/golden_message
  132. BIN protobuf/src/google/protobuf/testdata/golden_packed_fields_message
  133. +116 −0 protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt
  134. +116 −0 protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt
  135. +176 −0 protobuf/src/google/protobuf/testing/file.cc
  136. +83 −0 protobuf/src/google/protobuf/testing/file.h
  137. +254 −0 protobuf/src/google/protobuf/testing/googletest.cc
  138. +98 −0 protobuf/src/google/protobuf/testing/googletest.h
  139. +73 −0 protobuf/src/google/protobuf/testing/zcgunzip.cc
  140. +79 −0 protobuf/src/google/protobuf/testing/zcgzip.cc
  141. +1,141 −0 protobuf/src/google/protobuf/text_format_unittest.cc
  142. +630 −0 protobuf/src/google/protobuf/unittest.proto
  143. +366 −0 protobuf/src/google/protobuf/unittest_custom_options.proto
  144. +50 −0 protobuf/src/google/protobuf/unittest_embed_optimize_for.proto
  145. +37 −0 protobuf/src/google/protobuf/unittest_empty.proto
  146. +1,046 −0 protobuf/src/google/protobuf/unittest_enormous_descriptor.proto
  147. +61 −0 protobuf/src/google/protobuf/unittest_import.proto
  148. +49 −0 protobuf/src/google/protobuf/unittest_import_lite.proto
  149. +312 −0 protobuf/src/google/protobuf/unittest_lite.proto
  150. +43 −0 protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto
  151. +72 −0 protobuf/src/google/protobuf/unittest_mset.proto
  152. +52 −0 protobuf/src/google/protobuf/unittest_no_generic_services.proto
  153. +61 −0 protobuf/src/google/protobuf/unittest_optimize_for.proto
  154. +2 −18 protobuf/src/google/protobuf/unknown_field_set.cc
  155. +512 −0 protobuf/src/google/protobuf/unknown_field_set_unittest.cc
  156. +309 −7 protobuf/src/google/protobuf/wire_format.cc
  157. +64 −0 protobuf/src/google/protobuf/wire_format.h
  158. +18 −243 protobuf/src/google/protobuf/wire_format_lite.cc
  159. +13 −57 protobuf/src/google/protobuf/wire_format_lite.h
  160. +905 −0 protobuf/src/google/protobuf/wire_format_unittest.cc
View
@@ -45,10 +45,11 @@
'src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h',
'src/google/protobuf/stubs/atomicops_internals_macosx.h',
'src/google/protobuf/stubs/atomicops_internals_mips_gcc.h',
- 'src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc',
- 'src/google/protobuf/stubs/atomicops_internals_x86_gcc.h',
- 'src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc',
- 'src/google/protobuf/stubs/atomicops_internals_x86_msvc.h',
+ # not needed for this version 2.4.1 of protobuf
+ #'src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc',
+ #'src/google/protobuf/stubs/atomicops_internals_x86_gcc.h',
+ #'src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc',
+ #'src/google/protobuf/stubs/atomicops_internals_x86_msvc.h',
'src/google/protobuf/stubs/common.h',
'src/google/protobuf/stubs/once.h',
'src/google/protobuf/stubs/platform_macros.h',
@@ -1,240 +0,0 @@
-# **EXPERIMENTAL**
-#
-# See http://sebs.googlecode.com
-#
-# This is an experimental build definition file using the SEBS build system.
-# I (Kenton Varda, maintainer of Protocol Buffers) happen to be the author of
-# SEBS, though SEBS is not a Google project. I'm sticking this file in
-# protobuf's SVN because that's the easiest place for me to put it, and it
-# shouldn't harm anyone. This file is not included in the distribution.
-#
-# Currently, to use this file, you must generate config.h and put it at the
-# top level of the source tree.
-
-_cpp = sebs.import_("//sebs/cpp.sebs")
-
-# ====================================================================
-# Public targets
-
-protobuf_lite = _cpp.Library(
- name = "protobuf-lite",
- srcs = [ "stubs/common.cc",
- "stubs/once.cc",
- "stubs/hash.cc",
- "stubs/hash.h",
- "stubs/map-util.h",
- "stubs/stl_util-inl.h",
- "extension_set.cc",
- "generated_message_util.cc",
- "message_lite.cc",
- "repeated_field.cc",
- "wire_format_lite.cc",
- "io/coded_stream.cc",
- "io/zero_copy_stream.cc",
- "io/zero_copy_stream_impl_lite.cc" ],
- deps = [ _cpp.SystemLibrary(name = "pthread") ])
-
-protobuf = _cpp.Library(
- name = "protobuf",
- srcs = [ "stubs/strutil.cc",
- "stubs/strutil.h",
- "stubs/substitute.cc",
- "stubs/substitute.h",
- "stubs/structurally_valid.cc",
- "descriptor.cc",
- "descriptor.pb.cc",
- "descriptor_database.cc",
- "dynamic_message.cc",
- "extension_set_heavy.cc",
- "generated_message_reflection.cc",
- "message.cc",
- "reflection_ops.cc",
- "service.cc",
- "text_format.cc",
- "unknown_field_set.cc",
- "wire_format.cc",
- "io/gzip_stream.cc",
- "io/printer.cc",
- "io/tokenizer.cc",
- "io/zero_copy_stream_impl.cc",
- "compiler/importer.cc",
- "compiler/parser.cc" ],
- deps = [ protobuf_lite,
- _cpp.SystemLibrary(name = "z") ])
-
-libprotoc = _cpp.Library(
- name = "protoc",
- srcs = [ "compiler/code_generator.cc",
- "compiler/command_line_interface.cc",
- "compiler/cpp/cpp_enum.cc",
- "compiler/cpp/cpp_enum.h",
- "compiler/cpp/cpp_enum_field.cc",
- "compiler/cpp/cpp_enum_field.h",
- "compiler/cpp/cpp_extension.cc",
- "compiler/cpp/cpp_extension.h",
- "compiler/cpp/cpp_field.cc",
- "compiler/cpp/cpp_field.h",
- "compiler/cpp/cpp_file.cc",
- "compiler/cpp/cpp_file.h",
- "compiler/cpp/cpp_generator.cc",
- "compiler/cpp/cpp_helpers.cc",
- "compiler/cpp/cpp_helpers.h",
- "compiler/cpp/cpp_message.cc",
- "compiler/cpp/cpp_message.h",
- "compiler/cpp/cpp_message_field.cc",
- "compiler/cpp/cpp_message_field.h",
- "compiler/cpp/cpp_primitive_field.cc",
- "compiler/cpp/cpp_primitive_field.h",
- "compiler/cpp/cpp_service.cc",
- "compiler/cpp/cpp_service.h",
- "compiler/cpp/cpp_string_field.cc",
- "compiler/cpp/cpp_string_field.h",
- "compiler/java/java_enum.cc",
- "compiler/java/java_enum.h",
- "compiler/java/java_enum_field.cc",
- "compiler/java/java_enum_field.h",
- "compiler/java/java_extension.cc",
- "compiler/java/java_extension.h",
- "compiler/java/java_field.cc",
- "compiler/java/java_field.h",
- "compiler/java/java_file.cc",
- "compiler/java/java_file.h",
- "compiler/java/java_generator.cc",
- "compiler/java/java_helpers.cc",
- "compiler/java/java_helpers.h",
- "compiler/java/java_message.cc",
- "compiler/java/java_message.h",
- "compiler/java/java_message_field.cc",
- "compiler/java/java_message_field.h",
- "compiler/java/java_primitive_field.cc",
- "compiler/java/java_primitive_field.h",
- "compiler/java/java_service.cc",
- "compiler/java/java_service.h",
- "compiler/python/python_generator.cc" ],
- deps = [ protobuf ])
-
-protoc = _cpp.Binary(
- name = "protoc",
- srcs = [ "compiler/main.cc" ],
- deps = [ libprotoc ])
-
-# ====================================================================
-# ProtobufLibrary rule class
-
-class ProtobufLibrary(sebs.Rule):
- argument_spec = sebs.ArgumentSpec(srcs = [sebs.Artifact],
- deps = ([sebs.Rule], []),
- lite = (bool, False))
-
- def _expand(self, args):
- for dep in args.deps:
- if not isinstance(dep, ProtobufLibrary):
- raise sebs.DefinitionError(
- "Dependency of ProtobufLibrary is not a ProtobufLibrary: %s" % dep)
-
- protoc.expand_once()
-
- # We must build protoc for the host configuration to allow cross-compiling.
- host_protoc = self.context.configured_artifact(protoc.binary, "host")
-
- protoc_action = self.context.action(self, "protobuf")
- protoc_args = [host_protoc, "-Isrc", "-Itmp", "-Iinclude","--cpp_out=tmp"]
-
- cpp_srcs = []
- for src in args.srcs:
- protoc_args.append(src)
-
- # We cannot build .proto files from other packages because the .pb.cc
- # and .pb.h files would be written to that package, and we aren't allowed
- # to write to other packages.
- if self.context.local_filename(src) is None:
- raise sebs.DefinitionError(
- "Source file is not in this package: %s" % src)
-
- cc_artifact = self.context.derived_artifact(src, ".pb.cc", protoc_action)
- header_artifact = self.context.derived_artifact(
- src, ".pb.h", protoc_action)
-
- cpp_srcs.append(cc_artifact)
- cpp_srcs.append(header_artifact)
-
- protoc_action.set_command(
- sebs.SubprocessCommand(protoc_action, protoc_args, implicit = cpp_srcs))
-
- deps = list(args.deps)
- if args.lite:
- deps.append(protobuf_lite)
- else:
- deps.append(protobuf)
-
- self.__cpp_library = _cpp.Library(srcs = cpp_srcs, deps = deps,
- context = self.context)
- self.__cpp_library.label = self.label
- self.outputs = []
-
- def as_cpp_library(self):
- self.expand_once()
- return self.__cpp_library
-
-# ====================================================================
-# Tests
-
-_lite_test_protos = ProtobufLibrary(
- srcs = [ "unittest_lite.proto",
- "unittest_import_lite.proto" ],
- lite = True)
-_test_protos = ProtobufLibrary(
- srcs = [ "unittest.proto",
- "unittest_empty.proto",
- "unittest_import.proto",
- "unittest_mset.proto",
- "unittest_optimize_for.proto",
- "unittest_embed_optimize_for.proto",
- "unittest_custom_options.proto",
- "unittest_lite_imports_nonlite.proto",
- "compiler/cpp/cpp_test_bad_identifiers.proto" ],
- deps = [ _lite_test_protos ])
-
-_test_util = _cpp.Library(
- name = "test_util",
- srcs = [ "test_util.cc",
- "test_util.h",
- "testing/googletest.cc",
- "testing/googletest.h",
- "testing/file.cc",
- "testing/file.h" ],
- deps = [ protobuf, _test_protos, _cpp.SystemLibrary(name = "gtest")] )
-
-protobuf_lite_test = _cpp.Test(
- srcs = [ "lite_unittest.cc",
- "test_util_lite.cc",
- "test_util_lite.h" ],
- deps = [ _lite_test_protos ])
-
-protobuf_test = _cpp.Test(
- srcs = [ "stubs/common_unittest.cc",
- "stubs/once_unittest.cc",
- "stubs/strutil_unittest.cc",
- "stubs/structurally_valid_unittest.cc",
- "descriptor_database_unittest.cc",
- "descriptor_unittest.cc",
- "dynamic_message_unittest.cc",
- "extension_set_unittest.cc",
- "generated_message_reflection_unittest.cc",
- "message_unittest.cc",
- "reflection_ops_unittest.cc",
- "repeated_field_unittest.cc",
- "text_format_unittest.cc",
- "unknown_field_set_unittest.cc",
- "wire_format_unittest.cc",
- "io/coded_stream_unittest.cc",
- "io/printer_unittest.cc",
- "io/tokenizer_unittest.cc",
- "io/zero_copy_stream_unittest.cc",
- "compiler/command_line_interface_unittest.cc",
- "compiler/importer_unittest.cc",
- "compiler/parser_unittest.cc",
- "compiler/cpp/cpp_bootstrap_unittest.cc",
- "compiler/cpp/cpp_unittest.cc" ],
- deps = [ protobuf, libprotoc, _test_util,
- _cpp.SystemLibrary(name = "gtest_main") ])
@@ -0,0 +1,80 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// http://code.google.com/p/protobuf/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Author: kenton@google.com (Kenton Varda)
+// Based on original Protocol Buffers design by
+// Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <google/protobuf/compiler/code_generator.h>
+
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+
+CodeGenerator::~CodeGenerator() {}
+GeneratorContext::~GeneratorContext() {}
+
+io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert(
+ const string& filename, const string& insertion_point) {
+ GOOGLE_LOG(FATAL) << "This GeneratorContext does not support insertion.";
+ return NULL; // make compiler happy
+}
+
+void GeneratorContext::ListParsedFiles(
+ vector<const FileDescriptor*>* output) {
+ GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles";
+}
+
+// Parses a set of comma-delimited name/value pairs.
+void ParseGeneratorParameter(const string& text,
+ vector<pair<string, string> >* output) {
+ vector<string> parts;
+ SplitStringUsing(text, ",", &parts);
+
+ for (int i = 0; i < parts.size(); i++) {
+ string::size_type equals_pos = parts[i].find_first_of('=');
+ pair<string, string> value;
+ if (equals_pos == string::npos) {
+ value.first = parts[i];
+ value.second = "";
+ } else {
+ value.first = parts[i].substr(0, equals_pos);
+ value.second = parts[i].substr(equals_pos + 1);
+ }
+ output->push_back(value);
+ }
+}
+
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
Oops, something went wrong.

0 comments on commit b4d9f97

Please sign in to comment.