Merge "Update privilege check logic" into tizen_2.1
[platform/framework/native/appfw.git] / src / io / FIoDirEntry.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        FIoDirEntry.cpp
20  * @brief       This is the implementation file for DirEntry class.
21  */
22
23 #include <new>
24
25 #include <FBaseString.h>
26 #include <FBaseDateTime.h>
27 #include <FBaseSysLog.h>
28 #include <FIoDirEntry.h>
29
30 #include <FBase_NativeError.h>
31 #include <FIo_DirEntryImpl.h>
32
33 using namespace Tizen::Base;
34
35 namespace Tizen { namespace Io
36 {
37
38 DirEntry::DirEntry(void)
39         : __pDirEntryImpl(null)
40 {
41         __pDirEntryImpl = new (std::nothrow) _DirEntryImpl;
42         SysTryReturnVoidResult(NID_IO, __pDirEntryImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
43 }
44
45 DirEntry::~DirEntry(void)
46 {
47         delete __pDirEntryImpl;
48 }
49
50 DirEntry::DirEntry(const DirEntry& dirEntry)
51 {
52         __pDirEntryImpl = new (std::nothrow) _DirEntryImpl(*dirEntry.__pDirEntryImpl);
53         SysTryReturnVoidResult(NID_IO, __pDirEntryImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
54 }
55
56 DirEntry&
57 DirEntry::operator =(const DirEntry& dirEntry)
58 {
59         if (&dirEntry != this)
60         {
61                 *__pDirEntryImpl = *(dirEntry.__pDirEntryImpl);
62         }
63
64         return *this;
65 }
66
67 bool
68 DirEntry::Equals(const Object& object) const
69 {
70         const DirEntry* pOther = dynamic_cast< const DirEntry* >(&object);
71         if (pOther == null)
72         {
73                 return false;
74         }
75
76         return __pDirEntryImpl->Equals(*pOther->__pDirEntryImpl);
77 }
78
79 int
80 DirEntry::GetHashCode(void) const
81 {
82         return __pDirEntryImpl->GetHashCode();
83 }
84
85 const Tizen::Base::String
86 DirEntry::GetName(void) const
87 {
88         return __pDirEntryImpl->GetName();
89 }
90
91 unsigned long
92 DirEntry::GetFileSize(void) const
93 {
94         return __pDirEntryImpl->GetFileSize();
95 }
96
97 bool
98 DirEntry::IsDirectory(void) const
99 {
100         return __pDirEntryImpl->IsDirectory();
101 }
102
103 bool
104 DirEntry::IsHidden(void) const
105 {
106         return __pDirEntryImpl->IsHidden();
107 }
108
109 bool
110 DirEntry::IsReadOnly(void) const
111 {
112         return __pDirEntryImpl->IsReadOnly();
113 }
114
115 Tizen::Base::DateTime
116 DirEntry::GetDateTime(void) const
117 {
118         return __pDirEntryImpl->GetDateTime();
119 }
120
121 }} // Tizen::Io
122