tizen 2.3 release
[framework/web/wearable/wrt-security.git] / ace / include / ace / Effect.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 //
17 //
18 //
19 //  @ Project : Access Control Engine
20 //  @ File Name : Effect.h
21 //  @ Date : 2009-05-06
22 //  @ Author : Samsung
23 //
24 //
25
26 #ifndef _EFFECT_H_
27 #define _EFFECT_H_
28
29 #include <list>
30
31 typedef int RuleId;
32
33 enum Effect
34 {
35     Deny =0,
36     Undetermined=1,    // jk mb added this enum, so the ones below are inceremented!!!!!!!
37     PromptOneShot =2,
38     PromptSession =3,
39     PromptBlanket =4,
40     Permit =5,
41     Inapplicable =6,
42     NotMatchingTarget=7,
43     Error=8,
44 };
45
46 struct ExtendedEffect {
47 public:
48     ExtendedEffect(Effect effect = Error, RuleId ruleId = -1)
49       : m_effect(effect)
50       , m_ruleId(ruleId)
51     {}
52
53     ExtendedEffect(const ExtendedEffect &second)
54       : m_effect(second.m_effect)
55       , m_ruleId(second.m_ruleId)
56     {}
57
58     ExtendedEffect& operator=(const ExtendedEffect &second) {
59         m_effect = second.m_effect;
60         m_ruleId = second.m_ruleId;
61         return *this;
62     }
63
64     Effect getEffect() const { return m_effect; }
65
66     RuleId getRuleId() const { return m_ruleId; }
67
68 private:
69     Effect m_effect;
70     RuleId m_ruleId;
71 };
72
73 typedef std::list<ExtendedEffect> ExtendedEffectList;
74
75 inline const char *toString(const ExtendedEffect &effect)
76 {
77     const char * temp = "";
78
79     switch (effect.getEffect()) {
80     case Deny:
81         temp = "Deny";
82         break;
83     case Undetermined:
84         temp = "Undetermined";
85         break;
86     case PromptOneShot:
87         temp = "PromptOneShot";
88         break;
89     case PromptSession:
90         temp = "PromptSession";
91         break;
92     case PromptBlanket:
93         temp = "PromptBlanket";
94         break;
95     case Permit:
96         temp = "Permit";
97         break;
98     case Inapplicable:
99         temp = "Inapplicable";
100         break;
101     case NotMatchingTarget:
102         temp = "NotMatchingTarget";
103         break;
104     case Error:
105         temp = "Error";
106         break;
107     default:;
108     }
109     return temp;
110 }
111
112 #endif  //_EFFECT_H_