From 8f41b813bff85f58f9b96d6ec5dcc762d36ff535 Mon Sep 17 00:00:00 2001 From: Marek Gilbert Date: Sun, 4 Nov 2018 14:25:20 -0800 Subject: [PATCH 1/3] Add C++ namespaces and use C++ linkage for nanopb-generated sources. --- Firestore/Protos/CMakeLists.txt | 2 +- Firestore/Protos/build_protos.py | 62 ++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/Firestore/Protos/CMakeLists.txt b/Firestore/Protos/CMakeLists.txt index ae418a2ad23..7b06e721449 100644 --- a/Firestore/Protos/CMakeLists.txt +++ b/Firestore/Protos/CMakeLists.txt @@ -67,7 +67,7 @@ endforeach() foreach(root ${PROTO_FILE_ROOTS} ${WELL_KNOWN_PROTO_FILE_ROOTS}) list( APPEND NANOPB_GENERATED_SOURCES - ${OUTPUT_DIR}/nanopb/${root}.nanopb.c + ${OUTPUT_DIR}/nanopb/${root}.nanopb.cc ${OUTPUT_DIR}/nanopb/${root}.nanopb.h ) endforeach() diff --git a/Firestore/Protos/build_protos.py b/Firestore/Protos/build_protos.py index 997537731d1..35ad7f9490b 100755 --- a/Firestore/Protos/build_protos.py +++ b/Firestore/Protos/build_protos.py @@ -121,8 +121,14 @@ def run(self): self.__run_generator(nanopb_out) - sources = collect_files(nanopb_out, '.nanopb.h', '.nanopb.c') - post_process_files(sources, add_copyright, nanopb_rename_delete) + sources = collect_files(nanopb_out, '.nanopb.h', '.nanopb.cc') + post_process_files( + sources, + add_copyright, + nanopb_add_namespaces, + nanopb_remove_extern_c, + nanopb_rename_delete + ) def __run_generator(self, out_dir): """Invokes protoc using the nanopb plugin.""" @@ -133,6 +139,7 @@ def __run_generator(self, out_dir): nanopb_flags = ' '.join([ '--extension=.nanopb', + '--source-extension=.cc', '--no-timestamp', ]) cmd.append('--nanopb_out=%s:%s' % (nanopb_flags, out_dir)) @@ -286,6 +293,57 @@ def add_copyright(lines): return result +def nanopb_add_namespaces(lines): + """Adds C++ namespaces to the lines. + + Args: + lines: The lines to fix. + + Returns: + The lines, fixed. + """ + result = [] + for line in lines: + if '@@protoc_insertion_point(includes)' in line: + result.append('namespace firebase {\n') + result.append('namespace firestore {\n') + result.append('\n') + + if '@@protoc_insertion_point(eof)' in line: + result.append('} // namespace firestore\n') + result.append('} // namespace firebase\n') + result.append('\n') + + result.append(line) + + return result + + +def nanopb_remove_extern_c(lines): + """Removes extern "C" directives from nanopb code. + + Args: + lines: A nanobp-generated source file, split into lines. + Returns: + A list of strings, similar to the input but modified to remove extern "C". + """ + result = [] + state = 'initial' + for line in lines: + if state == 'initial': + if '#ifdef __cplusplus' in line: + state = 'in-ifdef' + continue + + result.append(line) + + elif state == 'in-ifdef': + if '#endif' in line: + state = 'initial' + + return result + + def nanopb_rename_delete(lines): """Renames a delete symbol to delete_. From c4e1af3ac5895ee4d892cb52484cb203b90cedfd Mon Sep 17 00:00:00 2001 From: Marek Gilbert Date: Sun, 4 Nov 2018 14:38:42 -0800 Subject: [PATCH 2/3] Regenerate nanopb sources as C++ --- ...be_document.nanopb.c => maybe_document.nanopb.cc} | 6 ++++++ .../nanopb/firestore/local/maybe_document.nanopb.h | 12 ++++++------ .../local/{mutation.nanopb.c => mutation.nanopb.cc} | 6 ++++++ .../Protos/nanopb/firestore/local/mutation.nanopb.h | 12 ++++++------ .../local/{target.nanopb.c => target.nanopb.cc} | 6 ++++++ .../Protos/nanopb/firestore/local/target.nanopb.h | 12 ++++++------ .../{annotations.nanopb.c => annotations.nanopb.cc} | 6 ++++++ .../Protos/nanopb/google/api/annotations.nanopb.h | 12 ++++++------ .../google/api/{http.nanopb.c => http.nanopb.cc} | 6 ++++++ Firestore/Protos/nanopb/google/api/http.nanopb.h | 12 ++++++------ .../v1beta1/{common.nanopb.c => common.nanopb.cc} | 6 ++++++ .../nanopb/google/firestore/v1beta1/common.nanopb.h | 12 ++++++------ .../{document.nanopb.c => document.nanopb.cc} | 6 ++++++ .../google/firestore/v1beta1/document.nanopb.h | 12 ++++++------ .../{firestore.nanopb.c => firestore.nanopb.cc} | 6 ++++++ .../google/firestore/v1beta1/firestore.nanopb.h | 12 ++++++------ .../v1beta1/{query.nanopb.c => query.nanopb.cc} | 6 ++++++ .../nanopb/google/firestore/v1beta1/query.nanopb.h | 12 ++++++------ .../v1beta1/{write.nanopb.c => write.nanopb.cc} | 6 ++++++ .../nanopb/google/firestore/v1beta1/write.nanopb.h | 12 ++++++------ .../google/protobuf/{any.nanopb.c => any.nanopb.cc} | 6 ++++++ Firestore/Protos/nanopb/google/protobuf/any.nanopb.h | 12 ++++++------ .../protobuf/{empty.nanopb.c => empty.nanopb.cc} | 6 ++++++ .../Protos/nanopb/google/protobuf/empty.nanopb.h | 12 ++++++------ .../protobuf/{struct.nanopb.c => struct.nanopb.cc} | 6 ++++++ .../Protos/nanopb/google/protobuf/struct.nanopb.h | 12 ++++++------ .../{timestamp.nanopb.c => timestamp.nanopb.cc} | 6 ++++++ .../Protos/nanopb/google/protobuf/timestamp.nanopb.h | 12 ++++++------ .../{wrappers.nanopb.c => wrappers.nanopb.cc} | 6 ++++++ .../Protos/nanopb/google/protobuf/wrappers.nanopb.h | 12 ++++++------ .../google/rpc/{status.nanopb.c => status.nanopb.cc} | 6 ++++++ Firestore/Protos/nanopb/google/rpc/status.nanopb.h | 12 ++++++------ .../type/{latlng.nanopb.c => latlng.nanopb.cc} | 6 ++++++ Firestore/Protos/nanopb/google/type/latlng.nanopb.h | 12 ++++++------ 34 files changed, 204 insertions(+), 102 deletions(-) rename Firestore/Protos/nanopb/firestore/local/{maybe_document.nanopb.c => maybe_document.nanopb.cc} (97%) rename Firestore/Protos/nanopb/firestore/local/{mutation.nanopb.c => mutation.nanopb.cc} (96%) rename Firestore/Protos/nanopb/firestore/local/{target.nanopb.c => target.nanopb.cc} (97%) rename Firestore/Protos/nanopb/google/api/{annotations.nanopb.c => annotations.nanopb.cc} (92%) rename Firestore/Protos/nanopb/google/api/{http.nanopb.c => http.nanopb.cc} (97%) rename Firestore/Protos/nanopb/google/firestore/v1beta1/{common.nanopb.c => common.nanopb.cc} (97%) rename Firestore/Protos/nanopb/google/firestore/v1beta1/{document.nanopb.c => document.nanopb.cc} (98%) rename Firestore/Protos/nanopb/google/firestore/v1beta1/{firestore.nanopb.c => firestore.nanopb.cc} (99%) rename Firestore/Protos/nanopb/google/firestore/v1beta1/{query.nanopb.c => query.nanopb.cc} (99%) rename Firestore/Protos/nanopb/google/firestore/v1beta1/{write.nanopb.c => write.nanopb.cc} (98%) rename Firestore/Protos/nanopb/google/protobuf/{any.nanopb.c => any.nanopb.cc} (92%) rename Firestore/Protos/nanopb/google/protobuf/{empty.nanopb.c => empty.nanopb.cc} (91%) rename Firestore/Protos/nanopb/google/protobuf/{struct.nanopb.c => struct.nanopb.cc} (97%) rename Firestore/Protos/nanopb/google/protobuf/{timestamp.nanopb.c => timestamp.nanopb.cc} (92%) rename Firestore/Protos/nanopb/google/protobuf/{wrappers.nanopb.c => wrappers.nanopb.cc} (96%) rename Firestore/Protos/nanopb/google/rpc/{status.nanopb.c => status.nanopb.cc} (93%) rename Firestore/Protos/nanopb/google/type/{latlng.nanopb.c => latlng.nanopb.cc} (93%) diff --git a/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.c b/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.cc similarity index 97% rename from Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.c rename to Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.cc index 86f3ac89981..bb3e2433f6e 100644 --- a/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.c +++ b/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.cc @@ -19,6 +19,9 @@ #include "maybe_document.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -71,4 +74,7 @@ PB_STATIC_ASSERT((pb_membersize(firestore_client_NoDocument, read_time) < 256 && #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h b/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h index e10dc747765..9d490c8bb69 100644 --- a/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h +++ b/Firestore/Protos/nanopb/firestore/local/maybe_document.nanopb.h @@ -25,14 +25,14 @@ #include "google/protobuf/timestamp.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _firestore_client_NoDocument { @@ -96,9 +96,9 @@ extern const pb_field_t firestore_client_MaybeDocument_fields[5]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.c b/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.cc similarity index 96% rename from Firestore/Protos/nanopb/firestore/local/mutation.nanopb.c rename to Firestore/Protos/nanopb/firestore/local/mutation.nanopb.cc index cb34dfe3494..f1e606a8991 100644 --- a/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.c +++ b/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.cc @@ -19,6 +19,9 @@ #include "mutation.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -64,4 +67,7 @@ PB_STATIC_ASSERT((pb_membersize(firestore_client_WriteBatch, local_write_time) < #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h b/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h index 635c10b4df1..3403fd095b7 100644 --- a/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h +++ b/Firestore/Protos/nanopb/firestore/local/mutation.nanopb.h @@ -25,14 +25,14 @@ #include "google/protobuf/timestamp.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _firestore_client_MutationQueue { @@ -80,9 +80,9 @@ extern const pb_field_t firestore_client_WriteBatch_fields[4]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/firestore/local/target.nanopb.c b/Firestore/Protos/nanopb/firestore/local/target.nanopb.cc similarity index 97% rename from Firestore/Protos/nanopb/firestore/local/target.nanopb.c rename to Firestore/Protos/nanopb/firestore/local/target.nanopb.cc index adf16c09696..96b5c4ba5f2 100644 --- a/Firestore/Protos/nanopb/firestore/local/target.nanopb.c +++ b/Firestore/Protos/nanopb/firestore/local/target.nanopb.cc @@ -19,6 +19,9 @@ #include "target.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -69,4 +72,7 @@ PB_STATIC_ASSERT((pb_membersize(firestore_client_Target, query) < 256 && pb_memb #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/firestore/local/target.nanopb.h b/Firestore/Protos/nanopb/firestore/local/target.nanopb.h index cb223025d86..76fbd493462 100644 --- a/Firestore/Protos/nanopb/firestore/local/target.nanopb.h +++ b/Firestore/Protos/nanopb/firestore/local/target.nanopb.h @@ -25,14 +25,14 @@ #include "google/protobuf/timestamp.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _firestore_client_Target { @@ -92,9 +92,9 @@ extern const pb_field_t firestore_client_TargetGlobal_fields[5]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/api/annotations.nanopb.c b/Firestore/Protos/nanopb/google/api/annotations.nanopb.cc similarity index 92% rename from Firestore/Protos/nanopb/google/api/annotations.nanopb.c rename to Firestore/Protos/nanopb/google/api/annotations.nanopb.cc index e35260ccdcf..613bcf66636 100644 --- a/Firestore/Protos/nanopb/google/api/annotations.nanopb.c +++ b/Firestore/Protos/nanopb/google/api/annotations.nanopb.cc @@ -19,6 +19,9 @@ #include "annotations.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -34,4 +37,7 @@ #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/api/annotations.nanopb.h b/Firestore/Protos/nanopb/google/api/annotations.nanopb.h index 968eac2d568..2ef2a03805b 100644 --- a/Firestore/Protos/nanopb/google/api/annotations.nanopb.h +++ b/Firestore/Protos/nanopb/google/api/annotations.nanopb.h @@ -23,22 +23,22 @@ #include "google/api/http.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Extensions */ /* Extension field google_api_http was skipped because only "optional" type of extension fields is currently supported. */ -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/api/http.nanopb.c b/Firestore/Protos/nanopb/google/api/http.nanopb.cc similarity index 97% rename from Firestore/Protos/nanopb/google/api/http.nanopb.c rename to Firestore/Protos/nanopb/google/api/http.nanopb.cc index 55e66731bbb..151b1fc987a 100644 --- a/Firestore/Protos/nanopb/google/api/http.nanopb.c +++ b/Firestore/Protos/nanopb/google/api/http.nanopb.cc @@ -19,6 +19,9 @@ #include "http.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -76,4 +79,7 @@ PB_STATIC_ASSERT((pb_membersize(google_api_HttpRule, custom) < 256), YOU_MUST_DE #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/api/http.nanopb.h b/Firestore/Protos/nanopb/google/api/http.nanopb.h index af38bc3c499..9e8ea1eee11 100644 --- a/Firestore/Protos/nanopb/google/api/http.nanopb.h +++ b/Firestore/Protos/nanopb/google/api/http.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_API_HTTP_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_api_CustomHttpPattern { @@ -104,9 +104,9 @@ extern const pb_field_t google_api_CustomHttpPattern_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.c b/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.cc similarity index 97% rename from Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.c rename to Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.cc index 97b06c0c3de..1febff4d9a7 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.c +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.cc @@ -19,6 +19,9 @@ #include "common.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -78,4 +81,7 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1beta1_Precondition, update_ti #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.h b/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.h index a35ac743c7c..6e0a3d67da7 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.h +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/common.nanopb.h @@ -25,14 +25,14 @@ #include "google/protobuf/timestamp.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_firestore_v1beta1_DocumentMask { @@ -117,9 +117,9 @@ extern const pb_field_t google_firestore_v1beta1_TransactionOptions_ReadOnly_fie #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.c b/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.cc similarity index 98% rename from Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.c rename to Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.cc index 10d3fd1ce3f..ae1279db6d9 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.c +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.cc @@ -19,6 +19,9 @@ #include "document.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -96,4 +99,7 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1beta1_Document, create_time) #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.h b/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.h index acc0e9894f9..5dab4155a4e 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.h +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/document.nanopb.h @@ -29,14 +29,14 @@ #include "google/type/latlng.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_firestore_v1beta1_ArrayValue { @@ -153,9 +153,9 @@ extern const pb_field_t google_firestore_v1beta1_MapValue_FieldsEntry_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.c b/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.cc similarity index 99% rename from Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.c rename to Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.cc index f3782aae322..ab9937e540e 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.c +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.cc @@ -19,6 +19,9 @@ #include "firestore.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -256,4 +259,7 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1beta1_GetDocumentRequest, rea #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.h b/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.h index 8e030f40352..af1b6b8af6e 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.h +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/firestore.nanopb.h @@ -37,14 +37,14 @@ #include "google/rpc/status.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Enum definitions */ typedef enum _google_firestore_v1beta1_TargetChange_TargetChangeType { @@ -529,9 +529,9 @@ extern const pb_field_t google_firestore_v1beta1_ListCollectionIdsResponse_field #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.c b/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.cc similarity index 99% rename from Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.c rename to Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.cc index 9a87b60c53f..a3cc81500c3 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.c +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.cc @@ -19,6 +19,9 @@ #include "query.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -121,4 +124,7 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1beta1_StructuredQuery, select #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.h b/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.h index e369f7d29e6..26cd0dbd3e9 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.h +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/query.nanopb.h @@ -27,14 +27,14 @@ #include "google/protobuf/wrappers.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Enum definitions */ typedef enum _google_firestore_v1beta1_StructuredQuery_Direction { @@ -238,9 +238,9 @@ extern const pb_field_t google_firestore_v1beta1_Cursor_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.c b/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.cc similarity index 98% rename from Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.c rename to Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.cc index 55c2159e8ce..9abc7512bd9 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.c +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.cc @@ -19,6 +19,9 @@ #include "write.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -108,4 +111,7 @@ PB_STATIC_ASSERT((pb_membersize(google_firestore_v1beta1_Write, update) < 256 && #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.h b/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.h index a9936f36e9c..27ad4369a8d 100644 --- a/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.h +++ b/Firestore/Protos/nanopb/google/firestore/v1beta1/write.nanopb.h @@ -29,14 +29,14 @@ #include "google/protobuf/timestamp.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Enum definitions */ typedef enum _google_firestore_v1beta1_DocumentTransform_FieldTransform_ServerValue { @@ -190,9 +190,9 @@ extern const pb_field_t google_firestore_v1beta1_ExistenceFilter_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/protobuf/any.nanopb.c b/Firestore/Protos/nanopb/google/protobuf/any.nanopb.cc similarity index 92% rename from Firestore/Protos/nanopb/google/protobuf/any.nanopb.c rename to Firestore/Protos/nanopb/google/protobuf/any.nanopb.cc index a7a6d99718b..f88662daada 100644 --- a/Firestore/Protos/nanopb/google/protobuf/any.nanopb.c +++ b/Firestore/Protos/nanopb/google/protobuf/any.nanopb.cc @@ -19,6 +19,9 @@ #include "any.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -33,4 +36,7 @@ const pb_field_t google_protobuf_Any_fields[3] = { }; +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/protobuf/any.nanopb.h b/Firestore/Protos/nanopb/google/protobuf/any.nanopb.h index b9e9a4a0348..a9ca0c158b5 100644 --- a/Firestore/Protos/nanopb/google/protobuf/any.nanopb.h +++ b/Firestore/Protos/nanopb/google/protobuf/any.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_PROTOBUF_ANY_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_protobuf_Any { @@ -61,9 +61,9 @@ extern const pb_field_t google_protobuf_Any_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.c b/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.cc similarity index 91% rename from Firestore/Protos/nanopb/google/protobuf/empty.nanopb.c rename to Firestore/Protos/nanopb/google/protobuf/empty.nanopb.cc index 28e0ead7887..adce8fc8361 100644 --- a/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.c +++ b/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.cc @@ -19,6 +19,9 @@ #include "empty.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -31,4 +34,7 @@ const pb_field_t google_protobuf_Empty_fields[1] = { }; +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.h b/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.h index 15ec180ac18..59070a0ce1b 100644 --- a/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.h +++ b/Firestore/Protos/nanopb/google/protobuf/empty.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_PROTOBUF_EMPTY_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_protobuf_Empty { @@ -58,9 +58,9 @@ extern const pb_field_t google_protobuf_Empty_fields[1]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.c b/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.cc similarity index 97% rename from Firestore/Protos/nanopb/google/protobuf/struct.nanopb.c rename to Firestore/Protos/nanopb/google/protobuf/struct.nanopb.cc index 2b08489a486..37644b13721 100644 --- a/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.c +++ b/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.cc @@ -19,6 +19,9 @@ #include "struct.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -78,4 +81,7 @@ PB_STATIC_ASSERT((pb_membersize(google_protobuf_Struct_FieldsEntry, value) < 256 #endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.h b/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.h index e79e596447c..a71439e0849 100644 --- a/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.h +++ b/Firestore/Protos/nanopb/google/protobuf/struct.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_PROTOBUF_STRUCT_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Enum definitions */ typedef enum _google_protobuf_NullValue { @@ -114,9 +114,9 @@ extern const pb_field_t google_protobuf_ListValue_fields[2]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.c b/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.cc similarity index 92% rename from Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.c rename to Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.cc index 55366e4cead..9814b20d010 100644 --- a/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.c +++ b/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.cc @@ -19,6 +19,9 @@ #include "timestamp.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -33,4 +36,7 @@ const pb_field_t google_protobuf_Timestamp_fields[3] = { }; +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.h b/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.h index 10ce8a6a138..57ac091565f 100644 --- a/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.h +++ b/Firestore/Protos/nanopb/google/protobuf/timestamp.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_PROTOBUF_TIMESTAMP_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_protobuf_Timestamp { @@ -61,9 +61,9 @@ extern const pb_field_t google_protobuf_Timestamp_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.c b/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.cc similarity index 96% rename from Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.c rename to Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.cc index 228e55de7ea..915459a85c2 100644 --- a/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.c +++ b/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.cc @@ -19,6 +19,9 @@ #include "wrappers.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -78,4 +81,7 @@ const pb_field_t google_protobuf_BytesValue_fields[2] = { */ PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES) +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.h b/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.h index 17f91c5d4f1..de0ed65eb66 100644 --- a/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.h +++ b/Firestore/Protos/nanopb/google/protobuf/wrappers.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_PROTOBUF_WRAPPERS_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_protobuf_BytesValue { @@ -139,9 +139,9 @@ extern const pb_field_t google_protobuf_BytesValue_fields[2]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/rpc/status.nanopb.c b/Firestore/Protos/nanopb/google/rpc/status.nanopb.cc similarity index 93% rename from Firestore/Protos/nanopb/google/rpc/status.nanopb.c rename to Firestore/Protos/nanopb/google/rpc/status.nanopb.cc index 6fcebb3f455..e340d83a66c 100644 --- a/Firestore/Protos/nanopb/google/rpc/status.nanopb.c +++ b/Firestore/Protos/nanopb/google/rpc/status.nanopb.cc @@ -19,6 +19,9 @@ #include "status.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -34,4 +37,7 @@ const pb_field_t google_rpc_Status_fields[4] = { }; +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/rpc/status.nanopb.h b/Firestore/Protos/nanopb/google/rpc/status.nanopb.h index 97ae548efc7..6186d61ad5f 100644 --- a/Firestore/Protos/nanopb/google/rpc/status.nanopb.h +++ b/Firestore/Protos/nanopb/google/rpc/status.nanopb.h @@ -23,14 +23,14 @@ #include "google/protobuf/any.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_rpc_Status { @@ -66,9 +66,9 @@ extern const pb_field_t google_rpc_Status_fields[4]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif diff --git a/Firestore/Protos/nanopb/google/type/latlng.nanopb.c b/Firestore/Protos/nanopb/google/type/latlng.nanopb.cc similarity index 93% rename from Firestore/Protos/nanopb/google/type/latlng.nanopb.c rename to Firestore/Protos/nanopb/google/type/latlng.nanopb.cc index 6325af38d7f..53a7d70fafd 100644 --- a/Firestore/Protos/nanopb/google/type/latlng.nanopb.c +++ b/Firestore/Protos/nanopb/google/type/latlng.nanopb.cc @@ -19,6 +19,9 @@ #include "latlng.nanopb.h" +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. @@ -39,4 +42,7 @@ const pb_field_t google_type_LatLng_fields[3] = { */ PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES) +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ diff --git a/Firestore/Protos/nanopb/google/type/latlng.nanopb.h b/Firestore/Protos/nanopb/google/type/latlng.nanopb.h index 4e73dfef2bb..2b756f5f1d8 100644 --- a/Firestore/Protos/nanopb/google/type/latlng.nanopb.h +++ b/Firestore/Protos/nanopb/google/type/latlng.nanopb.h @@ -21,14 +21,14 @@ #define PB_GOOGLE_TYPE_LATLNG_NANOPB_H_INCLUDED #include +namespace firebase { +namespace firestore { + /* @@protoc_insertion_point(includes) */ #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif /* Struct definitions */ typedef struct _google_type_LatLng { @@ -61,9 +61,9 @@ extern const pb_field_t google_type_LatLng_fields[3]; #endif -#ifdef __cplusplus -} /* extern "C" */ -#endif +} // namespace firestore +} // namespace firebase + /* @@protoc_insertion_point(eof) */ #endif From d1f0832ce6a06eef549c65034501cdeae6b7dbec Mon Sep 17 00:00:00 2001 From: Marek Gilbert Date: Sun, 4 Nov 2018 14:41:47 -0800 Subject: [PATCH 3/3] Add generated C++ nanopb sources to the podspec --- FirebaseFirestore.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index cbdd8c201de..3066e231cfe 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -25,7 +25,7 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, s.source_files = [ 'Firestore/Source/**/*', 'Firestore/Port/**/*', - 'Firestore/Protos/nanopb/**/*.[hc]', + 'Firestore/Protos/nanopb/**/*.{h,cc}', 'Firestore/Protos/objc/**/*.[hm]', 'Firestore/core/include/**/*.{h,cc,mm}', 'Firestore/core/src/**/*.{h,cc,mm}',