Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9f116a

Browse files
committed
Merge pull requestFirebaseExtended#138 from ed7coyne/both-strings
Support both string types in FirebaseArduino.h
2 parents7d476b8 +2ef168c commitc9f116a

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

‎src/FirebaseArduino.cpp‎

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

1717
#include"FirebaseArduino.h"
1818

19-
voidFirebaseArduino::begin(constchar* host,constchar* auth) {
19+
voidFirebaseArduino::begin(constString& host,constString& auth) {
2020
http_.reset(FirebaseHttpClient::create());
2121
http_->setReuseConnection(true);
2222
host_ = host;
@@ -38,7 +38,7 @@ void FirebaseArduino::set(const String& path, const JsonVariant& value) {
3838
error_ = set.error();
3939
}
4040

41-
FirebaseObjectFirebaseArduino::get(constchar* path) {
41+
FirebaseObjectFirebaseArduino::get(constString& path) {
4242
auto get =FirebaseGet(host_, auth_, path, http_.get());
4343
error_ = get.error();
4444
if (failed()) {
@@ -47,7 +47,7 @@ FirebaseObject FirebaseArduino::get(const char* path) {
4747
returnFirebaseObject(get.response());
4848
}
4949

50-
intFirebaseArduino::getInt(constchar* path) {
50+
intFirebaseArduino::getInt(constString& path) {
5151
auto get =FirebaseGet(host_, auth_, path, http_.get());
5252
error_ = get.error();
5353
if (failed()) {
@@ -57,7 +57,7 @@ int FirebaseArduino::getInt(const char* path) {
5757
}
5858

5959

60-
floatFirebaseArduino::getFloat(constchar* path) {
60+
floatFirebaseArduino::getFloat(constString& path) {
6161
auto get =FirebaseGet(host_, auth_, path, http_.get());
6262
error_ = get.error();
6363
if (failed()) {
@@ -66,7 +66,7 @@ float FirebaseArduino::getFloat(const char* path) {
6666
returnFirebaseObject(get.response()).getFloat();
6767
}
6868

69-
StringFirebaseArduino::getString(constchar* path) {
69+
StringFirebaseArduino::getString(constString& path) {
7070
auto get =FirebaseGet(host_, auth_, path, http_.get());
7171
error_ = get.error();
7272
if (failed()) {
@@ -75,21 +75,20 @@ String FirebaseArduino::getString(const char* path) {
7575
returnFirebaseObject(get.response()).getString();
7676
}
7777

78-
boolFirebaseArduino::getBool(constchar* path) {
78+
boolFirebaseArduino::getBool(constString& path) {
7979
auto get =FirebaseGet(host_, auth_, path, http_.get());
8080
error_ = get.error();
8181
if (failed()) {
8282
return"";
8383
}
8484
returnFirebaseObject(get.response()).getBool();
8585
}
86-
87-
voidFirebaseArduino::remove(constchar* path) {
86+
voidFirebaseArduino::remove(const String& path) {
8887
auto remove =FirebaseRemove(host_, auth_, path, http_.get());
8988
error_ = remove.error();
9089
}
9190

92-
voidFirebaseArduino::stream(constchar* path) {
91+
voidFirebaseArduino::stream(constString& path) {
9392
auto stream =FirebaseStream(host_, auth_, path, http_.get());
9493
error_ = stream.error();
9594
}

‎src/FirebaseArduino.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class FirebaseArduino {
3535
* \param host Your firebase db host, usually X.firebaseio.com.
3636
* \param auth Optional credentials for the db, a secret or token.
3737
*/
38-
voidbegin(constchar* host,constchar* auth ="");
38+
voidbegin(constString& host,constString& auth ="");
3939

4040
/**
4141
* Writes data to a new child location under the parent at path.
@@ -63,47 +63,47 @@ class FirebaseArduino {
6363
* \param path The path to the node you wish to retrieve.
6464
* \return The integer value located at that path. Will only be populated if success() is true.
6565
*/
66-
intgetInt(constchar* path);
66+
intgetInt(constString& path);
6767

6868
/**
6969
* Gets the float value located at path.
7070
* You should check success() after calling.
7171
* \param path The path to the node you wish to retrieve.
7272
* \return The float value located at that path. Will only be populated if success() is true.
7373
*/
74-
floatgetFloat(constchar* path);
74+
floatgetFloat(constString& path);
7575

7676
/**
7777
* Gets the string value located at path.
7878
* You should check success() after calling.
7979
* \param path The path to the node you wish to retrieve.
8080
* \return The string value located at that path. Will only be populated if success() is true.
8181
*/
82-
StringgetString(constchar* path);
82+
StringgetString(constString& path);
8383

8484
/**
8585
* Gets the boolean value located at path.
8686
* You should check success() after calling.
8787
* \param path The path to the node you wish to retrieve.
8888
* \return The boolean value located at that path. Will only be populated if success() is true.
8989
*/
90-
boolgetBool(constchar* path);
90+
boolgetBool(constString& path);
9191

9292
/**
9393
* Gets the json object value located at path.
9494
* You should check success() after calling.
9595
* \param path The path to the node you wish to retrieve.
9696
* \return a FirebaseObject value located at that path. Will only be populated if success() is true.
9797
*/
98-
FirebaseObjectget(constchar* path);
98+
FirebaseObjectget(constString& path);
9999

100100
/**
101101
* Remove the node, and possibly entire tree, located at path.
102102
* You should check success() after calling.
103103
* \param path The path to the node you wish to remove,
104104
* including all of its children.
105105
*/
106-
voidremove(constchar* path);
106+
voidremove(constString& path);
107107

108108
/**
109109
* Starts streaming any changes made to the node located at path, including
@@ -113,7 +113,7 @@ class FirebaseArduino {
113113
* monitoring available() and calling readEvent() to get new events.
114114
* \param path The path inside of your db to the node you wish to monitor.
115115
*/
116-
voidstream(constchar* path);
116+
voidstream(constString& path);
117117

118118
/**
119119
* Checks if there are new events available. This is only meaningful once

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp