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