From c46dd6c184c8ad0a56a402d5a6cbf9b68db0c940 Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Mon, 23 May 2022 19:20:34 +0900 Subject: [PATCH] Add missing filter checker Change-Id: Ib51e5e25e2c3595d4f8804224f7a0ba1faa47d49 Signed-off-by: Changgyu Choi --- .../auto_restart_app_filter_checker.cc | 29 +++++++++++ .../auto_restart_app_filter_checker.hh | 38 ++++++++++++++ .../check_storage_app_filter_checker.cc | 28 +++++++++++ .../check_storage_app_filter_checker.hh | 38 ++++++++++++++ .../hw_acceleration_app_filter_checker.cc | 29 +++++++++++ .../hw_acceleration_app_filter_checker.hh | 38 ++++++++++++++ .../app_filter_checker/icon_app_filter_checker.cc | 40 +++++++++++++++ .../app_filter_checker/icon_app_filter_checker.hh | 38 ++++++++++++++ .../launch_condition_app_filter_checker.cc | 29 +++++++++++ .../launch_condition_app_filter_checker.hh | 38 ++++++++++++++ .../app_filter_checker/mime_app_filter_checker.cc | 38 ++++++++++++++ .../app_filter_checker/mime_app_filter_checker.hh | 38 ++++++++++++++ .../multiple_app_filter_checker.cc | 29 +++++++++++ .../multiple_app_filter_checker.hh | 38 ++++++++++++++ .../onboot_app_filter_checker.cc | 32 ++++++++++++ .../onboot_app_filter_checker.hh | 38 ++++++++++++++ .../screen_reader_app_filter_checker.cc | 29 +++++++++++ .../screen_reader_app_filter_checker.hh | 38 ++++++++++++++ .../support_disable_app_filter_checker.cc | 29 +++++++++++ .../support_disable_app_filter_checker.hh | 38 ++++++++++++++ .../support_mode_app_filter_checker.cc | 29 +++++++++++ .../support_mode_app_filter_checker.hh | 38 ++++++++++++++ .../task_manage_app_filter_checker.cc | 29 +++++++++++ .../task_manage_app_filter_checker.hh | 38 ++++++++++++++ .../ui_gadget_app_filter_checker.cc | 29 +++++++++++ .../ui_gadget_app_filter_checker.hh | 38 ++++++++++++++ .../app_filter_checker/uri_app_filter_checker.cc | 38 ++++++++++++++ .../app_filter_checker/uri_app_filter_checker.hh | 38 ++++++++++++++ src/server/filter_checker/filter_checker_list.hh | 30 ++++++++++- .../filter_checker/filter_checker_provider.cc | 58 +++++++++++++++++++++- .../app_setting_pkg_filter_checker.cc | 29 +++++++++++ .../app_setting_pkg_filter_checker.hh | 38 ++++++++++++++ .../author_email_pkg_filter_checker.cc | 31 ++++++++++++ .../author_email_pkg_filter_checker.hh | 38 ++++++++++++++ .../author_href_pkg_filter_checker.cc | 31 ++++++++++++ .../author_href_pkg_filter_checker.hh | 38 ++++++++++++++ .../author_name_pkg_filter_checker.cc | 31 ++++++++++++ .../author_name_pkg_filter_checker.hh | 38 ++++++++++++++ .../install_location_pkg_filter_checker.cc | 29 +++++++++++ .../install_location_pkg_filter_checker.hh | 38 ++++++++++++++ .../installed_storage_pkg_filter_checker.cc | 29 +++++++++++ .../installed_storage_pkg_filter_checker.hh | 38 ++++++++++++++ .../nodisplay_pkg_filter_checker.cc | 29 +++++++++++ .../nodisplay_pkg_filter_checker.hh | 38 ++++++++++++++ .../pkg_size_pkg_filter_checker.cc | 29 +++++++++++ .../pkg_size_pkg_filter_checker.hh | 38 ++++++++++++++ .../pkgtype_pkg_filter_checker.cc | 29 +++++++++++ .../pkgtype_pkg_filter_checker.hh | 38 ++++++++++++++ .../read_only_pkg_filter_checker.cc | 29 +++++++++++ .../read_only_pkg_filter_checker.hh | 38 ++++++++++++++ .../support_disable_pkg_filter_checker.cc | 29 +++++++++++ .../support_disable_pkg_filter_checker.hh | 38 ++++++++++++++ .../system_pkg_filter_checker.cc | 29 +++++++++++ .../system_pkg_filter_checker.hh | 38 ++++++++++++++ .../update_pkg_filter_checker.cc | 29 +++++++++++ .../update_pkg_filter_checker.hh | 38 ++++++++++++++ .../version_pkg_filter_checker.cc | 29 +++++++++++ .../version_pkg_filter_checker.hh | 38 ++++++++++++++ 58 files changed, 1999 insertions(+), 2 deletions(-) create mode 100644 src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/icon_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/icon_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/mime_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/mime_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.hh create mode 100644 src/server/filter_checker/app_filter_checker/uri_app_filter_checker.cc create mode 100644 src/server/filter_checker/app_filter_checker/uri_app_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.hh create mode 100644 src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.cc create mode 100644 src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.hh diff --git a/src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.cc new file mode 100644 index 0000000..2f45690 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "auto_restart_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool AutoRestartAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->autorestart != nullptr && + strcasecmp(node->value, info->autorestart) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.hh new file mode 100644 index 0000000..9f58114 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/auto_restart_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 AUTO_RESTART_APP_FILTER_CHECKER_HH_ +#define AUTO_RESTART_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class AutoRestartAppFilterChecker: public IAppFilterChecker { + public: + AutoRestartAppFilterChecker() = default; + ~AutoRestartAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // AUTO_RESTART_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.cc new file mode 100644 index 0000000..b14eaa6 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.cc @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "check_storage_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool CheckStorageAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return true; +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.hh new file mode 100644 index 0000000..b075c81 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/check_storage_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 CHECK_STORAGE_APP_FILTER_CHECKER_HH_ +#define CHECK_STORAGE_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class CheckStorageAppFilterChecker: public IAppFilterChecker { + public: + CheckStorageAppFilterChecker() = default; + ~CheckStorageAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // CHECK_STORAGE_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.cc new file mode 100644 index 0000000..f6756fb --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "hw_acceleration_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool HWAccelerationAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->hwacceleration != nullptr && + strcmp(node->value, info->hwacceleration) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.hh new file mode 100644 index 0000000..931ce00 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/hw_acceleration_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 HW_ACCELERATION_APP_FILTER_CHECKER_HH_ +#define HW_ACCELERATION_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class HWAccelerationAppFilterChecker: public IAppFilterChecker { + public: + HWAccelerationAppFilterChecker() = default; + ~HWAccelerationAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // HW_ACCELERATION_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/icon_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/icon_app_filter_checker.cc new file mode 100644 index 0000000..f04fc29 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/icon_app_filter_checker.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "icon_app_filter_checker.hh" + +#include +#include + +namespace pkgmgr_server { +namespace database { + +bool IconAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + if (node->value == nullptr) + return false; + + for (auto* it = info->icon; it; it = g_list_next(it)) { + auto path = reinterpret_cast(it->data)->text; + if (path != nullptr && strcmp(path, node->value) == 0) + return true; + } + + return false; +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/icon_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/icon_app_filter_checker.hh new file mode 100644 index 0000000..9f83617 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/icon_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 ICON_APP_FILTER_CHECKER_HH_ +#define ICON_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class IconAppFilterChecker: public IAppFilterChecker { + public: + IconAppFilterChecker() = default; + ~IconAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // ICON_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.cc new file mode 100644 index 0000000..17981ba --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "launch_condition_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool LaunchConditionAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->launchcondition != nullptr && + strcmp(node->value, info->launchcondition) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.hh new file mode 100644 index 0000000..57c9746 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/launch_condition_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 LAUNCH_CONDITION_APP_FILTER_CHECKER_HH_ +#define LAUNCH_CONDITION_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class LaunchConditionAppFilterChecker: public IAppFilterChecker { + public: + LaunchConditionAppFilterChecker() = default; + ~LaunchConditionAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // LAUNCH_CONDITION_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/mime_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/mime_app_filter_checker.cc new file mode 100644 index 0000000..d296ab0 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/mime_app_filter_checker.cc @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "mime_app_filter_checker.hh" + +#include + +namespace pkgmgr_server { +namespace database { + +bool MimeAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + if (node->value == nullptr) + return false; + for (auto* it = info->appcontrol; it != nullptr; it = g_list_next(it)) { + char* value = reinterpret_cast(it->data)->mime; + if (value != nullptr && strcmp(value, node->value) == 0) + return true; + } + + return false; +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/mime_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/mime_app_filter_checker.hh new file mode 100644 index 0000000..adfef2f --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/mime_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 MIME_APP_FILTER_CHECKER_HH_ +#define MIME_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class MimeAppFilterChecker: public IAppFilterChecker { + public: + MimeAppFilterChecker() = default; + ~MimeAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // MIME_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.cc new file mode 100644 index 0000000..a54da86 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "multiple_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool MultipleAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->multiple != nullptr && + strcasecmp(node->value, info->multiple) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.hh new file mode 100644 index 0000000..5462e87 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/multiple_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 MULTIPLE_APP_FILTER_CHECKER_HH_ +#define MULTIPLE_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class MultipleAppFilterChecker: public IAppFilterChecker { + public: + MultipleAppFilterChecker() = default; + ~MultipleAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // MULTIPLE_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.cc new file mode 100644 index 0000000..0ad6559 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.cc @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "onboot_app_filter_checker.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +bool OnBootAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->onboot != nullptr && + strcasecmp(node->value, info->onboot) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.hh new file mode 100644 index 0000000..83a4965 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/onboot_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 ONBOOT_APP_FILTER_CHECKER_HH_ +#define ONBOOT_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class OnBootAppFilterChecker: public IAppFilterChecker { + public: + OnBootAppFilterChecker() = default; + ~OnBootAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // ONBOOT_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.cc new file mode 100644 index 0000000..6536c02 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "screen_reader_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool ScreenReaderAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->screenreader != nullptr && + strcmp(node->value, info->screenreader) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.hh new file mode 100644 index 0000000..2ddf2f3 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/screen_reader_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 SCREEN_READER_APP_FILTER_CHECKER_HH_ +#define SCREEN_READER_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class ScreenReaderAppFilterChecker: public IAppFilterChecker { + public: + ScreenReaderAppFilterChecker() = default; + ~ScreenReaderAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // SCREEN_READER_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.cc new file mode 100644 index 0000000..5f90402 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "support_disable_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool SupportDisableAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->support_disable != nullptr && + strcasecmp(node->value, info->ui_gadget) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.hh new file mode 100644 index 0000000..6481e1c --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/support_disable_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 SUPPORT_DISABLE_APP_FILTER_CHECKER_HH_ +#define SUPPORT_DISABLE_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class SupportDisableAppFilterChecker: public IAppFilterChecker { + public: + SupportDisableAppFilterChecker() = default; + ~SupportDisableAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // SUPPORT_DISABLE_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.cc new file mode 100644 index 0000000..a303d11 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "support_mode_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool SupportModeAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->support_mode != nullptr && + strcmp(node->value, info->support_mode) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.hh new file mode 100644 index 0000000..380b89a --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/support_mode_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 SUPPORT_MODE_APP_FILTER_CHECKER_HH_ +#define SUPPORT_MODE_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class SupportModeAppFilterChecker: public IAppFilterChecker { + public: + SupportModeAppFilterChecker() = default; + ~SupportModeAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // SUPPORT_MODE_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.cc new file mode 100644 index 0000000..501db60 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "task_manage_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool TaskManageAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->taskmanage != nullptr && + strcasecmp(node->value, info->taskmanage) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.hh new file mode 100644 index 0000000..469936a --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/task_manage_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 TASK_MANAGE_APP_FILTER_CHECKER_HH_ +#define TASK_MANAGE_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class TaskManageAppFilterChecker: public IAppFilterChecker { + public: + TaskManageAppFilterChecker() = default; + ~TaskManageAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // TASK_MANAGE_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.cc new file mode 100644 index 0000000..bf6ece0 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "ui_gadget_app_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool UIGadgetAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + return (node->value != nullptr && info->ui_gadget != nullptr && + strcmp(node->value, info->ui_gadget) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.hh new file mode 100644 index 0000000..4fb2500 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/ui_gadget_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 UI_GADGET_APP_FILTER_CHECKER_HH_ +#define UI_GADGET_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class UIGadgetAppFilterChecker: public IAppFilterChecker { + public: + UIGadgetAppFilterChecker() = default; + ~UIGadgetAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // UI_GADGET_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/app_filter_checker/uri_app_filter_checker.cc b/src/server/filter_checker/app_filter_checker/uri_app_filter_checker.cc new file mode 100644 index 0000000..6d23091 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/uri_app_filter_checker.cc @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "uri_app_filter_checker.hh" + +#include + +namespace pkgmgr_server { +namespace database { + +bool URIAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + application_x* info) { + if (node->value == nullptr) + return false; + for (auto* it = info->appcontrol; it != nullptr; it = g_list_next(it)) { + char* value = reinterpret_cast(it->data)->uri; + if (value != nullptr && strcmp(value, node->value) == 0) + return true; + } + + return false; +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/app_filter_checker/uri_app_filter_checker.hh b/src/server/filter_checker/app_filter_checker/uri_app_filter_checker.hh new file mode 100644 index 0000000..44783b5 --- /dev/null +++ b/src/server/filter_checker/app_filter_checker/uri_app_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 URI_APP_FILTER_CHECKER_HH_ +#define URI_APP_FILTER_CHECKER_HH_ + +#include "app_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class URIAppFilterChecker: public IAppFilterChecker { + public: + URIAppFilterChecker() = default; + ~URIAppFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, application_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // URI_APP_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/filter_checker_list.hh b/src/server/filter_checker/filter_checker_list.hh index 69c4b23..7ba3f2f 100644 --- a/src/server/filter_checker/filter_checker_list.hh +++ b/src/server/filter_checker/filter_checker_list.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2021 - 2022 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. @@ -19,25 +19,53 @@ #include "app_filter_checker/app_disable_app_filter_checker.hh" #include "app_filter_checker/appid_app_filter_checker.hh" +#include "app_filter_checker/auto_restart_app_filter_checker.hh" #include "app_filter_checker/category_app_filter_checker.hh" +#include "app_filter_checker/check_storage_app_filter_checker.hh" #include "app_filter_checker/component_app_filter_checker.hh" #include "app_filter_checker/default_app_filter_checker.hh" #include "app_filter_checker/exec_app_filter_checker.hh" +#include "app_filter_checker/hw_acceleration_app_filter_checker.hh" +#include "app_filter_checker/icon_app_filter_checker.hh" +#include "app_filter_checker/launch_condition_app_filter_checker.hh" +#include "app_filter_checker/mime_app_filter_checker.hh" +#include "app_filter_checker/multiple_app_filter_checker.hh" #include "app_filter_checker/nodisplay_app_filter_checker.hh" +#include "app_filter_checker/onboot_app_filter_checker.hh" #include "app_filter_checker/operation_app_filter_checker.hh" #include "app_filter_checker/pkg_disable_app_filter_checker.hh" #include "app_filter_checker/pkgid_app_filter_checker.hh" #include "app_filter_checker/privilege_app_filter_checker.hh" +#include "app_filter_checker/screen_reader_app_filter_checker.hh" #include "app_filter_checker/storage_app_filter_checker.hh" +#include "app_filter_checker/support_disable_app_filter_checker.hh" +#include "app_filter_checker/support_mode_app_filter_checker.hh" +#include "app_filter_checker/task_manage_app_filter_checker.hh" #include "app_filter_checker/type_app_filter_checker.hh" +#include "app_filter_checker/ui_gadget_app_filter_checker.hh" +#include "app_filter_checker/uri_app_filter_checker.hh" +#include "pkg_filter_checker/app_setting_pkg_filter_checker.hh" +#include "pkg_filter_checker/author_email_pkg_filter_checker.hh" +#include "pkg_filter_checker/author_href_pkg_filter_checker.hh" +#include "pkg_filter_checker/author_name_pkg_filter_checker.hh" #include "pkg_filter_checker/check_storage_pkg_filter_checker.hh" #include "pkg_filter_checker/default_pkg_filter_checker.hh" #include "pkg_filter_checker/disable_pkg_filter_checker.hh" +#include "pkg_filter_checker/install_location_pkg_filter_checker.hh" +#include "pkg_filter_checker/installed_storage_pkg_filter_checker.hh" +#include "pkg_filter_checker/nodisplay_pkg_filter_checker.hh" +#include "pkg_filter_checker/pkg_size_pkg_filter_checker.hh" #include "pkg_filter_checker/pkgid_pkg_filter_checker.hh" +#include "pkg_filter_checker/pkgtype_pkg_filter_checker.hh" #include "pkg_filter_checker/preload_pkg_filter_checker.hh" #include "pkg_filter_checker/privilege_pkg_filter_checker.hh" +#include "pkg_filter_checker/read_only_pkg_filter_checker.hh" #include "pkg_filter_checker/removable_pkg_filter_checker.hh" #include "pkg_filter_checker/restype_pkg_filter_checker.hh" +#include "pkg_filter_checker/support_disable_pkg_filter_checker.hh" +#include "pkg_filter_checker/system_pkg_filter_checker.hh" +#include "pkg_filter_checker/update_pkg_filter_checker.hh" +#include "pkg_filter_checker/version_pkg_filter_checker.hh" #endif // FILTER_CHECKER_LIST_HH_ diff --git a/src/server/filter_checker/filter_checker_provider.cc b/src/server/filter_checker/filter_checker_provider.cc index 268ba66..48bb836 100644 --- a/src/server/filter_checker/filter_checker_provider.cc +++ b/src/server/filter_checker/filter_checker_provider.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2021 - 2022 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. @@ -27,6 +27,20 @@ namespace database { FilterCheckerProvider::FilterCheckerProvider() { pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_ID] = std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF] = + std::make_unique(); pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE] = std::make_unique(); pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE] = @@ -39,6 +53,20 @@ FilterCheckerProvider::FilterCheckerProvider() { std::make_unique(); pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_CHECK_STORAGE] = std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE] = + std::make_unique(); + pkg_checker_map_[E_PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM] = + std::make_unique(); app_checker_map_[E_PMINFO_APPINFO_PROP_APP_ID] = std::make_unique(); @@ -64,6 +92,34 @@ FilterCheckerProvider::FilterCheckerProvider() { std::make_unique(); app_checker_map_[E_PMINFO_APPINFO_PROP_PKG_DISABLE] = std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_ICON] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_URI] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_MIME] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_MULTIPLE] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_ONBOOT] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_AUTORESTART] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_TASKMANAGE] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_HWACCELERATION] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_SCREENREADER] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_UI_GADGET] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE] = + std::make_unique(); + app_checker_map_[E_PMINFO_APPINFO_PROP_APP_CHECK_STORAGE] = + std::make_unique(); default_pkg_checker = std::make_unique(); default_app_checker = std::make_unique(); diff --git a/src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.cc new file mode 100644 index 0000000..607bc8a --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "app_setting_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool AppSettingPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->appsetting != nullptr && + strcasecmp(node->value, info->appsetting) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.hh new file mode 100644 index 0000000..7ee67bb --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/app_setting_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 APP_SETTING_PKG_FILTER_CHECKER_HH_ +#define APP_SETTING_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class AppSettingPkgFilterChecker : public IPkgFilterChecker { + public: + AppSettingPkgFilterChecker() = default; + ~AppSettingPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // APP_SETTING_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.cc new file mode 100644 index 0000000..37eeb25 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.cc @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "author_email_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool AuthorEmailPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && + static_cast(info->author->data)->email != nullptr && + strcmp(node->value, + (static_cast(info->author->data))->email) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.hh new file mode 100644 index 0000000..b14b372 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/author_email_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 AUTHOR_EMAIL_PKG_FILTER_CHECKER_HH_ +#define AUTHOR_EMAIL_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class AuthorEmailPkgFilterChecker : public IPkgFilterChecker { + public: + AuthorEmailPkgFilterChecker() = default; + ~AuthorEmailPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // AUTHOR_EMAIL_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.cc new file mode 100644 index 0000000..99d87d8 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.cc @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "author_href_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool AuthorHrefPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && + static_cast(info->author->data)->href != nullptr && + strcmp(node->value, + (static_cast(info->author->data))->href) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.hh new file mode 100644 index 0000000..395b486 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/author_href_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 AUTHOR_HREF_PKG_FILTER_CHECKER_HH_ +#define AUTHOR_HREF_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class AuthorHrefPkgFilterChecker : public IPkgFilterChecker { + public: + AuthorHrefPkgFilterChecker() = default; + ~AuthorHrefPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // AUTHOR_HREF_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.cc new file mode 100644 index 0000000..ff572a9 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.cc @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "author_name_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool AuthorNamePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && + static_cast(info->author->data)->text != nullptr && + strcmp(node->value, + (static_cast(info->author->data))->text) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.hh new file mode 100644 index 0000000..a606478 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/author_name_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 AUTHOR_NAME_PKG_FILTER_CHECKER_HH_ +#define AUTHOR_NAME_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class AuthorNamePkgFilterChecker : public IPkgFilterChecker { + public: + AuthorNamePkgFilterChecker() = default; + ~AuthorNamePkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // AUTHOR_NAME_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.cc new file mode 100644 index 0000000..a7163f5 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "install_location_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool InstallLocationPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->installlocation != nullptr && + strcmp(node->value, info->installlocation) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.hh new file mode 100644 index 0000000..e4fb8a7 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/install_location_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 INSTALL_LOCATION_PKG_FILTER_CHECKER_HH_ +#define INSTALL_LOCATION_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class InstallLocationPkgFilterChecker : public IPkgFilterChecker { + public: + InstallLocationPkgFilterChecker() = default; + ~InstallLocationPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // INSTALL_LOCATION_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.cc new file mode 100644 index 0000000..bb15022 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "installed_storage_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool InstalledStorageFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->installed_storage != nullptr && + strcmp(node->value, info->installed_storage) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.hh new file mode 100644 index 0000000..42b7380 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/installed_storage_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 INSTALLED_STORAGE_PKG_FILTER_CHECKER_HH_ +#define INSTALLED_STORAGE_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class InstalledStorageFilterChecker : public IPkgFilterChecker { + public: + InstalledStorageFilterChecker() = default; + ~InstalledStorageFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // INSTALLED_STORAGE_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.cc new file mode 100644 index 0000000..86a8501 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "nodisplay_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool NoDisplayPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->nodisplay_setting != nullptr && + strcasecmp(node->value, info->nodisplay_setting) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.hh new file mode 100644 index 0000000..9ba59ff --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/nodisplay_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 NODISPLAY_PKG_FILTER_CHECKER_HH_ +#define NODISPLAY_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class NoDisplayPkgFilterChecker : public IPkgFilterChecker { + public: + NoDisplayPkgFilterChecker() = default; + ~NoDisplayPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // NODISPLAY_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.cc new file mode 100644 index 0000000..ee9a7bf --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "pkg_size_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool PkgSizePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->package_size != nullptr && + strcmp(node->value, info->package_size) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.hh new file mode 100644 index 0000000..8822c75 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/pkg_size_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 PKG_SIZE_PKG_FILTER_CHECKER_HH_ +#define PKG_SIZE_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class PkgSizePkgFilterChecker : public IPkgFilterChecker { + public: + PkgSizePkgFilterChecker() = default; + ~PkgSizePkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // PKG_SIZE_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.cc new file mode 100644 index 0000000..7b74692 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "pkgtype_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool PkgTypePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->type != nullptr && + strcasecmp(node->value, info->type) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.hh new file mode 100644 index 0000000..bc6ede1 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/pkgtype_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 PKGYPTE_PKG_FILTER_CHECKER_HH_ +#define PKGYPTE_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class PkgTypePkgFilterChecker : public IPkgFilterChecker { + public: + PkgTypePkgFilterChecker() = default; + ~PkgTypePkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // PKGYPTE_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.cc new file mode 100644 index 0000000..bad9dbb --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "read_only_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool ReadOnlyPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->readonly != nullptr && + strcasecmp(node->value, info->readonly) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.hh new file mode 100644 index 0000000..6a182d1 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/read_only_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 READ_ONLY_PKG_FILTER_CHECKER_HH_ +#define READ_ONLY_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class ReadOnlyPkgFilterChecker : public IPkgFilterChecker { + public: + ReadOnlyPkgFilterChecker() = default; + ~ReadOnlyPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // READ_ONLY_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.cc new file mode 100644 index 0000000..5f6a914 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "support_disable_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool SupportDisablePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->support_disable != nullptr && + strcasecmp(node->value, info->support_disable) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.hh new file mode 100644 index 0000000..69d603f --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/support_disable_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 SUPPORT_DISABLE_PKG_FILTER_CHECKER_HH_ +#define SUPPORT_DISABLE_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class SupportDisablePkgFilterChecker : public IPkgFilterChecker { + public: + SupportDisablePkgFilterChecker() = default; + ~SupportDisablePkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // SUPPORT_DISABLE_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.cc new file mode 100644 index 0000000..eea7d24 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "system_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool SystemPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->system != nullptr && + strcasecmp(node->value, info->system) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.hh new file mode 100644 index 0000000..930e580 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/system_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 SYSTEM_PKG_FILTER_CHECKER_HH_ +#define SYSTEM_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class SystemPkgFilterChecker : public IPkgFilterChecker { + public: + SystemPkgFilterChecker() = default; + ~SystemPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // SYSTEM_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.cc new file mode 100644 index 0000000..2464fe1 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "update_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool UpdatePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->update != nullptr && + strcasecmp(node->value, info->update) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.hh new file mode 100644 index 0000000..723228e --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/update_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 UPDATE_PKG_FILTER_CHECKER_HH_ +#define UPDATE_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class UpdatePkgFilterChecker : public IPkgFilterChecker { + public: + UpdatePkgFilterChecker() = default; + ~UpdatePkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // UPDATE_PKG_FILTER_CHECKER_HH_ diff --git a/src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.cc b/src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.cc new file mode 100644 index 0000000..dba9f88 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.cc @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 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. + */ + +#include "version_pkg_filter_checker.hh" + +namespace pkgmgr_server { +namespace database { + +bool VersionPkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node, + package_x* info) { + return (node->value != nullptr && info->version != nullptr && + strcmp(node->value, info->version) == 0); +} + +} // namespace database +} // namespace pkgmgr_server diff --git a/src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.hh b/src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.hh new file mode 100644 index 0000000..dc648e5 --- /dev/null +++ b/src/server/filter_checker/pkg_filter_checker/version_pkg_filter_checker.hh @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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 VERSION_PKG_FILTER_CHECKER_HH_ +#define VERSION_PKG_FILTER_CHECKER_HH_ + +#include "pkg_filter_checker_base.hh" + +#include "pkgmgrinfo_basic.h" +#include "pkgmgrinfo_private.h" + +namespace pkgmgr_server { +namespace database { + +class VersionPkgFilterChecker : public IPkgFilterChecker { + public: + VersionPkgFilterChecker() = default; + ~VersionPkgFilterChecker() = default; + bool CheckFilter(pkgmgrinfo_node_x* node, package_x* info) override; +}; + +} // namespace database +} // namespace pkgmgr_server + +#endif // VERSION_PKG_FILTER_CHECKER_HH_ -- 2.7.4