Fix the boiler plate codes
[platform/framework/native/appfw.git] / src / io / FIoDataSet.cpp
1 //\r
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
3 //\r
4 // Licensed under the Apache License, Version 2.0 (the License);\r
5 // you may not use this file except in compliance with the License.\r
6 // You may obtain a copy of the License at\r
7 //\r
8 //     http://www.apache.org/licenses/LICENSE-2.0\r
9 //\r
10 // Unless required by applicable law or agreed to in writing, software\r
11 // distributed under the License is distributed on an "AS IS" BASIS,\r
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 // See the License for the specific language governing permissions and\r
14 // limitations under the License.\r
15 //\r
16 \r
17 /**\r
18 * @file         FIoDataSet.cpp\r
19 * @brief                This is the implementation file for the DataSet class.\r
20 */\r
21 #include <new>\r
22 #include <unique_ptr.h>\r
23 \r
24 #include <FBaseResult.h>\r
25 #include <FBaseSysLog.h>\r
26 #include <FBase_NativeError.h>\r
27 \r
28 #include <FIoDataSet.h>\r
29 #include <FIoDataRow.h>\r
30 #include <FIoDataSetEnumerator.h>\r
31 #include <FIo_DataSetImpl.h>\r
32 \r
33 \r
34 using namespace std;\r
35 using namespace Tizen::Base;\r
36 using namespace Tizen::Base::Runtime;\r
37 using namespace Tizen::System;\r
38 \r
39 namespace Tizen { namespace Io\r
40 {\r
41 \r
42 \r
43 DataSet::DataSet(void)\r
44         : __pDataSetImpl(null)\r
45 {\r
46 }\r
47 \r
48 DataSet::~DataSet(void)\r
49 {\r
50         delete __pDataSetImpl;\r
51 }\r
52 \r
53 result\r
54 DataSet::Construct(const Tizen::Base::Collection::IList& columnNames)\r
55 {\r
56         SysAssertf(__pDataSetImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");\r
57 \r
58 \r
59         unique_ptr<_DataSetImpl> pDataSetImpl(new (std::nothrow) _DataSetImpl);\r
60         SysTryReturnResult(NID_IO, pDataSetImpl != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
61 \r
62         result r = pDataSetImpl->Construct(columnNames);\r
63         SysTryReturn(NID_IO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));\r
64 \r
65         __pDataSetImpl = pDataSetImpl.release();\r
66 \r
67         return E_SUCCESS;\r
68 }\r
69 \r
70 DataRow*\r
71 DataSet::CreateDataRowN(void)\r
72 {\r
73         SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
74 \r
75         return __pDataSetImpl->CreateDataRowN();\r
76 }\r
77 \r
78 DataSetEnumerator*\r
79 DataSet::GetDataSetEnumeratorN(void)\r
80 {\r
81         SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
82 \r
83         return __pDataSetImpl->GetDataSetEnumeratorN();\r
84 }\r
85 \r
86 DataSet*\r
87 DataSet::CloneN(void) const\r
88 {\r
89         SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
90 \r
91         return __pDataSetImpl->CloneN();\r
92 }\r
93 \r
94 bool\r
95 DataSet::Equals(const Tizen::Base::Object& obj) const\r
96 {\r
97         SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
98 \r
99         return __pDataSetImpl->Equals(obj);\r
100 }\r
101 \r
102 int\r
103 DataSet::GetHashCode(void) const\r
104 {\r
105         SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
106 \r
107         return __pDataSetImpl->GetHashCode();\r
108 }\r
109 \r
110 }} // Tizen::Io\r
111 \r
112 \r