• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef NATIVE_RDB_VALUES_BUCKET_H
17 #define NATIVE_RDB_VALUES_BUCKET_H
18 
19 #include <map>
20 #include <set>
21 #include <parcel.h>
22 
23 #include "value_object.h"
24 
25 namespace OHOS {
26 namespace NativeRdb {
27 
28 class ValuesBucket : public virtual OHOS::Parcelable {
29 public:
30     ValuesBucket();
31     ValuesBucket(std::map<std::string, ValueObject> &valuesMap);
32     ~ValuesBucket();
33     void PutString(const std::string &columnName, const std::string &value);
34     void PutInt(const std::string &columnName, int value);
35     void PutLong(const std::string &columnName, int64_t value);
36     void PutDouble(const std::string &columnName, double value);
37     void PutBool(const std::string &columnName, bool value);
38     void PutBlob(const std::string &columnName, const std::vector<uint8_t> &value);
39     void PutNull(const std::string &columnName);
40     void Delete(const std::string &columnName);
41     void Clear();
42     int Size() const;
43     bool IsEmpty() const;
44     bool HasColumn(const std::string &columnName) const;
45     bool GetObject(const std::string &columnName, ValueObject &value) const;
46     void GetAll(std::map<std::string, ValueObject> &valuesMap) const;
47 
48     bool Marshalling(Parcel &parcel) const override;
49     static ValuesBucket *Unmarshalling(Parcel &parcel);
50 private:
51     std::map<std::string, ValueObject> valuesMap;
52 };
53 
54 } // namespace NativeRdb
55 } // namespace OHOS
56 #endif
57