sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FBaseErrorDefine.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FBaseErrorDefine.h
20  * @brief               This header file defines common error codes.
21  *
22  * This header file contains the definitions of error codes.
23  */
24
25 #ifndef _FBASE_ERROR_DEFINE_H_
26 #define _FBASE_ERROR_DEFINE_H_
27
28 #include <FBaseTypes.h>
29
30
31 #define E_SEVERITY_POS                  31
32 #define E_TYPE_POS                      29
33
34 #define SET_E_SEVERITY(X)               (static_cast<unsigned long>(PUT_MASK(0, (X), E_SEVERITY_POS)))
35 #define SET_E_TYPE(X)                   (static_cast<unsigned long>(PUT_MASK(0, (X), E_TYPE_POS)))
36 #define SET_E_CAUSE(X)                  (static_cast<unsigned long>(X))
37
38
39 // Error severities
40 #define E_SUCCESS                       (SET_E_SEVERITY(0))
41 #define E_FAILURE                       (SET_E_SEVERITY(1))
42
43
44 // Error types
45 #define ERR_SRC_FRAMEWORK               (E_FAILURE + SET_E_TYPE(1))
46 #define ERR_SRC_USER                    (E_FAILURE + SET_E_TYPE(2))
47
48
49 // Macros for error codes
50 #define IsFailed(X)                     (static_cast<long>(X) != E_SUCCESS)
51
52
53 #endif //_FBASE_ERROR_DEFINE_H_