#include <regex>
#include "wm_layer.hpp"
-#include "wayland_ivi_wm.hpp"
#include "json_helper.hpp"
#include "util.hpp"
// this->setting = std::make_unique<LayerSetting>(name, type, begin, end);
}
+WMLayer::WMLayer(json_object* j) : before_state(), state()
+{
+ LayerSetting::MANAGEMENT_TYPE t;
+ const char* layer_name = jh::getStringFromJson(j, "name");
+ const char* role = jh::getStringFromJson(j, "role");
+ const char* type = jh::getStringFromJson(j, "type");
+ int begin = jh::getIntFromJson(j, "id_range_begin");
+ int end = jh::getIntFromJson(j, "id_range_end");
+ string name = layer_name;
+
+ if (layer_name || type || !begin < 0 || end < 0)
+ {
+ HMI_ERROR("Parse Error!!");
+ }
+ if(begin > end)
+ {
+ HMI_ERROR("INVALID.");
+ }
+ string str_type = type;
+ t = (type == "tile") ? LayerSetting::TILE : LayerSetting::STACK;
+ this->setting = std::make_unique<LayerSetting>(name, t, begin, end);
+ this->setting->appendRole(role);
+}
+
unsigned WMLayer::getNewLayerID(const std::string& role)
{
return this->setting->getNewLayerID(role);