Not export internal APIs
[platform/framework/native/appfw.git] / src / base / inc / FBase_NativeError.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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  * @file                FBaseNativeError.h
19  * @brief               This is the header file for handling Native errors.
20  */
21 #ifndef _FBASE_NATIVE_ERROR_H_
22 #define _FBASE_NATIVE_ERROR_H_
23
24 #include <FBaseResult.h>
25
26 #define __FUNCX__ __PRETTY_FUNCTION__
27
28 #ifdef _OSP_DEBUG_
29 #define __ConvertNativeErrorToResult(errNo)  _NativeError::ConvertNativeErrorToResult(errNo, __FILE__, __LINE__, __FUNCX__)
30 #define __ConvertNativeErrorToMessage(errNo) _NativeError::ConvertNativeErrorToMessage(errNo, __FILE__, __LINE__, __FUNCX__)
31 #else
32 #define __ConvertNativeErrorToResult(errNo)  _NativeError::ConvertNativeErrorToResult(errNo)
33 #define __ConvertNativeErrorToMessage(errNo) _NativeError::ConvertNativeErrorToMessage(errNo)
34 #endif
35
36 #define __ConvertNativeSystemErrorToResult(errNo)       _NativeError::ConvertNativeSystemErrorToResult(errNo)
37 #define __ConvertNativeDeviceErrorToResult(errNo)       _NativeError::ConvertNativeDeviceErrorToResult(errNo)
38 #define __ConvertNativePowerErrorToResult(errNo)        _NativeError::ConvertNativePowerErrorToResult(errNo)
39 #define __ConvertNativeAlarmErrorToResult(errNo)        _NativeError::ConvertNativeAlarmErrorToResult(errNo)
40 #define __ConvertNativeHapticErrorToResult(errNo)       _NativeError::ConvertNativeHapticErrorToResult(errNo)
41 #define __ConvertNativeTelephonyErrorToResult(errNo)    _NativeError::ConvertNativeTelephonyErrorToResult(errNo)
42 #define __ConvertNativeSoundManagerErrorToResult(errNo) _NativeError::ConvertNativeSoundManagerErrorToResult(errNo)
43 #define __ConvertNativeSqliteErrorToResult(errNo)       _NativeError::ConvertNativeSqliteErrorToResult(errNo)
44 #define __ConvertNativeSqliteErrorToDetailResult(errNo) _NativeError::ConvertNativeSqliteErrorToDetailResult(errNo)
45
46 /**
47  *      @class  _NativeError & FBaseNativeError.h
48  *      @brief  This is implemenatation of handling native errors.
49  *
50  */
51 class _OSP_LOCAL_ _NativeError
52 {
53 public:
54         //
55         // Convert Linux errno to Result type
56         //
57         static result ConvertNativeErrorToResult(int errNo, bool logNativeErr = false);
58
59         //
60         // Convert Linux errno to Result type
61         //
62         static result ConvertNativeErrorToResult(int errNo, const char* pFile, int line, const char* pFunction, bool logNativeErr = false);
63
64         //
65         // Convert Linux errno to Result type message
66         //
67         static const char* ConvertNativeErrorToMessage(int errNo);
68
69         //
70         // Convert Linux errno to Result type message
71         //
72         static const char* ConvertNativeErrorToMessage(int errNo, const char* pFile, int line, const char* pFunction);
73
74         //
75         // Convert SLP system_info error to Result type
76         //
77         static result ConvertNativeSystemErrorToResult(int err);
78
79         //
80         // Convert SLP device error to Result type
81         //
82         static result ConvertNativeDeviceErrorToResult(int err);
83
84         //
85         // Convert SLP power error to Result type
86         //
87         static result ConvertNativePowerErrorToResult(int err);
88
89         //
90         // Convert SLP alarm error to Result type
91         //
92         static result ConvertNativeAlarmErrorToResult(int err);
93
94         //
95         // Convert SLP haptic error to Result type
96         //
97         static result ConvertNativeHapticErrorToResult(int err);
98
99         //
100         // Convert SLP Telephony error to Result type
101         //
102         static result ConvertNativeTelephonyErrorToResult(int err);
103
104         //
105         // Convert SLP Telephony error to Result type
106         //
107         static result ConvertNativeSoundManagerErrorToResult(int err);
108
109         //
110         // Converts SQLite error to Result type for OSP 2.0
111         //
112         static result ConvertNativeSqliteErrorToResult(int err);
113
114         //
115         // Converts SQLite error to Result type for OSP 3.0
116         //
117         static result ConvertNativeSqliteErrorToDetailResult(int err);
118
119 }; // _NativeError
120 #endif //_FBASE_NATIVE_ERROR_H_