2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef BUNDLE_INTERNAL_H_
18 #define BUNDLE_INTERNAL_H_
23 #include <unordered_map>
26 #include "include/bundle.h"
28 #include "key-info-internal.h"
30 namespace tizen_base {
33 static const char TAG_IMPORT_EXPORT_CHECK[] = "`zaybxcwdveuftgsh`";
38 Array = BUNDLE_TYPE_ARRAY,
39 Primitive = BUNDLE_TYPE_PRIMITIVE,
40 Measurable = BUNDLE_TYPE_MEASURABLE,
44 None = BUNDLE_TYPE_NONE,
45 Any = BUNDLE_TYPE_ANY,
46 String = BUNDLE_TYPE_STR,
47 StringArray = BUNDLE_TYPE_STR_ARRAY,
48 Byte = BUNDLE_TYPE_BYTE,
49 ByteArray = BUNDLE_TYPE_BYTE_ARRAY,
53 Bundle(unsigned char* raw, int size, bool base64 = true);
54 Bundle(int argc, char** argv);
57 Bundle(const Bundle& b);
58 Bundle& operator = (const Bundle& b);
59 Bundle(Bundle&& b) noexcept;
60 Bundle& operator = (Bundle&& b) noexcept;
62 bool operator == (const Bundle& b);
64 void Remove(const std::string& key);
65 void Add(std::shared_ptr<KeyInfo> key_info);
66 void Set(const std::string& key, int index, std::vector<unsigned char> value);
68 std::shared_ptr<KeyInfo>& Get(const std::string& key);
70 int GetType(const std::string& key);
72 unsigned char* Encode();
73 unsigned char* EncodeRaw(int* size);
74 int DecodeRaw(unsigned char* raw, int size);
75 const std::unordered_map<std::string, std::shared_ptr<KeyInfo>>& GetMap() const;
76 std::vector<std::string> Export();
79 int Decode(unsigned char* raw, int size);
80 int Import(int argc, char** argv);
83 std::unordered_map<std::string, std::shared_ptr<KeyInfo>> map_;
84 std::list<std::shared_ptr<KeyInfo>> list_;
87 } // namespace internal
88 } // namespace tizen_base
90 #endif // BUNDLE_INTERNAL_H_