2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FIoFileAttributes.cpp
19 * @brief This is the implementation file for FIoFileAttributes class.
24 #include <FIoFileAttributes.h>
25 #include <FBaseSysLog.h>
27 #include <FBase_NativeError.h>
28 #include <FIo_FileAttributesImpl.h>
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Io
35 FileAttributes::FileAttributes(void)
36 : __pFileAttributesImpl(null)
38 __pFileAttributesImpl = new (std::nothrow) _FileAttributesImpl;
39 SysTryReturnVoidResult(NID_IO, __pFileAttributesImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
42 FileAttributes::~FileAttributes(void)
44 delete __pFileAttributesImpl;
47 FileAttributes::FileAttributes(const FileAttributes& fileAttributes)
48 : __pFileAttributesImpl(null)
50 __pFileAttributesImpl = new (std::nothrow) _FileAttributesImpl(*fileAttributes.__pFileAttributesImpl);
51 SysTryReturnVoidResult(NID_IO, __pFileAttributesImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
55 FileAttributes::operator =(const FileAttributes& fileAttributes)
57 if (&fileAttributes != this)
59 delete __pFileAttributesImpl;
61 __pFileAttributesImpl = new (std::nothrow) _FileAttributesImpl(*fileAttributes.__pFileAttributesImpl);
62 SysLogException(NID_IO, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
70 FileAttributes::Equals(const Object& object) const
72 const FileAttributes* pOther = dynamic_cast< const FileAttributes* >(&object);
78 return __pFileAttributesImpl->Equals(*(pOther->__pFileAttributesImpl));
82 FileAttributes::GetHashCode(void) const
84 return __pFileAttributesImpl->GetHashCode();
88 FileAttributes::GetFileSize(void) const
90 return __pFileAttributesImpl->GetFileSize();
94 FileAttributes::GetDateTime(void) const
96 return __pFileAttributesImpl->GetDateTime();
100 FileAttributes::GetLastModifiedTime(void) const
102 return __pFileAttributesImpl->GetLastModifiedTime();
106 FileAttributes::IsDirectory(void) const
108 return __pFileAttributesImpl->IsDirectory();
112 FileAttributes::IsHidden(void) const
114 return __pFileAttributesImpl->IsHidden();
118 FileAttributes::IsReadOnly(void) const
120 return __pFileAttributesImpl->IsReadOnly();