Add path builder for vconf key
authorJihoon Chung <jihoon.chung@samsung.com>
Sat, 29 Dec 2012 03:08:56 +0000 (12:08 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Sat, 29 Dec 2012 04:39:08 +0000 (13:39 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Current realization is define const to each source code for vconf
key which is used in the setting value. This commit create common inline
function for vconf key path builder.
[SCMRequest] N/A

Change-Id: I9f37edb3262d5967c522bdb4ba58fab624d551c6

modules/widget_dao/CMakeLists.txt
modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h
modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h [new file with mode: 0644]

index fca9cba..cf1034f 100644 (file)
@@ -126,11 +126,12 @@ INSTALL(FILES
     include/dpl/wrt-dao-ro/plugin_dao_read_only.h
     include/dpl/wrt-dao-ro/property_dao_read_only.h
     include/dpl/wrt-dao-ro/widget_config.h
+    include/dpl/wrt-dao-ro/vconf_config.h
     include/dpl/wrt-dao-ro/widget_dao_read_only.h
     include/dpl/wrt-dao-ro/wrt_db_types.h
     include/dpl/wrt-dao-ro/WrtDatabase.h
     DESTINATION include/dpl-efl/dpl/wrt-dao-ro
-       )
+    )
 
 INSTALL(FILES
     include/dpl/wrt-dao-rw/feature_dao.h
index 2721214..87bf9d6 100644 (file)
@@ -284,6 +284,37 @@ inline const char* GetTempInstallInfoPath()
 {
     return "/opt/share/widget/temp_info";
 }
+
+inline const char* GetVconfKeyPrefixPath()
+{
+    return "file/private";
+}
+
+inline const char* GetVconfKeyPopupUsagePath()
+{
+    return "/popup_usage";
+}
+
+inline const char* GetVconfKeyGeolocationUsagePath()
+{
+    return "/geolocation_usage";
+}
+
+inline const char* GetVconfKeyWebNotificationUsagePath()
+{
+    return "/web_notification_usage";
+}
+
+inline const char* GetVconfKeyWebDatabaseUsagePath()
+{
+    return "/web_database_usage";
+}
+
+inline const char* GetVconfKeyFilesystemUsagePath()
+{
+    return "/filesystem_usage";
+}
+
 } // namespace GlobalConfig
 } // namespace WrtDB
 
diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h
new file mode 100644 (file)
index 0000000..4a3c2cb
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+/**
+ * @file    vconf_config.h
+ * @author  Jihoon Chung (jihoon.chung@samsung.com)
+ * @version 1.0
+ * @brief   Implementation file for vconf key config.
+ */
+#ifndef SRC_DOMAIN_VCONF_CONFIG_H
+#define SRC_DOMAIN_VCONF_CONFIG_H
+
+#include <string>
+#include <dpl/string.h>
+
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/wrt-dao-ro/path_builder.h>
+
+namespace WrtDB {
+namespace VconfConfig {
+inline std::string GetVconfKeyRootPath(DPL::String pkgName)
+{
+    return PathBuilder()
+               .Append(GlobalConfig::GetVconfKeyPrefixPath())
+               .Append(DPL::ToUTF8String(pkgName))
+               .GetFullPath();
+}
+
+inline std::string GetVconfKeyPopupUsage(DPL::String pkgName)
+{
+    return PathBuilder()
+               .Append(GlobalConfig::GetVconfKeyPrefixPath())
+               .Append(DPL::ToUTF8String(pkgName))
+               .Concat(GlobalConfig::GetVconfKeyPopupUsagePath())
+               .GetFullPath();
+}
+
+inline std::string GetVconfKeyGeolocationUsage(DPL::String pkgName)
+{
+    return PathBuilder()
+               .Append(GlobalConfig::GetVconfKeyPrefixPath())
+               .Append(DPL::ToUTF8String(pkgName))
+               .Concat(GlobalConfig::GetVconfKeyGeolocationUsagePath())
+               .GetFullPath();
+}
+
+inline std::string GetVconfKeyWebNotificationUsage(DPL::String pkgName)
+{
+    return PathBuilder()
+               .Append(GlobalConfig::GetVconfKeyPrefixPath())
+               .Append(DPL::ToUTF8String(pkgName))
+               .Concat(GlobalConfig::GetVconfKeyWebNotificationUsagePath())
+               .GetFullPath();
+}
+
+inline std::string GetVconfKeyWebDatabaseUsage(DPL::String pkgName)
+{
+    return PathBuilder()
+               .Append(GlobalConfig::GetVconfKeyPrefixPath())
+               .Append(DPL::ToUTF8String(pkgName))
+               .Concat(GlobalConfig::GetVconfKeyWebDatabaseUsagePath())
+               .GetFullPath();
+}
+
+inline std::string GetVconfKeyFilesystemUsage(DPL::String pkgName)
+{
+    return PathBuilder()
+               .Append(GlobalConfig::GetVconfKeyPrefixPath())
+               .Append(DPL::ToUTF8String(pkgName))
+               .Concat(GlobalConfig::GetVconfKeyFilesystemUsagePath())
+               .GetFullPath();
+}
+
+} // namespace VconfConfig
+} // namespace WrtDB
+
+#endif