Skip to content

Commit 773f050

Browse files
committed
Add operator<< to ViewSnapshot
1 parent a1b577a commit 773f050

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Firestore/core/src/firebase/firestore/core/view_snapshot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#endif // !defined(__OBJC__)
2323

2424
#include <functional>
25+
#include <iosfwd>
2526
#include <string>
2627
#include <utility>
2728
#include <vector>
@@ -177,6 +178,7 @@ class ViewSnapshot {
177178
}
178179

179180
std::string ToString() const;
181+
friend std::ostream& operator<<(std::ostream& out, const ViewSnapshot& value);
180182
size_t Hash() const;
181183

182184
private:

Firestore/core/src/firebase/firestore/core/view_snapshot.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "Firestore/core/src/firebase/firestore/core/view_snapshot.h"
1818

19+
#include <ostream>
20+
1921
#import "Firestore/Source/Core/FSTQuery.h"
2022
#import "Firestore/Source/Model/FSTDocument.h"
2123
#import "Firestore/Source/Model/FSTDocumentSet.h"
@@ -178,6 +180,10 @@
178180
mutated_keys().size(), sync_state_changed(), excludes_metadata_changes());
179181
}
180182

183+
std::ostream& operator<<(std::ostream& out, const ViewSnapshot& value) {
184+
return out << value.ToString();
185+
}
186+
181187
size_t ViewSnapshot::Hash() const {
182188
// Note: We are omitting `mutated_keys_` from the hash, since we don't have a
183189
// straightforward way to compute its hash value. Since `ViewSnapshot` is

0 commit comments

Comments
 (0)