Skip to content

Commit 73ce01b

Browse files
committed
Review feedback
1 parent 615c63a commit 73ce01b

File tree

3 files changed

+41
-26
lines changed

3 files changed

+41
-26
lines changed

Firestore/core/include/firebase/firestore/document_reference.h

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
// shamelessly stolen and modified from rtdb's header file, melded with the
2020
// (java) firestore api.
2121

22-
#ifndef FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_DATABASE_REFERENCE_H_
23-
#define FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_DATABASE_REFERENCE_H_
22+
#ifndef FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_DOCUMENT_REFERENCE_H_
23+
#define FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_DOCUMENT_REFERENCE_H_
2424

2525
#include <string>
2626
#include <unordered_map>
@@ -89,7 +89,7 @@ class DocumentReference {
8989
/**
9090
* @brief Default constructor. This creates an invalid DocumentReference.
9191
* Attempting to perform any operations on this reference will fail (and cause
92-
* a crash) unless a / valid DocumentReference has been assigned to it.
92+
* a crash) unless a valid DocumentReference has been assigned to it.
9393
*/
9494
DocumentReference();
9595

@@ -121,7 +121,7 @@ class DocumentReference {
121121
*
122122
* @returns Reference to the destination DocumentReference.
123123
*/
124-
virtual DocumentReference& operator=(const DocumentReference& reference);
124+
DocumentReference& operator=(const DocumentReference& reference);
125125

126126
/**
127127
* @brief Move assignment operator. Moving is an efficient operation for
@@ -131,19 +131,30 @@ class DocumentReference {
131131
*
132132
* @returns Reference to the destination DocumentReference.
133133
*/
134-
virtual DocumentReference& operator=(DocumentReference&& reference);
134+
DocumentReference& operator=(DocumentReference&& reference);
135135

136136
/**
137-
* @brief Gets the Firestore instance associated with this document reference.
137+
* @brief Returns the Firestore instance associated with this document
138+
* reference.
138139
*
139140
* The pointer will remain valid indefinitely.
140141
*
141142
* @returns Firebase Firestore instance that this DocumentReference refers to.
142143
*/
143-
virtual Firestore* firestore() const;
144+
virtual const Firestore* firestore() const;
144145

145146
/**
146-
* @brief Gets the string id of this document location.
147+
* @brief Returns the Firestore instance associated with this document
148+
* reference.
149+
*
150+
* The pointer will remain valid indefinitely.
151+
*
152+
* @returns Firebase Firestore instance that this DocumentReference refers to.
153+
*/
154+
virtual Firestore* firestore();
155+
156+
/**
157+
* @brief Returns the string id of this document location.
147158
*
148159
* The pointer is only valid while the DocumentReference remains in memory.
149160
*
@@ -153,14 +164,14 @@ class DocumentReference {
153164
virtual const char* id() const;
154165

155166
/**
156-
* @brief Gets the string id of this document location.
167+
* @brief Returns the string id of this document location.
157168
*
158169
* @returns String id of this document location.
159170
*/
160171
virtual std::string id_string() const;
161172

162173
/**
163-
* @brief Gets the path of this document (relative to the root of the
174+
* @brief Returns the path of this document (relative to the root of the
164175
* database) as a slash-separated string.
165176
*
166177
* The pointer is only valid while the DocumentReference remains in memory.
@@ -171,22 +182,22 @@ class DocumentReference {
171182
virtual const char* path() const;
172183

173184
/**
174-
* @brief Gets the path of this document (relative to the root of the
185+
* @brief Returns the path of this document (relative to the root of the
175186
* database) as a slash-separated string.
176187
*
177188
* @returns String path of this document location.
178189
*/
179190
virtual std::string path_string() const;
180191

181192
/**
182-
* @brief Gets a CollectionReference to the collection that contains this
193+
* @brief Returns a CollectionReference to the collection that contains this
183194
* document.
184195
*/
185196
virtual CollectionReference get_parent() const;
186197

187198
/**
188-
* @brief Gets a CollectionReference instance that refers to the subcollection
189-
* at the specified path relative to this document.
199+
* @brief Returns a CollectionReference instance that refers to the
200+
* subcollection at the specified path relative to this document.
190201
*
191202
* @param[in] collectionPath A slash-separated relative path to a
192203
* subcollection. The pointer only needs to be valid during this call.
@@ -196,8 +207,8 @@ class DocumentReference {
196207
virtual CollectionReference Collection(const char* collectionPath) const;
197208

198209
/**
199-
* @brief Gets a CollectionReference instance that refers to the subcollection
200-
* at the specified path relative to this document.
210+
* @brief Returns a CollectionReference instance that refers to the
211+
* subcollection at the specified path relative to this document.
201212
*
202213
* @param[in] collectionPath A slash-separated relative path to a
203214
* subcollection.
@@ -208,7 +219,7 @@ class DocumentReference {
208219
const std::string& collectionPath) const;
209220

210221
/**
211-
* @brief Reads the document referenced by this DocumentReference
222+
* @brief Reads the document referenced by this DocumentReference.
212223
*
213224
* @return A Future that will be resolved with the contents of the Document at
214225
* this DocumentReference.
@@ -286,7 +297,8 @@ class DocumentReference {
286297
* @brief Starts listening to the document referenced by this
287298
* DocumentReference.
288299
*
289-
* @param[in] callback function or lambda to call.
300+
* @param[in] callback function or lambda to call. When this function is
301+
* called, exactly one of the parameters will be non-null.
290302
*
291303
* @return A registration object that can be used to remove the listener.
292304
*
@@ -301,7 +313,8 @@ class DocumentReference {
301313
* DocumentReference.
302314
*
303315
* @param[in] options The options to use for this listen.
304-
* @param[in] callback function or lambda to call.
316+
* @param[in] callback function or lambda to call. When this function is
317+
* called, exactly one of the parameters will be non-null.
305318
*
306319
* @return A registration object that can be used to remove the listener.
307320
*
@@ -359,4 +372,4 @@ struct hash<firebase::firestore::DocumentReference> {
359372
};
360373
} // namespace std
361374

362-
#endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_DATABASE_REFERENCE_H_
375+
#endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_DOCUMENT_REFERENCE_H_

Firestore/core/include/firebase/firestore/event_listener.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
// shamelessly stolen and modified from rtdb's header file, melded with the
2020
// (java) firestore api.
2121

22-
#ifndef EXPERIMENTAL_USERS_RGOWMAN_FIRESTORE_CPP_STRAWMAN_HEADERS_EVENT_LISTENER_H_
23-
#define EXPERIMENTAL_USERS_RGOWMAN_FIRESTORE_CPP_STRAWMAN_HEADERS_EVENT_LISTENER_H_
22+
#ifndef FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_EVENT_LISTENER_H_
23+
#define FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_EVENT_LISTENER_H_
2424

2525
namespace firebase {
2626
namespace firestore {
@@ -50,4 +50,4 @@ class EventListener {
5050
} // namespace firestore
5151
} // namespace firebase
5252

53-
#endif // EXPERIMENTAL_USERS_RGOWMAN_FIRESTORE_CPP_STRAWMAN_HEADERS_EVENT_LISTENER_H_
53+
#endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_EVENT_LISTENER_H_

Firestore/core/include/firebase/firestore/firestore.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
// shamelessly stolen and modified from rtdb's header file, melded with the
2020
// firestore api.
2121

22-
#ifndef FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_PUBLIC_FIRESTORE_H_
23-
#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_PUBLIC_FIRESTORE_H_
22+
#ifndef FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_H_
23+
#define FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_H_
24+
25+
#include <string>
2426

2527
// TODO(rsgowman): replace these forward decl's with appropriate includes (once
2628
// they exist)
@@ -159,4 +161,4 @@ class Firestore {
159161
} // namespace firestore
160162
} // namespace firebase
161163

162-
#endif // FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_PUBLIC_FIRESTORE_H_
164+
#endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_FIRESTORE_H_

0 commit comments

Comments
 (0)