Merge "Revert "Fix N_SE-46938 for tz list."" into devel_3.0_main
[platform/framework/native/appfw.git] / src / io / inc / FIo_SecureFile.h
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        FIo_SecureFile.h
19  * @brief       This is the header file for the _SecureFile class.
20  *
21  * This header file contains the declarations of the _SecureFile class.
22  */
23
24 #ifndef _FIO_INTERNAL_SECURE_FILE_IMPL_H_
25 #define _FIO_INTERNAL_SECURE_FILE_IMPL_H_
26
27 #include <FBaseObject.h>
28
29 #include <FIo_FileImpl.h>
30 #include <FIo_IFileCore.h>
31
32 namespace Tizen { namespace Base
33 {
34 class String;
35 class ByteBuffer;
36 }}
37
38 namespace Tizen { namespace Io
39 {
40
41 class _SecureFile
42         : public Tizen::Base::Object
43         , public _IFileCore
44 {
45
46 public:
47         _SecureFile(bool read, bool write, bool truncate, bool append);
48
49         result Construct(const Tizen::Base::String& filePath, const char* pOpenMode, const Tizen::Base::ByteBuffer* pSecretKey);
50
51         virtual ~_SecureFile(void);
52
53         result Read(Tizen::Base::ByteBuffer& buffer);
54
55         int Read(void* buffer, int length);
56
57         result Read(Tizen::Base::String& buffer);
58
59         result Write(const Tizen::Base::ByteBuffer& buffer);
60
61         result Write(const void* buffer, int length);
62
63         result Write(const Tizen::Base::String& buffer);
64
65         result Flush(void);
66
67         int Tell(void) const;
68
69         result Seek(FileSeekPosition position, long offset);
70
71         result Truncate(int length);
72
73         Tizen::Base::String GetName(void);
74
75         virtual FILE* GetFilePointer(void)
76         {
77                 return __pNormalFile->GetFilePointer();
78         }
79
80 private:
81         _SecureFile(void);
82
83         _SecureFile(const _SecureFile& source);
84
85         _SecureFile& operator =(const _SecureFile& source);
86
87         Tizen::Base::String __filePath;
88         _NormalFile* __pNormalFile;
89         bool __constructed;
90         long __virtualFilePointer;
91         Tizen::Base::ByteBuffer* __pKey;
92
93 }; // _SecureFile
94
95 }} // Tizen::Io
96
97 #endif // _FIO_INTERNAL_SECURE_FILE_IMPL_H_
98