return impl_->GetInstanceID();
}
-ResourceManager& Component::GetResourceManager() {
- return impl_->GetResourceManager();
-}
-
void Component::Finish() {
auto& mgr = internal::ComponentManager::GetInst();
mgr.Exit(impl_->GetInstanceID());
#include "component_based/base/device_orientation.h"
#include "component_based/base/low_battery.h"
#include "component_based/base/low_memory.h"
-#include "component_based/base/resource_manager.h"
#include "component_based/base/suspended_state.h"
#ifndef EXPORT_API
std::string GetComponentID();
std::string GetInstanceID();
- ResourceManager& GetResourceManager();
void Finish();
Type GetType();
void RegisterAction(std::string app_control_name);
#include "component_based/base/action_internal.h"
#include "component_based/base/component.h"
#include "component_based/base/component_manager_internal.h"
-#include "component_based/base/resource_manager.h"
#include "component_based/base/system_event_internal.h"
#include "component_based/base/content_manager_internal.h"
return inst_id_;
}
- ResourceManager& GetResourceManager() {
- return res_mgr_;
- }
-
void SendAsync(AppControl control, AppControl::IEventListener* ev);
AppControl Send(AppControl control);
std::string inst_id_;
std::unique_ptr<internal::SystemEvent> sys_ev_;
std::unique_ptr<internal::ContentManager> content_mgr_;
- ResourceManager res_mgr_;
State state_ = State::None;
std::map<std::string, std::unique_ptr<internal::Action>> act_map_;
};
+++ /dev/null
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
- *
- * 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_resource_manager.h>
-
-#include <memory>
-#include <string>
-
-#include "component_based/base/dlog_internal.h"
-#include "component_based/base/resource_manager.h"
-
-namespace component_based {
-
-std::string ResourceManager::Get(ResourceManager::Type type, std::string id) {
- char* path = nullptr;
- int r = app_resource_manager_get(static_cast<app_resource_e>(type),
- id.c_str(), &path);
- if (r != APP_RESOURCE_ERROR_NONE) {
- LOGE("Failed to get resource(%s). error(%d)", id.c_str(), r);
- return std::string("");
- }
-
- auto p = std::unique_ptr<char, decltype(std::free)*>(path, std::free);
- return std::string(p.get());
-}
-
-} // namespace component_based
+++ /dev/null
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
- *
- * 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 COMPONENT_BASED_BASE_RESOURCE_MANAGER_H_
-#define COMPONENT_BASED_BASE_RESOURCE_MANAGER_H_
-
-#include <string>
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-namespace component_based {
-
-class EXPORT_API ResourceManager {
- public:
- enum class Type {
- Image,
- Layout,
- Sound,
- Bin,
- };
-
- std::string Get(Type type, std::string id);
-};
-
-} // namespace component_based
-
-#endif // COMPONENT_BASED_BASE_RESOURCE_MANAGER_H_
#include "component_based/base/service_component.h"
#include "component_based/base/component.h"
#include "component_based/base/component_implementation.h"
-#include "component_based/base/resource_manager.h"
#include "unit_tests/mock/mock_app_common.h"
#include "unit_tests/mock/mock_app_control.h"
component_based::Component::Type type = fc->GetType();
EXPECT_EQ(type, component_based::Component::Type::Frame);
-
- component_based::ResourceManager rm = fc->GetResourceManager();
- std::string path = rm.Get(component_based::ResourceManager::Type::Sound, "test");
- EXPECT_STREQ(path.c_str(), "tmp");
-
fc->Finish();
fc->RegisterAction(std::string("action"));