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