summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiwoong Im <jiwoong.im@samsung.com>2015-06-02 12:50:38 +0900
committerJiwoong Im <jiwoong.im@samsung.com>2015-06-02 16:27:01 +0900
commit960e2f55ef662f1ab4f94c98d41f7c6273339601 (patch)
tree9062e381d9b273904927c184c4f0e9ef360ffc97
parent24d8db7d379b3290d1a37782ea695a4ce03110fb (diff)
downloadbundle-960e2f55ef662f1ab4f94c98d41f7c6273339601.tar.gz
bundle-960e2f55ef662f1ab4f94c98d41f7c6273339601.tar.bz2
bundle-960e2f55ef662f1ab4f94c98d41f7c6273339601.zip
Change-Id: I82533c18d9ce47b366e2e7dc7aed4ef6f1d141b6 Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rw-r--r--CMakeLists.txt9
-rwxr-xr-xdoc/bundle_doc.h34
-rwxr-xr-xinclude/bundle.h490
-rwxr-xr-xinclude/bundle_internal.h451
-rw-r--r--packaging/bundle.spec1
-rw-r--r--src/bundle.c1
6 files changed, 530 insertions, 456 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42cb008..850891d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,12 +43,13 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/bundle.pc.in ${CMAKE_BINARY_DIR}/bundle.pc @O
install(TARGETS bundle
DESTINATION ${LIB_INSTALL_DIR}
)
-install(FILES
- ${CMAKE_SOURCE_DIR}/include/bundle.h
- ${CMAKE_SOURCE_DIR}/include/SLP_bundle_PG.h
+install(FILES
+ ${CMAKE_SOURCE_DIR}/include/bundle.h
+ ${CMAKE_SOURCE_DIR}/include/bundle_internal.h
+ ${CMAKE_SOURCE_DIR}/include/SLP_bundle_PG.h
DESTINATION include/
)
-install(FILES ${CMAKE_BINARY_DIR}/bundle.pc
+install(FILES ${CMAKE_BINARY_DIR}/bundle.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/
)
diff --git a/doc/bundle_doc.h b/doc/bundle_doc.h
new file mode 100755
index 0000000..198fecc
--- /dev/null
+++ b/doc/bundle_doc.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_CORE_LIB_BUNDLE_DOC_H__
+#define __TIZEN_CORE_LIB_BUNDLE_DOC_H__
+
+/**
+ * @ingroup CAPI_APPLICATION_FRAMEWORK
+ * @defgroup CORE_LIB_BUNDLE_MODULE Bundle
+ * @brief A simple string-based dictionary ADT.
+ *
+ * @section CORE_LIB_BUNDLE_MODULE_HEADER Required Header
+ * \#include <bundle.h>
+ *
+ * @section CORE_LIB_BUNDLE_MODULE_OVERVIEW Overview
+ * Bundle is a string based Dictionary ADT. A dictionary is an ordered or unordered list of key element pairs, where keys are used to locate elements in the list.
+*
+*/
+
+#endif /* __TIZEN_CORE_LIB_BUNDLE_DOC_H__ */
diff --git a/include/bundle.h b/include/bundle.h
index 9d22aaa..51ff989 100755
--- a/include/bundle.h
+++ b/include/bundle.h
@@ -49,25 +49,26 @@ extern "C" {
/**
* @brief Enumeration for error code of Bundle.
*
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
-typedef enum {
+typedef enum
+{
BUNDLE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
BUNDLE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
BUNDLE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
BUNDLE_ERROR_KEY_NOT_AVAILABLE = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Required key not available */
- BUNDLE_ERROR_KEY_EXISTS = TIZEN_ERROR_FILE_EXISTS /**< Key exists */
+ BUNDLE_ERROR_KEY_EXISTS = TIZEN_ERROR_BUNDLE | 0x01 /**< Key exists */
} bundle_error_e;
/**
* @brief The bundle handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef struct _bundle_t bundle;
/**
* @brief The encoded data type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @see bundle_encode()
* @see bundle_decode()
*/
@@ -76,7 +77,7 @@ typedef unsigned char bundle_raw;
/**
* @brief Enumeration for key-value pair types.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
enum bundle_type_property {
BUNDLE_TYPE_ARRAY = 0x0100, /**< Array type */
@@ -86,7 +87,7 @@ enum bundle_type_property {
/**
* @brief Enumeration for bundle types.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
enum bundle_type {
BUNDLE_TYPE_NONE = -1, /**< None */
@@ -99,7 +100,7 @@ enum bundle_type {
/**
* @brief The key-value pair handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @see bundle_iterator_t
*/
typedef struct keyval_t bundle_keyval_t;
@@ -107,7 +108,7 @@ typedef struct keyval_t bundle_keyval_t;
/**
* @brief Called for every key-value pair.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @see bundle_foreach()
*/
typedef void (*bundle_iterator_t) (
@@ -117,20 +118,11 @@ typedef void (*bundle_iterator_t) (
void *user_data
);
-
-/**
- * @internal
- * @brief Called for every key-value pair.
- * @since_tizen 2.3
- * @remarks This type is obsolete. You must not use this type any more.
- * @see bundle_iterate()
- */
-typedef void (*bundle_iterate_cb_t) (const char *key, const char *val, void *data);
-
+#include "bundle_internal.h"
/**
* @brief Creates a bundle object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @return The bundle object
* @retval @c NULL - Failure
@@ -148,7 +140,7 @@ API bundle* bundle_create(void);
/**
* @brief Frees the given bundle object with key-value pairs in it.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object to be freed
* @return The operation result;
* @retval BUNDLE_ERROR_NONE Success
@@ -165,7 +157,7 @@ API int bundle_free(bundle *b);
/**
* @brief Adds a strings array type key-value pair into a given bundle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object
* @param[in] key The key
* @param[in] str_array The string type value; if @c NULL, an empty array is created; you can change an item with
@@ -189,32 +181,8 @@ API int bundle_free(bundle *b);
API int bundle_add_str_array(bundle *b, const char *key, const char **str_array, const int len);
/**
- * @internal
- * @brief Adds a string type key-value pair into a given bundle.
- * @since_tizen 2.3
- * @param[in] b The bundle object
- * @param[in] key The key
- * @param[in] val The value
- * @return The operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval BUNDLE_ERROR_KEY_EXISTS Key already exists
- * @retval BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
- * @pre @a b must be a valid bundle object.
- * @see bundle_add_str()
- @code
- #include <bundle.h>
- bundle *b = bundle_create(); // Create new bundle object
- bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
-
- bundle_free(b);
- @endcode
- */
-API int bundle_add(bundle *b, const char *key, const char *val);
-
-/**
* @brief Deletes a key-value object with the given key.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object
* @param[in] key The given key
* @return The operation result
@@ -235,7 +203,7 @@ API int bundle_del(bundle *b, const char* key);
/**
* @brief Gets a string array from a given key.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You MUST NOT free or modify the returned string!
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] b The bundle object
@@ -266,35 +234,8 @@ API int bundle_del(bundle *b, const char* key);
API const char** bundle_get_str_array(bundle *b, const char *key,int *len);
/**
- * @internal
- * @brief Gets a value with a given key.
- * @since_tizen 2.3
- * @remarks You MUST NOT free or modify the returned string!
- * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @param[in] b The bundle object
- * @param[in] key The key
- * @return The pointer for the value string
- * @retval @c NULL - Key not found
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception BUNDLE_ERROR_KEY_NOT_AVAILABLE Key not available
- * @pre @a b must be a valid bundle object.
- * @see bundle_get_str()
- @code
- #include <bundle.h>
- bundle *b = bundle_create(); // Create new bundle object
- bundle_add_str(b, "foo", "bar"); //add a key-val pair
- char *val = bundle_get_val(b, "foo_key"); // val = "bar_val"
-
- bundle_free(b); // After freeing b, val becomes a dangling pointer.
- val = NULL;
- @endcode
- */
-API const char* bundle_get_val(bundle *b, const char *key);
-
-/**
* @brief Gets the number of bundle items.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object
* @return The number of bundle items
* @pre @a b must be a valid bundle object.
@@ -313,7 +254,7 @@ API int bundle_get_count(bundle *b);
/**
* @brief Gets the type of a value with a given key.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] b A bundle
* @param[in] key A key in the bundle
@@ -329,64 +270,31 @@ API int bundle_get_count(bundle *b);
API int bundle_get_type(bundle *b, const char *key);
/**
- * @internal
* @brief Duplicates a given bundle object.
- * @since_tizen 2.3
+ * @since_tizen 2.4
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @param[in] b_from the bundle object to be duplicated
- * @return The new bundle object
- * @retval @c NULL - Failure
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a b must be a valid bundle object.
+ * @param[in] b_from the bundle object to be duplicated
+ * @return The new bundle object
+ * @retval @c NULL - Failure
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a b must be a valid bundle object.
@code
#include <bundle.h>
bundle *b = bundle_create(); // Create new bundle object
bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
- bundle *b_dup = bundle_dup(b); // duplicate b
+ bundle *b_dup = bundle_dup(b); // duplicate b
bundle_free(b);
bundle_free(b_dup);
@endcode
*/
-API bundle * bundle_dup(bundle *b_from);
-
-/**
- * @internal
- * @brief Iterates a callback function for each key-value pairs in a given bundle.
- * @details (NOTE: Only BUNDLE_TYPE_STR type values come!)
- * @since_tizen 2.3
- * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @remarks This function is obsolete and does not give values whose types are not BUNDLE_TYPE_STR.
- * @param[in] b The bundle object
- * @param[in] callback The iteration callback function
- * @param[in] cb_data The data for callback function
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a b must be a valid bundle object.
- @code
- #include <stdio.h>
- #include <bundle.h>
- void sample_cb(const char *k, const char *v, void *data) {
- printf("%s -> %s\n", k, v);
- }
-
- int main(void) {
- bundle *b = bundle_create(); // Create new bundle object
- bundle_add_str(b, "k1", "v1"); // add a key-val pair
- bundle_add_str(b, "k2", "v2"); // add a key-val pair
- bundle_add_str(b, "k3", "v3"); // add a key-val pair
- bundle_iterate(b, sample_cb, NULL); // iterate sample_cb() for each key/val
- return 0;
- }
- @endcode
- */
-API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
+API bundle * bundle_dup(bundle *b_from);
/**
* @brief Iterates a callback function for each key-value pair in a given bundle.
* @details Supports all types of values.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @remarks This function supports all types.
* @param[in] b The bundle object
@@ -435,7 +343,7 @@ API void bundle_foreach(bundle *b, bundle_iterator_t iter, void *user_data);
/**
* @brief Gets the type of a key-value pair.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] kv A bundle_keyval_t object
* @return The type of @a kv
@@ -449,7 +357,7 @@ API int bundle_keyval_get_type(bundle_keyval_t *kv);
/**
* @brief Determines whether the type of a key-value pair is array.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] kv A bundle_keyval_t object
* @return The operation result
@@ -463,24 +371,8 @@ API int bundle_keyval_get_type(bundle_keyval_t *kv);
API int bundle_keyval_type_is_array(bundle_keyval_t *kv);
/**
- * @internal
- * @brief Determines whether the type of a key-value pair is measurable.
- * @since_tizen 2.3
- * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @param[in] kv A bundle_keyval_t object
- * @return The operation result
- * @retval @c 1 - @a kv is an measurable
- * @retval @c 0 - @a kv is not an measurable
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a kv must be a valid bundle_keyval_t object.
- * @see bundle_foreach()
- */
-API int bundle_keyval_type_is_measurable(bundle_keyval_t *kv);
-
-/**
* @brief Gets the value and size of the value from a key-value pair of basic type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must not free @a val.
* @param[in] kv A bundle_keyval_t object
* @param[out] val The value
@@ -496,7 +388,7 @@ API int bundle_keyval_get_basic_val(bundle_keyval_t *kv, void **val, size_t *siz
/**
* @brief Gets the value array, length of the array, and size of each array item.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] kv A bundle_keyval_t object
* @param[out] array_val The array pointer of values
* @param[out] array_len The length of @a array_val
@@ -512,7 +404,7 @@ API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsi
/**
* @brief Encodes a bundle to the bundle_raw format (uses base64 format).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object
* @param[out] r The returned bundle_raw data(byte data)
* @a r MUST BE FREED by free(r)
@@ -535,21 +427,8 @@ API int bundle_keyval_get_array_val(bundle_keyval_t *kv, void ***array_val, unsi
API int bundle_encode(bundle *b, bundle_raw **r, int *len);
/**
- * @internal
- * @brief Frees the encoded rawdata.
- * @since_tizen 2.3
- * @param[in] r The rawdata
- * @return The operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a r is a valid rawdata generated by bundle_encode().
- * @see bundle_encode()
- */
-API int bundle_free_encoded_rawdata(bundle_raw **r);
-
-/**
* @brief Deserializes bundle_raw and gets the bundle object.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
* @param[in] r The bundle_raw data to be converted to bundle object
* @param[in] len The size of @a r
@@ -578,164 +457,8 @@ API int bundle_free_encoded_rawdata(bundle_raw **r);
API bundle * bundle_decode(const bundle_raw *r, const int len);
/**
- * @internal
- * @brief Encodes a bundle to the bundle_raw format.
- * @since_tizen 2.3
- * @param[in] b The bundle object
- * @param[out] r The returned bundle_raw data(byte data)
- * @a r MUST BE FREED by free(r)
- * @param[out] len The size of @a r (in bytes)
- * @return The size of the raw data
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
- * @pre @a b must be a valid bundle object.
- @code
- #include <bundle.h>
- bundle *b = bundle_create(); // Create new bundle object
- bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
- bundle_raw *r;
- int len;
- bundle_encode_raw(b, &r, &len); // encode b
-
- bundle_free(b);
- @endcode
- */
-API int bundle_encode_raw(bundle *b, bundle_raw **r, int *len);
-
-/**
- * @internal
- * @brief Deserializes bundle_raw and gets a bundle object.
- * @since_tizen 2.3
- * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @param[in] r The bundle_raw data to be converted to a bundle object
- * @param[in] len The size of @a r
- * @return The bundle object
- * @retval @c NULL - Failure
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a b must be a valid bundle object.
- @code
- #include <bundle.h>
- bundle *b = bundle_create(); // Create new bundle object
- bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
-
- bundle_raw *encoded_b;
- int len;
- bundle_encode(b, &encoded_b, &len); // encode b
-
- bundle *b_dup;
- b_dup = bundle_decode_raw(encoded_b, len); // decoded bundle object
-
- bundle_free(b);
- free(encoded_b);
- bundle_free(b_dup);
- @endcode
- */
-API bundle * bundle_decode_raw(const bundle_raw *r, const int len);
-
-/**
- * @internal
- * @brief Exports bundle to @a argv.
- * @since_tizen 2.3
- * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @param[in] b The bundle object
- * @param[out] argv The pointer of the string array; \n
- * This array has NULL values for the first and last item; \n
- * First NULL is for argv[0], and last NULL is a terminator for execv() \n
- * @return The number of item in @a argv. This value is equal to the actual count of argv - 1. (Last NULL terminator is not counted.)
- * @retval @c -1 - Failure
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
- * @pre @a b is a valid bundle object.
- * @post @a argv is a pointer of newly allocated memory. It must be freed.
- * Each item of @a argv points to the string in the bundle object @a b. If @a b is freed, @a argv will have garbage pointers. DO NOT FREE @a b BEFORE ACCESSING @a argv!!
- * @see bundle_import_from_argv()
- @code
- #include <bundle.h>
- bundle *b = bundle_create(); // Create new bundle object
- bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
-
- int argc = 0;
- char **argv = NULL;
- argc = bundle_export_to_argv(b, &argv); // export to argv
- if(0 > argc) error("export failure");
-
- int i;
- for(i=0; i < argc; i++) {
- printf("%s\n", argv[i]); // print argv
- }
- bundle_free_exported_argv(argc, argv); // argv must be freed after being used.
-
- bundle_free(b);
- @endcode
- */
-API int bundle_export_to_argv(bundle *b, char ***argv);
-
-/**
- * @internal
- * @brief Frees the exported @a argv.
- * @since_tizen 2.3
- * @remarks You must not use this API when you use global @a argv.
- * @param[in] argc The number of args, which is the return value of bundle_export_to_argv()
- * @param[in] argv The array from bundle_export_to_argv()
- * @return The operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a argv is a valid string array generated from bundle_export_to_argv().
- * @see bundle_export_to_argv()
- @code
- bundle *b = bundle_create();
- bundle_add_str(b, "foo", "bar");
-
- int argc = 0;
- char **argv = NULL;
- argc = bundle_export_to_argv(b, &argv);
- if(0 > argc) error("export failure");
-
- // Use argv...
-
- bundle_free_exported_argv(argc, argv);
- argv = NULL;
-
- bundle_free(b);
- @endcode
- */
-API int bundle_free_exported_argv(int argc, char ***argv);
-
-/**
- * @internal
- * @brief Imports a bundle from @a argv.
- * @since_tizen 2.3
- * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- * @param[in] argc The argument count
- * @param[in] argv The argument vector
- * @return The new bundle object
- * @retval @c NULL - Failure
- * @exception BUNDLE_ERROR_NONE Success
- * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
- * @pre @a argv is a valid string array, which is created by bundle_export_to_argv().
- * @post The returned bundle @a b must be freed.
- * @see bundle_export_to_argv()
- @code
- #include <bundle.h>
-
- int main(int argc, char **argv) {
- bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
- char *val = bundle_get_val(b, "foo_key"); // value for "foo_key"
- // ......
- bundle_free(b); // After freeing b, val becomes a dangling pointer.
- val = NULL;
- }
- @endcode
- */
-API bundle * bundle_import_from_argv(int argc, char **argv);
-
-/**
* @brief Adds a string type key-value pair into a bundle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object
* @param[in] key The key
* @param[in] str The string type value
@@ -757,41 +480,8 @@ API bundle * bundle_import_from_argv(int argc, char **argv);
API int bundle_add_str(bundle *b, const char *key, const char *str);
/**
- * @internal
- * @brief Sets a value of string array elements.
- * @since_tizen 2.3
- * @param[in] b The bundle object
- * @param[in] key The key
- * @param[in] idx The index of the array element to be changed
- * @param[in] val The string type value; if @c NULL, an empty array is created; you can change an item with
- * @return The operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre @a b must be a valid bundle object.
- * @see bundle_add_str_array()
- * @see bundle_get_str_array()
- @code
- #include <bundle.h>
- bundle *b = bundle_create();
- bundle_add_str_array(b, "foo", NULL, 3); // add a key-val pair
- bundle_set_str_array_element(b, "foo", 0, "aaa");
- bundle_set_str_array_element(b, "foo", 1, "bbb");
- bundle_set_str_array_element(b, "foo", 2, "ccc");
-
- char **str_array = NULL;
- int len_str_array = 0;
-
- str_array=bundle_get_str_array(b, "foo", &len_str_array);
- // str_array = { "aaa", "bbb", "ccc" }, and len_str_array = 3
-
- bundle_free(b);
- @endcode
- */
-API int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int idx, const char *val);
-
-/**
* @brief Adds a byte type key-value pair into a bundle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] b The bundle object
* @param[in] key The key
* @param[in] byte The string type value
@@ -817,74 +507,8 @@ API int bundle_set_str_array_element(bundle *b, const char *key, const unsigned
API int bundle_add_byte(bundle *b, const char *key, const void *byte, const size_t size);
/**
- * @internal
- * @brief Adds a byte array type key-value pair into a bundle.
- * @since_tizen 2.3
- * @param[in] b The bundle object
- * @param[in] key The key
- * @param[in] byte_array Not used
- * @param[in] len The length of the array to be created
- * @return The operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval BUNDLE_ERROR_KEY_EXISTS Key already exists
- * @retval BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
- * @pre @a b must be a valid bundle object.
- * @see bundle_get_byte_array()
- * @see bundle_set_byte_array_element()
- @code
- #include <bundle.h>
- bundle *b = bundle_create();
- bundle_add_byte_array(b, "foo", NULL, 3); // add a byte-array with length 3
-
- bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4); array[0] = "aaa\0"
- bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4); array[1] = "bbb\0"
- bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4); array[2] = "ccc\0"
-
- bundle_free(b);
- @endcode
- */
-API int bundle_add_byte_array(bundle *b, const char *key, void **byte_array, const unsigned int len);
-
-/**
- * @internal
- * @brief Sets the value of the byte array element.
- * @since_tizen 2.3
- * @param[in] b The bundle object
- * @param[in] key The key
- * @param[in] idx The index of the array element to be changed
- * @param[in] val The string type value; if @c NULL, an empty array is created; you can change an item with
- * @param[in] size The size of the value in bytes
- * @return Operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval BUNDLE_ERROR_KEY_NOT_AVAILABLE Key not available
- * @pre @a b must be a valid bundle object.
- * @see bundle_add_byte_array()
- * @see bundle_get_byte_array()
- @code
- #include <bundle.h>
- bundle *b = bundle_create();
- bundle_add_byte_array(b, "foo", NULL, 3); // add a key-val pair
-
- bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
- bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
- bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
-
- unsigned char **byte_array = NULL;
- int len_byte_array = 0;
-
- bundle_get_byte_array(b, "foo", &byte_array, &len_byte_array, &size_byte_array);
- // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, and len_byte_array = 3
-
- bundle_free(b);
- @endcode
- */
-API int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int idx, const void *val, const size_t size);
-
-/**
* @brief Gets the string value with the given key.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must not free str!
* @param[in] b The bundle object
* @param[in] key The key
@@ -911,7 +535,7 @@ API int bundle_get_str(bundle *b, const char *key, char **str);
/**
* @brief Gets the byte value with the given key.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must not free @a byte!
* @param[in] b The bundle object
* @param[in] key The key
@@ -942,44 +566,6 @@ API int bundle_get_str(bundle *b, const char *key, char **str);
*/
API int bundle_get_byte(bundle *b, const char *key, void **byte, size_t *size);
-/**
- * @internal
- * @brief Gets the byte array value with the given key.
- * @since_tizen 2.3
- * @remarks You must not free str!
- * @param[in] b The bundle object
- * @param[in] key The key
- * @param[out] byte_array The returned value
- * @param[out] len The array length
- * @param[out] array_element_size an array of sizes of each @a byte_array element
- * @return The operation result
- * @retval BUNDLE_ERROR_NONE Success
- * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval BUNDLE_ERROR_KEY_NOT_AVAILABLE Key not available
- * @pre @a b must be a valid bundle object.
- * @see bundle_add_byte_array()
- * @see bundle_set_byte_array_element()
- @code
- #include <bundle.h>
- bundle *b = bundle_create();
- bundle_add_byte_array(b, "foo", NULL, 3);
- bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
- bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
- bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
-
- char **byte_array = NULL;
- int len_byte_array = 0;
- size_t *size_byte_array = NULL;
-
- bundle_get_byte_array(b, "foo", &byte_array, &len_byte_array, &size_byte_array);
- // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, len_byte_array = 3, and size_byte_array = { 4, 4, 4 }
-
- bundle_free(b);
- @endcode
- */
-API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/include/bundle_internal.h b/include/bundle_internal.h
new file mode 100755
index 0000000..06df09e
--- /dev/null
+++ b/include/bundle_internal.h
@@ -0,0 +1,451 @@
+/*
+ * bundle
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * 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 __BUNDLE_INTERNAL_H__
+#define __BUNDLE_INTERNAL_H__
+
+/**
+ * @file bundle_internal.h
+ * @brief This file declares has API of the bundle library
+ */
+
+/**
+ * @addtogroup CORE_LIB_BUNDLE_MODULE
+ * @{
+ */
+
+#include "bundle.h"
+
+#ifdef __cplusplus
+extern "C" {
+# endif
+
+/**
+ * @brief Called for every key-value pair.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This type is obsolete. You must not use this type any more.
+ * @see bundle_iterate()
+ */
+typedef void (*bundle_iterate_cb_t) (const char *key, const char *val, void *data);
+
+/**
+ * @brief Adds a string type key-value pair into a given bundle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] b The bundle object
+ * @param[in] key The key
+ * @param[in] val The value
+ * @return The operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval BUNDLE_ERROR_KEY_EXISTS Key already exists
+ * @retval BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre @a b must be a valid bundle object.
+ * @see bundle_add_str()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create(); // Create new bundle object
+ bundle_add(b, "foo_key", "bar_val"); // add a key-val pair
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_add(bundle *b, const char *key, const char *val);
+
+/**
+ * @brief Gets a value with a given key.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You MUST NOT free or modify the returned string!
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] b The bundle object
+ * @param[in] key The key
+ * @return The pointer for the value string
+ * @retval @c NULL - Key not found
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception BUNDLE_ERROR_KEY_NOT_AVAILABLE Key not available
+ * @pre @a b must be a valid bundle object.
+ * @see bundle_get_str()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create(); // Create new bundle object
+ bundle_add_str(b, "foo", "bar"); //add a key-val pair
+ char *val = bundle_get_val(b, "foo_key"); // val = "bar_val"
+
+ bundle_free(b); // After freeing b, val becomes a dangling pointer.
+ val = NULL;
+ @endcode
+ */
+API const char* bundle_get_val(bundle *b, const char *key);
+
+/**
+ * @brief Iterates a callback function for each key-value pairs in a given bundle.
+ * @details (NOTE: Only BUNDLE_TYPE_STR type values come!)
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @remarks This function is obsolete and does not give values whose types are not BUNDLE_TYPE_STR.
+ * @param[in] b The bundle object
+ * @param[in] callback The iteration callback function
+ * @param[in] cb_data The data for callback function
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a b must be a valid bundle object.
+ @code
+ #include <stdio.h>
+ #include <bundle.h>
+ void sample_cb(const char *k, const char *v, void *data) {
+ printf("%s -> %s\n", k, v);
+ }
+
+ int main(void) {
+ bundle *b = bundle_create(); // Create new bundle object
+ bundle_add_str(b, "k1", "v1"); // add a key-val pair
+ bundle_add_str(b, "k2", "v2"); // add a key-val pair
+ bundle_add_str(b, "k3", "v3"); // add a key-val pair
+ bundle_iterate(b, sample_cb, NULL); // iterate sample_cb() for each key/val
+ return 0;
+ }
+ @endcode
+ */
+API void bundle_iterate(bundle *b, bundle_iterate_cb_t callback, void *cb_data);
+
+/**
+ * @brief Determines whether the type of a key-value pair is measurable.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] kv A bundle_keyval_t object
+ * @return The operation result
+ * @retval @c 1 - @a kv is an measurable
+ * @retval @c 0 - @a kv is not an measurable
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a kv must be a valid bundle_keyval_t object.
+ * @see bundle_foreach()
+ */
+API int bundle_keyval_type_is_measurable(bundle_keyval_t *kv);
+
+/**
+ * @brief Frees the encoded rawdata.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] r The rawdata
+ * @return The operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a r is a valid rawdata generated by bundle_encode().
+ * @see bundle_encode()
+ */
+API int bundle_free_encoded_rawdata(bundle_raw **r);
+
+/**
+ * @brief Encodes a bundle to the bundle_raw format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] b The bundle object
+ * @param[out] r The returned bundle_raw data(byte data)
+ * @a r MUST BE FREED by free(r)
+ * @param[out] len The size of @a r (in bytes)
+ * @return The size of the raw data
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre @a b must be a valid bundle object.
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create(); // Create new bundle object
+ bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
+ bundle_raw *r;
+ int len;
+ bundle_encode_raw(b, &r, &len); // encode b
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_encode_raw(bundle *b, bundle_raw **r, int *len);
+
+/**
+ * @brief Deserializes bundle_raw and gets a bundle object.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] r The bundle_raw data to be converted to a bundle object
+ * @param[in] len The size of @a r
+ * @return The bundle object
+ * @retval @c NULL - Failure
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a b must be a valid bundle object.
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create(); // Create new bundle object
+ bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
+
+ bundle_raw *encoded_b;
+ int len;
+ bundle_encode(b, &encoded_b, &len); // encode b
+
+ bundle *b_dup;
+ b_dup = bundle_decode_raw(encoded_b, len); // decoded bundle object
+
+ bundle_free(b);
+ free(encoded_b);
+ bundle_free(b_dup);
+ @endcode
+ */
+API bundle * bundle_decode_raw(const bundle_raw *r, const int len);
+
+/**
+ * @brief Exports bundle to @a argv.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] b The bundle object
+ * @param[out] argv The pointer of the string array; \n
+ * This array has NULL values for the first and last item; \n
+ * First NULL is for argv[0], and last NULL is a terminator for execv() \n
+ * @return The number of item in @a argv. This value is equal to the actual count of argv - 1. (Last NULL terminator is not counted.)
+ * @retval @c -1 - Failure
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre @a b is a valid bundle object.
+ * @post @a argv is a pointer of newly allocated memory. It must be freed.
+ * Each item of @a argv points to the string in the bundle object @a b. If @a b is freed, @a argv will have garbage pointers. DO NOT FREE @a b BEFORE ACCESSING @a argv!!
+ * @see bundle_import_from_argv()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create(); // Create new bundle object
+ bundle_add_str(b, "foo_key", "bar_val"); // add a key-val pair
+
+ int argc = 0;
+ char **argv = NULL;
+ argc = bundle_export_to_argv(b, &argv); // export to argv
+ if(0 > argc) error("export failure");
+
+ int i;
+ for(i=0; i < argc; i++) {
+ printf("%s\n", argv[i]); // print argv
+ }
+ bundle_free_exported_argv(argc, argv); // argv must be freed after being used.
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_export_to_argv(bundle *b, char ***argv);
+
+/**
+ * @brief Frees the exported @a argv.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must not use this API when you use global @a argv.
+ * @param[in] argc The number of args, which is the return value of bundle_export_to_argv()
+ * @param[in] argv The array from bundle_export_to_argv()
+ * @return The operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a argv is a valid string array generated from bundle_export_to_argv().
+ * @see bundle_export_to_argv()
+ @code
+ bundle *b = bundle_create();
+ bundle_add_str(b, "foo", "bar");
+
+ int argc = 0;
+ char **argv = NULL;
+ argc = bundle_export_to_argv(b, &argv);
+ if(0 > argc) error("export failure");
+
+ // Use argv...
+
+ bundle_free_exported_argv(argc, argv);
+ argv = NULL;
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_free_exported_argv(int argc, char ***argv);
+
+/**
+ * @brief Imports a bundle from @a argv.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @param[in] argc The argument count
+ * @param[in] argv The argument vector
+ * @return The new bundle object
+ * @retval @c NULL - Failure
+ * @exception BUNDLE_ERROR_NONE Success
+ * @exception BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre @a argv is a valid string array, which is created by bundle_export_to_argv().
+ * @post The returned bundle @a b must be freed.
+ * @see bundle_export_to_argv()
+ @code
+ #include <bundle.h>
+
+ int main(int argc, char **argv) {
+ bundle *b = bundle_import_from_argv(argc, argv); // import from argc+argv
+ char *val = bundle_get_val(b, "foo_key"); // value for "foo_key"
+ // ......
+ bundle_free(b); // After freeing b, val becomes a dangling pointer.
+ val = NULL;
+ }
+ @endcode
+ */
+API bundle * bundle_import_from_argv(int argc, char **argv);
+
+/**
+ * @brief Sets a value of string array elements.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] b The bundle object
+ * @param[in] key The key
+ * @param[in] idx The index of the array element to be changed
+ * @param[in] val The string type value; if @c NULL, an empty array is created; you can change an item with
+ * @return The operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre @a b must be a valid bundle object.
+ * @see bundle_add_str_array()
+ * @see bundle_get_str_array()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create();
+ bundle_add_str_array(b, "foo", NULL, 3); // add a key-val pair
+ bundle_set_str_array_element(b, "foo", 0, "aaa");
+ bundle_set_str_array_element(b, "foo", 1, "bbb");
+ bundle_set_str_array_element(b, "foo", 2, "ccc");
+
+ char **str_array = NULL;
+ int len_str_array = 0;
+
+ str_array=bundle_get_str_array(b, "foo", &len_str_array);
+ // str_array = { "aaa", "bbb", "ccc" }, and len_str_array = 3
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_set_str_array_element(bundle *b, const char *key, const unsigned int idx, const char *val);
+
+/**
+ * @brief Adds a byte array type key-value pair into a bundle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] b The bundle object
+ * @param[in] key The key
+ * @param[in] byte_array Not used
+ * @param[in] len The length of the array to be created
+ * @return The operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval BUNDLE_ERROR_KEY_EXISTS Key already exists
+ * @retval BUNDLE_ERROR_OUT_OF_MEMORY Out of memory
+ * @pre @a b must be a valid bundle object.
+ * @see bundle_get_byte_array()
+ * @see bundle_set_byte_array_element()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create();
+ bundle_add_byte_array(b, "foo", NULL, 3); // add a byte-array with length 3
+
+ bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4); array[0] = "aaa\0"
+ bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4); array[1] = "bbb\0"
+ bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4); array[2] = "ccc\0"
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_add_byte_array(bundle *b, const char *key, void **byte_array, const unsigned int len);
+
+/**
+ * @brief Sets the value of the byte array element.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] b The bundle object
+ * @param[in] key The key
+ * @param[in] idx The index of the array element to be changed
+ * @param[in] val The string type value; if @c NULL, an empty array is created; you can change an item with
+ * @param[in] size The size of the value in bytes
+ * @return Operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval BUNDLE_ERROR_KEY_NOT_AVAILABLE Key not available
+ * @pre @a b must be a valid bundle object.
+ * @see bundle_add_byte_array()
+ * @see bundle_get_byte_array()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create();
+ bundle_add_byte_array(b, "foo", NULL, 3); // add a key-val pair
+
+ bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
+ bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
+ bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
+
+ unsigned char **byte_array = NULL;
+ int len_byte_array = 0;
+
+ bundle_get_byte_array(b, "foo", &byte_array, &len_byte_array, &size_byte_array);
+ // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, and len_byte_array = 3
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_set_byte_array_element(bundle *b, const char *key, const unsigned int idx, const void *val, const size_t size);
+
+/**
+ * @brief Gets the byte array value with the given key.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must not free str!
+ * @param[in] b The bundle object
+ * @param[in] key The key
+ * @param[out] byte_array The returned value
+ * @param[out] len The array length
+ * @param[out] array_element_size an array of sizes of each @a byte_array element
+ * @return The operation result
+ * @retval BUNDLE_ERROR_NONE Success
+ * @retval BUNDLE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval BUNDLE_ERROR_KEY_NOT_AVAILABLE Key not available
+ * @pre @a b must be a valid bundle object.
+ * @see bundle_add_byte_array()
+ * @see bundle_set_byte_array_element()
+ @code
+ #include <bundle.h>
+ bundle *b = bundle_create();
+ bundle_add_byte_array(b, "foo", NULL, 3);
+ bundle_set_byte_array_element(b, "foo", 0, "aaa\0", 4);
+ bundle_set_byte_array_element(b, "foo", 1, "bbb\0", 4);
+ bundle_set_byte_array_element(b, "foo", 2, "ccc\0", 4);
+
+ char **byte_array = NULL;
+ int len_byte_array = 0;
+ size_t *size_byte_array = NULL;
+
+ bundle_get_byte_array(b, "foo", &byte_array, &len_byte_array, &size_byte_array);
+ // byte_array = { "aaa\0", "bbb\0", "ccc\0" }, len_byte_array = 3, and size_byte_array = { 4, 4, 4 }
+
+ bundle_free(b);
+ @endcode
+ */
+API int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @}
+ * @}
+ */
+
+#endif /* __BUNDLE__INTERNAL_H__ */
diff --git a/packaging/bundle.spec b/packaging/bundle.spec
index a2a8431..76702c3 100644
--- a/packaging/bundle.spec
+++ b/packaging/bundle.spec
@@ -48,6 +48,7 @@ cp %{SOURCE1001} .
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_includedir}/bundle.h
+%{_includedir}/bundle_internal.h
%{_includedir}/SLP_bundle_PG.h
%{_libdir}/pkgconfig/bundle.pc
%{_libdir}/libbundle.so
diff --git a/src/bundle.c b/src/bundle.c
index 81ac13b..730088b 100644
--- a/src/bundle.c
+++ b/src/bundle.c
@@ -27,6 +27,7 @@
*/
#include "bundle.h"
+#include "bundle_internal.h"
#include "keyval.h"
#include "keyval_array.h"
#include "keyval_type.h"