2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file PolicyResult.h
18 * @author Aleksander Zdyb <a.zdyb@partner.samsung.com>
20 * @brief Definitions of PolicyResult and friends
23 #ifndef POLICYRESULT_H_
24 #define POLICYRESULT_H_
26 #include "types/PolicyType.h"
34 typedef std::string PolicyMetadata;
37 PolicyResult() : m_type(PredefinedPolicyType::DENY) {}
38 PolicyResult(const PolicyType &policyType) : m_type(policyType) {}
39 PolicyResult(const PolicyType &policyType, const PolicyMetadata &metadata)
40 : m_type(policyType), m_metadata(metadata) {}
44 PolicyMetadata m_metadata;
47 const PolicyType &policyType() const {
51 const PolicyMetadata& metadata() const {
55 bool operator <(const PolicyResult &other) const {
56 return this->m_type < other.m_type;
59 bool operator ==(const PolicyResult &other) const {
60 return std::tie(m_type, m_metadata) == std::tie(other.m_type, other.m_metadata);
63 bool operator !=(const PolicyResult &other) const {
64 return !(*this == other);
67 bool operator ==(const PolicyType &policyType) const {
68 return (m_type == policyType) && m_metadata.empty();
71 bool operator !=(const PolicyType &policyType) const {
72 return !(*this == policyType);
79 #endif /* POLICYRESULT_H_ */