- Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathmutable_data_ios.h
101 lines (75 loc) · 3 KB
/
mutable_data_ios.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef FIREBASE_DATABASE_SRC_IOS_MUTABLE_DATA_IOS_H_
#defineFIREBASE_DATABASE_SRC_IOS_MUTABLE_DATA_IOS_H_
#include<string>
#include<memory>
#include"app/src/include/firebase/variant.h"
#include"app/src/util_ios.h"
#include"database/src/include/firebase/database/mutable_data.h"
#ifdef __OBJC__
#import"FIRDatabase.h"
#endif// __OBJC__
namespace firebase {
namespace database {
namespace internal {
// This defines the class FIRMutableDataPointer, which is a C++-compatible
// wrapper around the FIRMutableData Obj-C class.
OBJ_C_PTR_WRAPPER(FIRMutableData);
#pragma clang assume_nonnull begin
class DatabaseReferenceInternal;
// The iOS implementation of MutableData, which encapsulates the data and
// priority at a location.
class MutableDataInternal {
public:
~MutableDataInternal();
// Used to obtain a MutableData instance that encapsulates the data and
// priority at the given relative path.
MutableDataInternal* Child(constchar* path);
// Get all the immediate children of this location.
std::vector<MutableData> GetChildren();
// Get the number of children of this location.
size_tGetChildrenCount();
// Get the key name of the source location of this data.
constchar* GetKey() const;
// Get the key name of the source location of this data.
std::string GetKeyString() const;
// Get the value of the data contained at this location.
Variant GetValue() const;
// Get the priority of the data contained at this snapshot.
Variant GetPriority();
// Does this MutableData have data at a particular location?
boolHasChild(constchar* path) const;
// Sets the data at this location to the given value.
voidSetValue(Variant value);
// Sets the priority of this field, which controls its sort order relative to
// its siblings.
voidSetPriority(Variant priority);
// Returns a pointer to the database this MutableData is from.
DatabaseInternal* database_internal() const { return db_; }
private:
friend class DatabaseReferenceInternal;
MutableDataInternal(DatabaseInternal* database,
std::unique_ptr<FIRMutableDataPointer> impl);
#ifdef __OBJC__
FIRMutableData* impl() const { return impl_->get(); }
#endif// __OBJC__
DatabaseInternal* db_;
std::unique_ptr<FIRMutableDataPointer> impl_;
};
#pragma clang assume_nonnull end
} // namespace internal
} // namespace database
} // namespace firebase
#endif// FIREBASE_DATABASE_SRC_IOS_MUTABLE_DATA_IOS_H_