sync with tizen_2.0
[platform/framework/native/appfw.git] / src / io / FIoDirEnumerator.cpp
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        FIoDirEnumerator.cpp
20  * @brief       This is the implementation file for DirEnumerator class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FIoDirEnumerator.h>
25 #include <FIoDirEntry.h>
26
27 #include <FBase_NativeError.h>
28 #include <FIo_DirEnumeratorImpl.h>
29
30 using namespace Tizen::Base;
31
32 namespace Tizen { namespace Io
33 {
34
35 DirEnumerator::DirEnumerator(const String& dirPath)
36         : __pCurDirEntry(null)
37         , __pDirEnumeratorImpl(null)
38 {
39         __pDirEnumeratorImpl = new (std::nothrow) _DirEnumeratorImpl(dirPath);
40         SysTryReturnVoidResult(NID_IO, __pDirEnumeratorImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
41 }
42
43 DirEnumerator::~DirEnumerator(void)
44 {
45         delete __pDirEnumeratorImpl;
46 }
47
48 DirEntry
49 DirEnumerator::GetCurrentDirEntry(void) const
50 {
51         return __pDirEnumeratorImpl->GetCurrentDirEntry();
52 }
53
54 Object*
55 DirEnumerator::GetCurrent(void) const
56 {
57         return __pDirEnumeratorImpl->GetCurrent();
58 }
59
60 result
61 DirEnumerator::MoveNext(void)
62 {
63         return __pDirEnumeratorImpl->MoveNext();
64 }
65
66 result
67 DirEnumerator::Reset(void)
68 {
69         return __pDirEnumeratorImpl->Reset();
70 }
71
72 }} // Tizen::Io
73