Commit Graph
15 Commits
Author SHA1 Message Date
Konstantin Varlamov f243335a25 Don't define a util namespace alias in the global namespace. (#8527)
This would conflict with any definition of a `util` namespace imported from a header. While this applies to other aliases as well, `util` is the one most likely to clash and the one that has actually caused problems.

#no-changelog
2021-09-24 09:11:41 -06:00
Sebastian Schmidt e8f419baf2 Migrate FieldValue to Protobuf (#8124) 2021-07-22 12:44:17 -06:00
Ehsan acc2d15b29 Fix warnings generated by Clang-Tidy (#8181)
* Remove unused namespace alias.

* Remove unused 'using' statements.

* Remove more unused 'using' and namspace aliases.

* Prefer absl::StrContains over comparing `find` result with `npos`.

* Remove more unused things.

* Prefer usage of `empty()` over `size()` when possible.

* Remove more unused things.

* Address code review.

* Address code review.

* More fixes to query_core.cc

* comment should match parameter name.

* Pre-allocate container capacity for better performance.

* More fixes.

* Fix inconsistent declaration parameter name.

* Fix inconsistent declaration parameter name.

* Fix inconsistent declaration parameter name.

* Address bugprone-inaccurate-erase (inappropriate `erase` overload was used).

* Fix return type of move and copy constructor.

* Fix bugprone use after move.

* Fix formatting.

* Reflect the param name change in the doc.
2021-06-04 10:33:43 -05:00
Gil 7a58eba2e5 Remove firebase/firestore from paths in Firestore/core (#5374)
* Manual Xcode project fixups

* Remove `firebase/firestore` from paths in Firestore/core

This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.

Concretely:

  * `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
  * `Firebase/core/test/firebase/firestore` becomes
    `Firebase/core/test/unit`

Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
2020-04-20 14:57:34 -07:00
Gil d9b7a33f0c Use forward declarations instead of IWYU (#4868)
* Remove rarely used template argumnets from SortedMap/SortedSet

* Remove unused STATUS_CHECK_OK

* Rename QuerySnapshot::Listener to QuerySnapshotListener

This makes the type something that can be forward declared.

* Rename DocumentSnapshot::Listener to DocumentSnapshotListener

This makes the type something that can be forward declared.

* Rename ViewSnapshot::Listener to ViewSnapshotListener

This makes the type something that can be forward declared.

* Put most QueryListener implementation in .cc

* Actually use sync_engine_callback.h

* Add forward declaration headers for api, core, and model

These centralize forward declarations, including declarations for some
hard-to-forward-declare types.

* Move includes of hard_assert.h out of other headers

* Make testutil definitions out of line

* Move definitions out-of-line

* Move DocumentKey definitions out-of-line

* Move definitions out-of-line

* Shorten unnecessarily long namespace usages

* Use default destructors where possible

* Delete unused MutationBatch::kUnknown constant

* Use forward declarations instead of IWYU

* Misc fixups from Linux/GCC 9.2.1

* Fix testutil under VS 2017

Forward declarations of functions local to a function body end up
generating unresolved externals. Reduce most of these back to just
calling FieldValue::FromX methods.
2020-02-15 14:34:38 -08:00
Michael Lehenbauer 27b2f0a19c Port FIRWriteBatch. (#2844)
* Create api::WriteBatch "port" of FIRWriteBatch.
* Make FIRWriteBatch a wrapper around an api::WriteBatch (and a FSTUserDataConverter for parsing input).
2019-04-18 10:34:53 -07:00
Gil cad35b18d8 Migrate api::Firestore completions to C++ (#2831)
* Make error_apple definitions out-of-line

* Add util::MakeCallback

Translates between API completion handlers that take just an NSError and
the equivalent std::function that accepts util::Status.

* Port DocumentReference::Completion to a std::function callback

* Port Firestore::ErrorCompletions to StatusCallback

* Port transaction-related completions to C++

* Remove now-unused FSTVoidIDErrorBlock

* Fix tunneling of Firestore-generated NSErrors.

Remove MakeStatus(NSError*) because it has different results from
Status::FromNSError. Ensure that user-supplied errors created in
transactions tunnel through correctly.
2019-04-16 17:37:38 -07:00
Michael Lehenbauer 09010cfba0 Fix a couple small issues I tripped over today. (#2806)
* Fix a couple small issues I tripped over today.

1. Fix primeBackend so it uses an isolated FIRFirestore* instance. I ran into
   an issue where tests that try to change .settings would fail if they were the
   very first test run, since primeBackend had already configured the client and
   so settings could no longer be changed.
2. Remove FIRFirestore.client and make api::Firestore.client() assert client is configured.
2019-04-11 10:40:56 -07:00
Gil 2e8b9181fa Port FSTUsageValidation to C++ (#2670)
* Port FSTUsageValidation to C++

* Add an error log level
2019-03-28 13:19:28 -07:00
Konstantin Varlamov a22b4cd08e Pass FSTMutations using a vector (#2357) 2019-02-07 22:03:17 -05:00
Gil a40a43c058 Port user data handling to C++ (#1823)
Extract useful bits of FSTUserDataConverter for use in C++:
  * Migrate FSTParsedSetData to core::ParsedSetData
  * Migrate FSTParsedUpdateData to core::ParsedUpdateData
  * Migrate FSTParseContext to core::ParseContext
  * Split ParseAccumulator out of ParseContext to make ownership easier

Also:
  * Remove dead code (handled in parseSentinelFieldValue)
  * Flatten App/iOS/Supporting Files into the parent
2018-09-18 09:19:11 -07:00
Sebastian Schmidt 542d81ac68 Adding mergeFields support (#1141) 2018-05-02 11:10:19 -07:00
Gil 5368c9e22f Replace the SetOptions object with a simple boolean. (#1098)
Instead of calling

  `setData(["a": "b"], options: SetOptions.merge())`

call

  `setData(["a": "b"], merge: true)`
2018-04-15 13:06:06 -07:00
zxu 2ceea9b66e Port Precondition to C++ (#1040)
* port FieldMask to C++

* address changes

* address changes

* fix test

* address change

* Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++

* address changes

* address changes

* address changes

* implement `FieldTransform` in C++

* port `FieldTransform`

* make `fieldTransforms` shared inside `context`

* Implement Precondition in C++ w/o test yet

* add unit test for `Precondition`

* port `Precondition`

* address changes

* address changes

* fix bugs for integration test

* address changes

* fix lint

* address changes

* address changes
2018-04-12 21:32:19 -04:00
Gil 729b8d176c Move all Firestore Objective-C to Objective-C++ (#734)
* Move all Firestore files to Objective-C++
* Update project file references
* Don't use module imports from Objective-C++
* Use extern "C" for C-accessible globals
* Work around more stringent type checking in Objective-C++
  * NSMutableDictionary ivars aren't implicitly casted to NSDictionary
  * FSTMaybeDocument callback can't be passed a function that accepts
    FSTDocument
  * NSComparisonResult can't be multiplied by -1 without casting
* Add a #include <inttypes.h> where needed
* Avoid using C++ keywords as variables
* Remove #if __cplusplus guards
2018-01-31 11:23:55 -08:00