Skip to content

Commit 1f8746d

Browse files
committed
Add back getPtr functions.
1 parent 7c89e0d commit 1f8746d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/Firebase.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,49 @@ FirebaseGet Firebase::get(const std::string& path) {
4646
return FirebaseGet(host_, auth_, path, http_);
4747
}
4848

49+
unique_ptr<FirebaseGet> Firebase::getPtr(const std::string& path) {
50+
return unique_ptr<FirebaseGet>(new FirebaseGet(host_, auth_, path, http_));
51+
}
52+
4953
FirebaseSet Firebase::set(const std::string& path, const std::string& value) {
5054
return FirebaseSet(host_, auth_, path, value, http_);
5155
}
5256

57+
unique_ptr<FirebaseSet> Firebase::setPtr(const std::string& path,
58+
const std::string& value) {
59+
return unique_ptr<FirebaseSet>(
60+
new FirebaseSet(host_, auth_, path, value, http_));
61+
}
62+
5363
FirebasePush Firebase::push(const std::string& path, const std::string& value) {
5464
return FirebasePush(host_, auth_, path, value, http_);
5565
}
5666

67+
unique_ptr<FirebasePush> Firebase::pushPtr(const std::string& path, const std::string& value) {
68+
return unique_ptr<FirebasePush>(
69+
new FirebasePush(host_, auth_, path, value, http_));
70+
}
71+
5772
FirebaseRemove Firebase::remove(const std::string& path) {
5873
return FirebaseRemove(host_, auth_, path, http_);
5974
}
6075

76+
unique_ptr<FirebaseRemove> Firebase::removePtr(const std::string& path) {
77+
return unique_ptr<FirebaseRemove>(
78+
new FirebaseRemove(host_, auth_, path, http_));
79+
}
80+
6181
FirebaseStream Firebase::stream(const std::string& path) {
6282
// TODO: create new client dedicated to stream.
6383
return FirebaseStream(host_, auth_, path, http_);
6484
}
6585

86+
unique_ptr<FirebaseStream> Firebase::streamPtr(const std::string& path) {
87+
// TODO: create new client dedicated to stream.
88+
return unique_ptr<FirebaseStream>(
89+
new FirebaseStream(host_, auth_, path, http_));
90+
}
91+
6692
// FirebaseCall
6793
FirebaseCall::FirebaseCall(const std::string& host, const std::string& auth,
6894
const char* method, const std::string& path,

src/Firebase.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,23 @@ class Firebase {
4343

4444
// Fetch json encoded `value` at `path`.
4545
FirebaseGet get(const std::string& path);
46+
virtual std::unique_ptr<FirebaseGet> getPtr(const std::string& path);
47+
4648
// Set json encoded `value` at `path`.
4749
FirebaseSet set(const std::string& path, const std::string& json);
50+
virtual std::unique_ptr<FirebaseSet> setPtr(const std::string& path, const std::string& json);
4851

4952
// Add new json encoded `value` to list at `path`.
5053
FirebasePush push(const std::string& path, const std::string& json);
54+
virtual std::unique_ptr<FirebasePush> pushPtr(const std::string& path, const std::string& json);
5155

5256
// Delete value at `path`.
5357
FirebaseRemove remove(const std::string& path);
58+
virtual std::unique_ptr<FirebaseRemove> removePtr(const std::string& path);
5459

5560
// Start a stream of events that affect value at `path`.
5661
FirebaseStream stream(const std::string& path);
62+
virtual std::unique_ptr<FirebaseStream> streamPtr(const std::string& path);
5763

5864
protected:
5965
// Used for testing.

0 commit comments

Comments
 (0)