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