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