IntegerPropertyPolicy::IntegerPropertyPolicy(PolicyEnforce& policy_enforce, const std::string& policy_name, IntPropSetter setter, IntPropGetter getter)
: IPolicy(policy_enforce, policy_name), m_setter(setter), m_getter(getter)
{
- if (!m_setter) {
+ if (!m_setter) {
throw std::runtime_error("Setter is empty.");
- }
+ }
}
int IntegerPropertyPolicy::apply(device_policy_manager_h hdpm, const Json::Value& policy)
std::string name = policy.get("name", "").asString();
- if(!m_getter) {
+ if (!m_getter) {
LOG_E(TAG, "Getting policy [%s] state is not supported", name.c_str());
policy["error"] = TIZEN_ERROR_NOT_SUPPORTED;
return TIZEN_ERROR_NOT_SUPPORTED;
try {
int value = 0;
- if((res = m_getter(hdpm, &value)) != TIZEN_ERROR_NONE) {
+ if ((res = m_getter(hdpm, &value)) != TIZEN_ERROR_NONE) {
LOG_E(TAG, "Getting policy [%s] state failed with error: %d", name.c_str(), res);
policy["error"] = res;
- }
- else {
+ } else {
LOG_D(TAG, "Policy [%s] state [%d]", name.c_str(), value);
policy["value"] = value;
}