Skip to content

Don't use using statements in Objective-C headers ... #2827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Firestore/Example/Tests/API/FIRQuerySnapshotTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"

namespace util = firebase::firestore::util;
using firebase::firestore::api::DocumentChange;
using firebase::firestore::api::DocumentSnapshot;
using firebase::firestore::api::Firestore;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::core::DocumentViewChange;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::model::DocumentKeySet;
Expand Down
1 change: 1 addition & 0 deletions Firestore/Example/Tests/API/FSTAPIHelpers.mm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

namespace testutil = firebase::firestore::testutil;
namespace util = firebase::firestore::util;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::core::DocumentViewChange;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::model::DocumentKeySet;
Expand Down
1 change: 1 addition & 0 deletions Firestore/Example/Tests/Core/FSTEventManagerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

using firebase::firestore::core::EventListener;
using firebase::firestore::core::ListenOptions;
using firebase::firestore::core::QueryListener;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::model::DocumentKeySet;
using firebase::firestore::model::DocumentSet;
Expand Down
1 change: 1 addition & 0 deletions Firestore/Example/Tests/Core/FSTQueryListenerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
using firebase::firestore::core::DocumentViewChange;
using firebase::firestore::core::EventListener;
using firebase::firestore::core::ListenOptions;
using firebase::firestore::core::QueryListener;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::model::DocumentKeySet;
using firebase::firestore::model::DocumentSet;
Expand Down
1 change: 1 addition & 0 deletions Firestore/Example/Tests/Integration/FSTDatastoreTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
using firebase::firestore::model::DatabaseId;
using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::DocumentKeySet;
using firebase::firestore::model::FieldValue;
using firebase::firestore::model::Precondition;
using firebase::firestore::model::OnlineState;
using firebase::firestore::model::TargetId;
Expand Down
1 change: 1 addition & 0 deletions Firestore/Example/Tests/Model/FSTDocumentTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace testutil = firebase::firestore::testutil;
using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::FieldValue;
using firebase::firestore::model::SnapshotVersion;

NS_ASSUME_NONNULL_BEGIN
Expand Down
1 change: 1 addition & 0 deletions Firestore/Example/Tests/Remote/FSTSerializerBetaTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
using firebase::firestore::model::DatabaseId;
using firebase::firestore::model::FieldMask;
using firebase::firestore::model::FieldTransform;
using firebase::firestore::model::FieldValue;
using firebase::firestore::model::Precondition;
using firebase::firestore::model::SnapshotVersion;
using firebase::firestore::remote::DocumentWatchChange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
using firebase::firestore::auth::User;
using firebase::firestore::core::DatabaseInfo;
using firebase::firestore::core::ListenOptions;
using firebase::firestore::core::QueryListener;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::model::DatabaseId;
using firebase::firestore::model::DocumentKey;
Expand Down
4 changes: 3 additions & 1 deletion Firestore/Source/API/FIRCollectionReference+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

#include "Firestore/core/src/firebase/firestore/model/resource_path.h"

namespace model = firebase::firestore::model;

NS_ASSUME_NONNULL_BEGIN

/** Internal FIRCollectionReference API we don't want exposed in our public header files. */
@interface FIRCollectionReference (Internal)
+ (instancetype)referenceWithPath:(const firebase::firestore::model::ResourcePath &)path
+ (instancetype)referenceWithPath:(const model::ResourcePath &)path
firestore:(FIRFirestore *)firestore;
@end

Expand Down
5 changes: 3 additions & 2 deletions Firestore/Source/API/FIRDocumentChange+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

#include "Firestore/core/src/firebase/firestore/api/document_change.h"

using firebase::firestore::api::DocumentChange;
namespace api = firebase::firestore::api;

NS_ASSUME_NONNULL_BEGIN

@interface FIRDocumentChange (/* Init */)

- (instancetype)initWithDocumentChange:(DocumentChange &&)documentChange NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDocumentChange:(api::DocumentChange &&)documentChange
NS_DESIGNATED_INITIALIZER;

@end

Expand Down
14 changes: 7 additions & 7 deletions Firestore/Source/API/FIRDocumentReference+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/resource_path.h"

namespace api = firebase::firestore::api;
namespace model = firebase::firestore::model;

NS_ASSUME_NONNULL_BEGIN

@interface FIRDocumentReference (/* Init */)

- (instancetype)initWithReference:(firebase::firestore::api::DocumentReference &&)reference
NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithReference:(api::DocumentReference &&)reference NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithPath:(firebase::firestore::model::ResourcePath)path
firestore:(firebase::firestore::api::Firestore *)firestore;
- (instancetype)initWithPath:(model::ResourcePath)path firestore:(api::Firestore *)firestore;

- (instancetype)initWithKey:(firebase::firestore::model::DocumentKey)key
firestore:(firebase::firestore::api::Firestore *)firestore;
- (instancetype)initWithKey:(model::DocumentKey)key firestore:(api::Firestore *)firestore;

@end

/** Internal FIRDocumentReference API we don't want exposed in our public header files. */
@interface FIRDocumentReference (Internal)

- (const firebase::firestore::model::DocumentKey &)key;
- (const model::DocumentKey &)key;

@end

Expand Down
1 change: 1 addition & 0 deletions Firestore/Source/API/FIRDocumentReference.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
using firebase::firestore::api::DocumentReference;
using firebase::firestore::api::DocumentSnapshot;
using firebase::firestore::api::Firestore;
using firebase::firestore::api::ListenerRegistration;
using firebase::firestore::api::Source;
using firebase::firestore::api::MakeSource;
using firebase::firestore::api::ThrowInvalidArgument;
Expand Down
18 changes: 8 additions & 10 deletions Firestore/Source/API/FIRDocumentSnapshot+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,22 @@
@class FIRFirestore;
@class FSTDocument;

using firebase::firestore::api::DocumentSnapshot;
using firebase::firestore::api::Firestore;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::model::DocumentKey;
namespace api = firebase::firestore::api;
namespace model = firebase::firestore::model;

NS_ASSUME_NONNULL_BEGIN

@interface FIRDocumentSnapshot (/* Init */)

- (instancetype)initWithSnapshot:(DocumentSnapshot &&)snapshot NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithSnapshot:(api::DocumentSnapshot &&)snapshot NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithFirestore:(Firestore *)firestore
documentKey:(DocumentKey)documentKey
- (instancetype)initWithFirestore:(api::Firestore *)firestore
documentKey:(model::DocumentKey)documentKey
document:(nullable FSTDocument *)document
metadata:(SnapshotMetadata)metadata;
metadata:(api::SnapshotMetadata)metadata;

- (instancetype)initWithFirestore:(Firestore *)firestore
documentKey:(DocumentKey)documentKey
- (instancetype)initWithFirestore:(api::Firestore *)firestore
documentKey:(model::DocumentKey)documentKey
document:(nullable FSTDocument *)document
fromCache:(bool)fromCache
hasPendingWrites:(bool)hasPendingWrites;
Expand Down
1 change: 1 addition & 0 deletions Firestore/Source/API/FIRDocumentSnapshot.mm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
namespace util = firebase::firestore::util;
using firebase::firestore::api::DocumentSnapshot;
using firebase::firestore::api::Firestore;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::api::ThrowInvalidArgument;
using firebase::firestore::model::DatabaseId;
using firebase::firestore::model::DocumentKey;
Expand Down
6 changes: 4 additions & 2 deletions Firestore/Source/API/FIRFieldPath+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@

#include "Firestore/core/src/firebase/firestore/model/field_path.h"

namespace model = firebase::firestore::model;

NS_ASSUME_NONNULL_BEGIN

@interface FIRFieldPath ()

/** Internal field path representation */
- (const firebase::firestore::model::FieldPath &)internalValue;
- (const model::FieldPath &)internalValue;

- (instancetype)initPrivate:(firebase::firestore::model::FieldPath)path NS_DESIGNATED_INITIALIZER;
- (instancetype)initPrivate:(model::FieldPath)path NS_DESIGNATED_INITIALIZER;

@end

Expand Down
31 changes: 17 additions & 14 deletions Firestore/Source/API/FIRFirestore+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,29 @@
#include "Firestore/core/src/firebase/firestore/auth/credentials_provider.h"
#include "Firestore/core/src/firebase/firestore/util/async_queue.h"

NS_ASSUME_NONNULL_BEGIN

@class FIRApp;
@class FSTFirestoreClient;
@class FSTUserDataConverter;

namespace api = firebase::firestore::api;
namespace auth = firebase::firestore::auth;
namespace model = firebase::firestore::model;
namespace util = firebase::firestore::util;

NS_ASSUME_NONNULL_BEGIN

@interface FIRFirestore (/* Init */)

/**
* Initializes a Firestore object with all the required parameters directly. This exists so that
* tests can create FIRFirestore objects without needing FIRApp.
*/
- (instancetype)
initWithProjectID:(std::string)projectID
database:(std::string)database
persistenceKey:(std::string)persistenceKey
credentialsProvider:
(std::unique_ptr<firebase::firestore::auth::CredentialsProvider>)credentialsProvider
workerQueue:(std::unique_ptr<firebase::firestore::util::AsyncQueue>)workerQueue
firebaseApp:(FIRApp *)app;
- (instancetype)initWithProjectID:(std::string)projectID
database:(std::string)database
persistenceKey:(std::string)persistenceKey
credentialsProvider:(std::unique_ptr<auth::CredentialsProvider>)credentialsProvider
workerQueue:(std::unique_ptr<util::AsyncQueue>)workerQueue
firebaseApp:(FIRApp *)app;
@end

/** Internal FIRFirestore API we don't want exposed in our public header files. */
Expand All @@ -51,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Checks to see if logging is is globally enabled for the Firestore client. */
+ (BOOL)isLoggingEnabled;

+ (FIRFirestore *)recoverFromFirestore:(firebase::firestore::api::Firestore *)firestore;
+ (FIRFirestore *)recoverFromFirestore:(api::Firestore *)firestore;

/**
* Shutdown this `FIRFirestore`, releasing all resources (abandoning any outstanding writes,
Expand All @@ -62,12 +65,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)shutdownWithCompletion:(nullable void (^)(NSError *_Nullable error))completion
NS_SWIFT_NAME(shutdown(completion:));

@property(nonatomic, assign, readonly) firebase::firestore::api::Firestore *wrapped;
@property(nonatomic, assign, readonly) api::Firestore *wrapped;

@property(nonatomic, assign, readonly) firebase::firestore::util::AsyncQueue *workerQueue;
@property(nonatomic, assign, readonly) util::AsyncQueue *workerQueue;

// FIRFirestore ownes the DatabaseId instance.
@property(nonatomic, assign, readonly) const firebase::firestore::model::DatabaseId *databaseID;
@property(nonatomic, assign, readonly) const model::DatabaseId *databaseID;
@property(nonatomic, strong, readonly) FSTUserDataConverter *dataConverter;

@end
Expand Down
6 changes: 3 additions & 3 deletions Firestore/Source/API/FIRListenerRegistration+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

#include "Firestore/core/src/firebase/firestore/api/listener_registration.h"

NS_ASSUME_NONNULL_BEGIN
namespace api = firebase::firestore::api;

using firebase::firestore::api::ListenerRegistration;
NS_ASSUME_NONNULL_BEGIN

/** Private implementation of the FIRListenerRegistration protocol. */
@interface FSTListenerRegistration : NSObject <FIRListenerRegistration>

- (instancetype)initWithRegistration:(ListenerRegistration &&)registration;
- (instancetype)initWithRegistration:(api::ListenerRegistration &&)registration;

@end

Expand Down
4 changes: 2 additions & 2 deletions Firestore/Source/API/FIRListenerRegistration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
using firebase::firestore::util::DelayedConstructor;

@implementation FSTListenerRegistration {
DelayedConstructor<ListenerRegistration> _registration;
DelayedConstructor<api::ListenerRegistration> _registration;
}

- (instancetype)initWithRegistration:(ListenerRegistration &&)registration {
- (instancetype)initWithRegistration:(api::ListenerRegistration &&)registration {
if (self = [super init]) {
_registration.Init(std::move(registration));
}
Expand Down
8 changes: 6 additions & 2 deletions Firestore/Source/API/FIRQuery.mm
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"

namespace util = firebase::firestore::util;
using firebase::firestore::api::MakeSource;
using firebase::firestore::api::Firestore;
using firebase::firestore::api::ListenerRegistration;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::api::Source;
using firebase::firestore::api::ThrowInvalidArgument;
using firebase::firestore::core::AsyncEventListener;
using firebase::firestore::core::EventListener;
using firebase::firestore::core::Filter;
using firebase::firestore::core::ListenOptions;
using firebase::firestore::core::QueryListener;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::FieldPath;
Expand Down Expand Up @@ -121,7 +125,7 @@ - (void)getDocumentsWithCompletion:(void (^)(FIRQuerySnapshot *_Nullable snapsho
- (void)getDocumentsWithSource:(FIRFirestoreSource)publicSource
completion:(void (^)(FIRQuerySnapshot *_Nullable snapshot,
NSError *_Nullable error))completion {
Source source = MakeSource(publicSource);
Source source = api::MakeSource(publicSource);
if (source == Source::Cache) {
[self.firestore.wrapped->client() getDocumentsFromLocalCache:self completion:completion];
return;
Expand Down
14 changes: 6 additions & 8 deletions Firestore/Source/API/FIRQuerySnapshot+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,20 @@
@class FIRSnapshotMetadata;
@class FSTQuery;

using firebase::firestore::api::Firestore;
using firebase::firestore::api::QuerySnapshot;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::core::ViewSnapshot;
namespace api = firebase::firestore::api;
namespace core = firebase::firestore::core;

NS_ASSUME_NONNULL_BEGIN

/** Internal FIRQuerySnapshot API we don't want exposed in our public header files. */
@interface FIRQuerySnapshot (/* Init */)

- (instancetype)initWithSnapshot:(QuerySnapshot &&)snapshot NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithSnapshot:(api::QuerySnapshot &&)snapshot NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithFirestore:(Firestore *)firestore
- (instancetype)initWithFirestore:(api::Firestore *)firestore
originalQuery:(FSTQuery *)query
snapshot:(ViewSnapshot &&)snapshot
metadata:(SnapshotMetadata)metadata;
snapshot:(core::ViewSnapshot &&)snapshot
metadata:(api::SnapshotMetadata)metadata;

@end

Expand Down
3 changes: 3 additions & 0 deletions Firestore/Source/API/FIRQuerySnapshot.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@
#include "Firestore/core/src/firebase/firestore/model/document_set.h"
#include "Firestore/core/src/firebase/firestore/util/delayed_constructor.h"

using firebase::firestore::api::DocumentChange;
using firebase::firestore::api::DocumentSnapshot;
using firebase::firestore::api::Firestore;
using firebase::firestore::api::QuerySnapshot;
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::api::ThrowInvalidArgument;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::util::DelayedConstructor;
Expand Down
4 changes: 2 additions & 2 deletions Firestore/Source/API/FIRSnapshotMetadata+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

#include "Firestore/core/src/firebase/firestore/api/snapshot_metadata.h"

using firebase::firestore::api::SnapshotMetadata;
namespace api = firebase::firestore::api;

NS_ASSUME_NONNULL_BEGIN

@interface FIRSnapshotMetadata (/* Init */)

- (instancetype)initWithMetadata:(SnapshotMetadata)metadata NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithMetadata:(api::SnapshotMetadata)metadata NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithPendingWrites:(bool)pendingWrites fromCache:(bool)fromCache;

Expand Down
Loading