e89aa0ac519833dfef3dddeff6030f607dc3f34c
[platform/framework/native/appfw.git] / src / io / FIoFileLock.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        FIoFileLock.cpp
19  * @brief       This is the implementation file for %FileLock class.
20  */
21
22 #include <new>
23 #include <limits.h>
24 #include <unique_ptr.h>
25
26 #include <FBaseResult.h>
27 #include <FBaseSysLog.h>
28 #include <FIoFileLock.h>
29 #include "FIo_FileImpl.h"
30 #include "FIo_FileLockImpl.h"
31
32 namespace Tizen { namespace Io
33 {
34
35 FileLock::FileLock(void)
36         : __pFileLockImpl(null)
37 {
38         __pFileLockImpl = new (std::nothrow) _FileLockImpl();
39         SysTryReturnVoidResult(NID_IO, __pFileLockImpl != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
40 }
41
42 FileLock::~FileLock(void)
43 {
44         delete __pFileLockImpl;
45 }
46
47 bool
48 FileLock::IsShared(void) const
49 {
50         return __pFileLockImpl->IsShared();
51 }
52
53 bool
54 FileLock::IsExclusive(void) const
55 {
56         return __pFileLockImpl->IsExclusive();
57 }
58
59 bool
60 FileLock::IsValid(void) const
61 {
62         return __pFileLockImpl->IsValid();
63 }
64
65 }} // Tizen::Io
66