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

Commita8d7557

Browse files
committed
FirebaseObject: fix spacing and add comments
1 parentad75ff6 commita8d7557

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎src/FirebaseArduino.cpp‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ void FirebaseArduino::set(const String& path, const JsonVariant& value) {
3838
error_ = set.error();
3939
}
4040

41-
4241
FirebaseObjectFirebaseArduino::get(constchar* path) {
4342
auto get =FirebaseGet(host_, auth_, path, http_.get());
4443
error_ = get.error();
@@ -85,7 +84,6 @@ bool FirebaseArduino::getBool(const char* path) {
8584
returnFirebaseObject(get.response()).getBool();
8685
}
8786

88-
8987
voidFirebaseArduino::remove(constchar* path) {
9088
auto remove =FirebaseRemove(host_, auth_, path, http_.get());
9189
error_ = remove.error();

‎src/FirebaseObject.cpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include"FirebaseObject.h"
1818

19-
2019
FirebaseObject::FirebaseObject(const String& data) : data_{data} {
2120
json_ = buffer_.parse(&data_[0]);
2221
// TODO(proppy): find a way to check decoding error, tricky because
@@ -64,15 +63,21 @@ JsonVariant FirebaseObject::getJsonVariant(const String& path) {
6463
Stringkey(path);
6564
char* start = &key[0];
6665
char* end = start + key.length();
66+
// skip first `/`.
6767
if (*start =='/') {
6868
start++;
6969
}
7070
JsonVariant json = json_;
7171
while (start < end) {
72+
// TODO(proppy) split in a separate function.
7273
char* p = start;
74+
// advance to next `/`.
7375
while (*p && (*p !='/')) p++;
76+
// make `start` a C string.
7477
*p =0;
78+
// return json variant at `start`.
7579
json = json.asObject().get(start);
80+
// advance to next path element.
7681
start = p +1;
7782
}
7883
return json;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp