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

Commit42c9ef2

Browse files
committed
Restore FirebaseObject.h
1 parentab533c3 commit42c9ef2

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

‎src/FirebaseObject.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// Copyright 2015 Google Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
#ifndef FIREBASE_OBJECT_H
18+
#defineFIREBASE_OBJECT_H
19+
20+
#include"third-party/arduino-json-5.3/include/ArduinoJson.h"
21+
22+
#ifndef FIREBASE_JSONBUFFER_SIZE
23+
#defineFIREBASE_JSONBUFFER_SIZEJSON_OBJECT_SIZE(32)
24+
#endif// FIREBASE_JSONBUFFER_SIZE
25+
26+
/**
27+
* Represents value stored in firebase, may be a singular value (leaf node) or
28+
* a tree structure.
29+
*/
30+
classFirebaseObject {
31+
public:
32+
/**
33+
* Construct from json.
34+
* \param data JSON formatted string.
35+
*/
36+
FirebaseObject(const String& data);
37+
38+
/**
39+
* Return the value as a boolean.
40+
* \param optional path in the JSON object.
41+
* \return result as a bool.
42+
*/
43+
boolgetBool(const String& path ="");
44+
45+
/**
46+
* Return the value as an int.
47+
* \param optional path in the JSON object.
48+
* \return result as an integer.
49+
*/
50+
intgetInt(const String& path ="");
51+
52+
/**
53+
* Return the value as a float.
54+
* \param optional path in the JSON object.
55+
* \return result as a float.
56+
*/
57+
floatgetFloat(const String& path ="");
58+
59+
/**
60+
* Return the value as a String.
61+
* \param optional path in the JSON object.
62+
* \return result as a String.
63+
*/
64+
StringgetString(const String& path ="");
65+
66+
/**
67+
* Return the value as a JsonVariant.
68+
* \param optional path in the JSON object.
69+
* \return result as a JsonVariant.
70+
*/
71+
JsonVariantgetJsonVariant(const String& path ="");
72+
73+
74+
/**
75+
*
76+
* \return Whether there was an error decoding or accessing the JSON object.
77+
*/
78+
boolsuccess()const;
79+
80+
/**
81+
*
82+
* \return Whether there was an error decoding or accessing the JSON object.
83+
*/
84+
boolfailed()const;
85+
86+
/**
87+
*
88+
* \return Error message if failed() is true.
89+
*/
90+
const String&error()const;
91+
92+
private:
93+
String data_;
94+
StaticJsonBuffer<FIREBASE_JSONBUFFER_SIZE> buffer_;
95+
JsonVariant json_;
96+
String error_;
97+
};
98+
99+
#endif// FIREBASE_OBJECT_H

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp